From: Janus Varmarken Date: Thu, 26 Jul 2018 22:02:09 +0000 (-0700) Subject: Main.java: cleanup - leave only code for extracting traffic generated by a device... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=05aa7c0ddff2887d51fc2ad4c301bc7113e27fea;p=pingpong.git Main.java: cleanup - leave only code for extracting traffic generated by a device within x seconds of a trigger --- 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 940b8a4..76134dc 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 @@ -25,16 +25,19 @@ public class Main { public static void main(String[] args) throws PcapNativeException, NotOpenException, EOFException, TimeoutException, UnknownHostException { - // -------- 07-19-2018 -------- + // ------------------------------------------------------------------------------------------------------------- + // ------------ # Code for extracting traffic generated by a device within x seconds of a trigger # ------------ + // Paths to input and output files (consider supplying these as arguments instead) + final String inputPcapFile = "/Users/varmarken/temp/UCI IoT Project/June2018 experiments/tplink/tplink.wlan1.local.pcap"; + final String outputPcapFile = "/Users/varmarken/temp/UCI IoT Project/June2018 experiments/tplink/tplink-filtered.pcap"; + final String triggerTimesFile = "/Users/varmarken/temp/UCI IoT Project/June2018 experiments/tplink/tplink-june-14-2018-timestamps.txt"; + // IP of the device for which traffic is to be extracted + final String deviceIp = "192.168.1.159"; + TriggerTimesFileReader ttfr = new TriggerTimesFileReader(); -// List triggerTimes = ttfr.readTriggerTimes("/Users/varmarken/Downloads/tplink-feb-13-2018.timestamps", false); - List triggerTimes = ttfr.readTriggerTimes("/Users/varmarken/temp/UCI IoT Project/June2018 experiments/tplink/tplink-june-14-2018-timestamps.txt", false); -// String pcapFile = "/Users/varmarken/Development/Repositories/UCI/NetworkingGroup/smart_home_traffic/Code/Projects/SmartPlugDetector/pcap/wlan1.local.dns.pcap"; - String pcapFile = "/Users/varmarken/temp/UCI IoT Project/June2018 experiments/tplink/tplink.wlan1.local.pcap"; - String tpLinkPlugIp = "192.168.1.159"; - TriggerTrafficExtractor tte = new TriggerTrafficExtractor(pcapFile, triggerTimes, tpLinkPlugIp); -// final PcapDumper outputter = Pcaps.openDead(DataLinkType.EN10MB, 65536).dumpOpen("/Users/varmarken/temp/traces/output/tplink-filtered.pcap"); - final PcapDumper outputter = Pcaps.openDead(DataLinkType.EN10MB, 65536).dumpOpen("/Users/varmarken/temp/UCI IoT Project/June2018 experiments/tplink/tplink-filtered.pcap"); + List triggerTimes = ttfr.readTriggerTimes(triggerTimesFile, false); + TriggerTrafficExtractor tte = new TriggerTrafficExtractor(inputPcapFile, triggerTimes, deviceIp); + final PcapDumper outputter = Pcaps.openDead(DataLinkType.EN10MB, 65536).dumpOpen(outputPcapFile); DnsMap dnsMap = new DnsMap(); TcpReassembler tcpReassembler = new TcpReassembler(); tte.performExtraction(pkt -> { @@ -46,7 +49,8 @@ public class Main { }, dnsMap, tcpReassembler); outputter.flush(); outputter.close(); - // ---------------------------- + // ------------------------------------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------------------------------------- } }