From d74e05e339843d2c2c57518268aa5669f5a51887 Mon Sep 17 00:00:00 2001 From: Janus Varmarken Date: Fri, 4 May 2018 01:05:27 -0700 Subject: [PATCH] Clean up + read filename from program args; default to Rahmadi's hardcoded test file if no program args provided. --- .../edu/uci/iotproject/FlowPatternFinder.java | 41 ------------------- .../main/java/edu/uci/iotproject/Main.java | 3 +- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java index 9dba468..1152946 100644 --- a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java +++ b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/FlowPatternFinder.java @@ -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 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; -// } -// -// } - } diff --git a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java index 0b01c2c..490ad0d 100644 --- a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java +++ b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java @@ -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; -- 2.34.1