X-Git-Url: http://plrg.eecs.uci.edu/git/?p=pingpong.git;a=blobdiff_plain;f=Code%2FProjects%2FPacketLevelSignatureExtractor%2Fsrc%2Fmain%2Fjava%2Fedu%2Fuci%2Fiotproject%2FSignatureGenerator.java;h=c00f8ffcff14b060b72fe3a771e24ade06e098e5;hp=d342508a44f6a945ab3b6d3091e9ae096441efc6;hb=e858f6e0e1b043e17b7a31138f3dc6b093553b1d;hpb=9a7fc72d31cb71997c50f23d3f6858206249cd7d;ds=sidebyside diff --git a/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/SignatureGenerator.java b/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/SignatureGenerator.java index d342508..c00f8ff 100644 --- a/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/SignatureGenerator.java +++ b/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/SignatureGenerator.java @@ -57,11 +57,11 @@ public class SignatureGenerator { // final String triggerTimesFile = path + "/2018-10/dlink-plug/dlink-plug-oct-17-2018.timestamps"; // final String deviceIp = "192.168.1.199"; // .246 == phone; .199 == dlink plug? // TODO: EXPERIMENT - November 7, 2018 -// final String inputPcapFile = path + "/experimental_result/standalone/dlink-plug/wlan1/dlink-plug.wlan1.local.pcap"; -// final String outputPcapFile = path + "/experimental_result/standalone/dlink-plug/wlan1/dlink-plug-processed.pcap"; -// final String triggerTimesFile = path + "/experimental_result/standalone/dlink-plug/timestamps/dlink-plug-nov-7-2018.timestamps"; -//// final String deviceIp = "192.168.1.199"; // .246 == phone; .199 == dlink plug? -// final String deviceIp = "192.168.1.246"; // .246 == phone; .199 == dlink plug? + final String inputPcapFile = path + "/experimental_result/standalone/dlink-plug/wlan1/dlink-plug.wlan1.local.pcap"; + final String outputPcapFile = path + "/experimental_result/standalone/dlink-plug/wlan1/dlink-plug-processed.pcap"; + final String triggerTimesFile = path + "/experimental_result/standalone/dlink-plug/timestamps/dlink-plug-nov-7-2018.timestamps"; +// final String deviceIp = "192.168.1.199"; // .246 == phone; .199 == dlink plug? + final String deviceIp = "192.168.1.246"; // .246 == phone; .199 == dlink plug? // 2) TODO: TP-LINK PLUG July 25 experiment // final String inputPcapFile = path + "/2018-07/tplink/tplink.wlan1.local.pcap"; @@ -125,11 +125,11 @@ public class SignatureGenerator { // final String triggerTimesFile = path + "/2018-07/wemoinsight/wemo-insight-july-31-2018.timestamps"; // final String deviceIp = "192.168.1.135"; // TODO: EXPERIMENT - November 21, 2018 - final String inputPcapFile = path + "/experimental_result/standalone/wemo-insight-plug/wlan1/wemo-insight-plug.wlan1.local.pcap"; - final String outputPcapFile = path + "/experimental_result/standalone/wemo-insight-plug/wlan1/wemo-insight-plug-processed.pcap"; - final String triggerTimesFile = path + "/experimental_result/standalone/wemo-insight-plug/timestamps/wemo-insight-plug-nov-21-2018.timestamps"; -// final String deviceIp = "192.168.1.145"; // .246 == phone; .135 == WeMo Insight - final String deviceIp = "192.168.1.246"; // .246 == phone; .135 == WeMo Insight +// final String inputPcapFile = path + "/experimental_result/standalone/wemo-insight-plug/wlan1/wemo-insight-plug.wlan1.local.pcap"; +// final String outputPcapFile = path + "/experimental_result/standalone/wemo-insight-plug/wlan1/wemo-insight-plug-processed.pcap"; +// final String triggerTimesFile = path + "/experimental_result/standalone/wemo-insight-plug/timestamps/wemo-insight-plug-nov-21-2018.timestamps"; +//// final String deviceIp = "192.168.1.145"; // .246 == phone; .135 == WeMo Insight +// final String deviceIp = "192.168.1.246"; // .246 == phone; .135 == WeMo Insight // 6) TODO: TP-LINK BULB August 1 experiment // final String inputPcapFile = path + "/2018-08/tplink-bulb/tplinkbulb.wlan1.local.pcap"; @@ -327,8 +327,8 @@ public class SignatureGenerator { // final String offSignatureFile = path + "/experimental_result/standalone/st-plug/signatures/st-plug-offSignature-phone-side.sig"; // Arlo Q // final String triggerTimesFile = path + "/experimental_result/standalone/arlo-camera/timestamps/arlo-camera-nov-13-2018.timestamps"; -// final String onSignatureFile = path + "/experimental_result/standalone/arlo-camera/signatures/arlo-camera-onSignature-phone-side.sig"; -// final String offSignatureFile = path + "/experimental_result/standalone/arlo-camera/signatures/arlo-camera-offSignature-phone-side.sig"; +// final String onSignatureFile = path + "/experimental_result/standalone/arlo-camera/signatures/arlo-camera-onSignature-phone-side.complete.sig"; +// final String offSignatureFile = path + "/experimental_result/standalone/arlo-camera/signatures/arlo-camera-offSignature-phone-side.complete.sig"; // Nest thermostat // final String triggerTimesFile = path + "/experimental_result/standalone/nest-thermostat/timestamps/nest-thermostat-nov-15-2018.timestamps"; // final String onSignatureFile = path + "/experimental_result/standalone/nest-thermostat/signatures/nest-thermostat-onSignature-phone-side.sig"; @@ -363,8 +363,8 @@ public class SignatureGenerator { // System.out.println("ON signature file in use is " + onSignatureFile); // System.out.println("OFF signature file in use is " + offSignatureFile); // -// List>> onSignature = PrintUtils.deserializeSignatureFromFile(onSignatureFile); -// List>> offSignature = PrintUtils.deserializeSignatureFromFile(offSignatureFile); +// List>> onSignature = PrintUtils.deserializeFromFile(onSignatureFile); +// List>> offSignature = PrintUtils.deserializeFromFile(offSignatureFile); // // List signatureTimestamps = new ArrayList<>(); // // Load ON signature last packet's timestamp @@ -924,51 +924,8 @@ public class SignatureGenerator { } return isRange; -// if (!isRangeBased(signatureRanges) && !isRangeBased(otherSignatureRanges)) { -// // Conservative checking when there is no range -// return true; -// } else if(signatureRanges.size() != otherSignatureRanges.size()) { -// // The two signatures have different numbers of packets/packet lengths -// return false; -// } else { -// // There is range; check if there is overlap -// return checkOverlap(signatureRanges, otherSignatureRanges); -// } } - /* - * Check for overlap since we have range in at least one of the signatures. - * Overlap is only true when all ranges overlap. We need to check in order. - */ -// private boolean checkOverlap(List>> signatureRanges, -// List>> otherSignatureRanges) { -// -// for(List> listListPcapPacket : signatureRanges) { -// // Lower bound of the range is in index 0 -// // Upper bound of the range is in index 1 -// int sequenceSetIndex = signatureRanges.indexOf(listListPcapPacket); -// List minSequenceSignature = listListPcapPacket.get(0); -// List maxSequenceSignature = listListPcapPacket.get(1); -// for(PcapPacket pcapPacket : minSequenceSignature) { -// // Get the lower and upper bounds of the current signature -// int packetIndex = minSequenceSignature.indexOf(pcapPacket); -// int lowerBound = pcapPacket.length(); -// int upperBound = maxSequenceSignature.get(packetIndex).length(); -// // Check for range overlap in the other signature! -// // Check the packet/packet length at the same position -// List minSequenceSignatureOther = otherSignatureRanges.get(sequenceSetIndex).get(0); -// List maxSequenceSignatureOther = otherSignatureRanges.get(sequenceSetIndex).get(1); -// int lowerBoundOther = minSequenceSignatureOther.get(packetIndex).length(); -// int upperBoundOther = maxSequenceSignatureOther.get(packetIndex).length(); -// if (!(lowerBoundOther <= lowerBound && lowerBound <= upperBoundOther) && -// !(lowerBoundOther <= upperBound && upperBound <= upperBoundOther)) { -// return false; -// } -// } -// } -// -// return true; -// } /* * Check and see if there is any range in the signatures @@ -992,40 +949,6 @@ public class SignatureGenerator { return false; } - -// /* Find the sequence with the minimum packet lengths. -// * The second-layer list should contain the minimum sequence for element 0 and maximum sequence for element 1. -// */ -// private List>> getSequenceRanges(List>> signature) { -// -// // Start from the first index -// List>> rangeBasedSequence = new ArrayList<>(); -// for (List> listListPcapPacket : signature) { -// List> minMaxSequence = new ArrayList<>(); -// // Both searches start from index 0 -// List minSequence = new ArrayList<>(listListPcapPacket.get(0)); -// List maxSequence = new ArrayList<>(listListPcapPacket.get(0)); -// for (List listPcapPacket : listListPcapPacket) { -// for (PcapPacket pcapPacket : listPcapPacket) { -// int index = listPcapPacket.indexOf(pcapPacket); -// // Set the new minimum if length at the index is minimum -// if (pcapPacket.length() < minSequence.get(index).length()) { -// minSequence.set(index, pcapPacket); -// } -// // Set the new maximum if length at the index is maximum -// if (pcapPacket.length() > maxSequence.get(index).length()) { -// maxSequence.set(index, pcapPacket); -// } -// } -// } -// // minSequence as element 0 and maxSequence as element 1 -// minMaxSequence.add(minSequence); -// minMaxSequence.add(maxSequence); -// rangeBasedSequence.add(minMaxSequence); -// } -// -// return rangeBasedSequence; -// } }