Adding back the debug feature.
authorrtrimana <rtrimana@uci.edu>
Fri, 15 Mar 2019 17:59:59 +0000 (10:59 -0700)
committerrtrimana <rtrimana@uci.edu>
Fri, 15 Mar 2019 17:59:59 +0000 (10:59 -0700)
Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/detection/layer2/Layer2SignatureDetector.java

index 7683ae6..995eb49 100644 (file)
@@ -134,12 +134,12 @@ public class Layer2SignatureDetector implements PacketListener, ClusterMatcherOb
         // TODO: SINCE WE ONLY HAVE 2 SIGNATURES FOR NOW (ON AND OFF), THEN IT IS USUALLY EITHER RANGE-BASED OR
         // TODO: STRICT MATCHING
         // Check if we should use range-based matching
-        boolean isRangeBasedForOn = PcapPacketUtils.isRangeBasedMatching(onSignature, eps, offSignature);
-        boolean isRangeBasedForOff = PcapPacketUtils.isRangeBasedMatching(offSignature, eps, onSignature);
+//        boolean isRangeBasedForOn = PcapPacketUtils.isRangeBasedMatching(onSignature, eps, offSignature);
+//        boolean isRangeBasedForOff = PcapPacketUtils.isRangeBasedMatching(offSignature, eps, onSignature);
         // TODO: WE DON'T DO RANGE-BASED FOR NOW BECAUSE THE RESULTS ARE TERRIBLE FOR LAYER 2 MATCHING
         // TODO: THIS WOULD ONLY WORK FOR SIGNATURES LONGER THAN 2 PACKETS
-//        boolean isRangeBasedForOn = false;
-//        boolean isRangeBasedForOff = false;
+        boolean isRangeBasedForOn = false;
+        boolean isRangeBasedForOff = false;
         // Update the signature with ranges if it is range-based
         if (isRangeBasedForOn) {
             onSignature = PcapPacketUtils.useRangeBasedMatching(onSignature, onClusterAnalysis);
@@ -162,9 +162,9 @@ public class Layer2SignatureDetector implements PacketListener, ClusterMatcherOb
         offDetector.addObserver((signature, match) -> {
             UserAction event = new UserAction(UserAction.Type.TOGGLE_OFF, match.get(0).get(0).getTimestamp());
             PrintWriterUtils.println(event, resultsWriter, DUPLICATE_OUTPUT_TO_STD_OUT);
-//            for (PcapPacket pcap : match.get(0)) {
-//                System.out.println(pcap.length() + " -> " + pcap.getTimestamp());
-//            }
+            for (PcapPacket pcap : match.get(0)) {
+                System.out.println(pcap.length() + " -> " + pcap.getTimestamp());
+            }
             detectedEvents.add(event);
         });