Clean up + read filename from program args; default to Rahmadi's hardcoded test file...
authorJanus Varmarken <varmarken@gmail.com>
Fri, 4 May 2018 08:05:27 +0000 (01:05 -0700)
committerJanus Varmarken <varmarken@gmail.com>
Fri, 4 May 2018 08:05:27 +0000 (01:05 -0700)
Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java
Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java

index 9dba468538fbeee813aae64396f893e2e60ac5ec..115294645a8820df22a7531b83b8ffc12b741a3e 100644 (file)
@@ -172,45 +172,4 @@ public class FlowPatternFinder {
         }
     }
 
-//    private static class PatternComparisonTask implements Runnable {
-//
-//        private final Conversation mConversation;
-//        private final FlowPattern mFlowPattern;
-//
-//        private PatternComparisonTask(Conversation conversation, FlowPattern pattern) {
-//            this.mConversation = conversation;
-//            this.mFlowPattern = pattern;
-//        }
-//
-//        @Override
-//        public void run() {
-//            if(isCompleteMatch()) {
-//                PcapPacket firstPacketInFlow = mConversation.getPackets().get(0);
-//                System.out.println(
-//                        String.format("[ find ] Detected a complete match of pattern '%s' at %s!",
-//                                mFlowPattern.getPatternId(), firstPacketInFlow.getTimestamp().toString()));
-//            }
-//        }
-//
-//        /**
-//         * Compares the order of packet lengths present in {@link #mConversation} with those found in
-//         * {@link #mFlowPattern}.
-//         * @return {@code true} if the packet lengths matches pairwise for all indices, {@code false} otherwise.
-//         */
-//        private boolean isCompleteMatch() {
-//            List<PcapPacket> convPackets = mConversation.getPackets();
-//            if (convPackets.size() != mFlowPattern.getLength()) {
-//                return false;
-//            }
-//            for (int i = 0; i < convPackets.size(); i++) {
-//                TcpPacket tcpPacket = convPackets.get(i).get(TcpPacket.class);
-//                if (tcpPacket.getPayload().length() != mFlowPattern.getPacketOrder().get(i)) {
-//                    return false;
-//                }
-//            }
-//            return true;
-//        }
-//
-//    }
-
 }
index 0b01c2cfd9cacdee83af44c0f83c1dd6b252ac5e..490ad0d5178d67306b20a7a5bc1948a99a45d8ea 100644 (file)
@@ -20,8 +20,7 @@ public class Main {
 
 
     public static void main(String[] args) throws PcapNativeException, NotOpenException, EOFException, TimeoutException, UnknownHostException {
-        final String fileName = "/users/varmarken/Desktop/wlan1.local.dns.pcap";
-//        final String fileName = "/home/rtrimana/pcap_processing/smart_home_traffic/Code/Projects/SmartPlugDetector/pcap/wlan1.local.remote.dns.pcap";
+        String fileName = args.length > 0 ? args[0] : "/home/rtrimana/pcap_processing/smart_home_traffic/Code/Projects/SmartPlugDetector/pcap/wlan1.local.remote.dns.pcap";
 
         // ====== Debug code ======
         PcapHandle handle;