// final String outputPcapFile = path + "/2018-07/stplug/stplug-processed.pcap";
// final String triggerTimesFile = path + "/2018-07/stplug/smartthings-july-25-2018.timestamps";
// final String deviceIp = "192.168.1.246"; // .246 == phone; .142 == SmartThings Hub (note: use eth0 capture for this!)
+ // October 18
+ final String inputPcapFile = path + "/2018-10/st-plug/st-plug.wlan1.local.pcap";
+ final String outputPcapFile = path + "/2018-10/st-plug/st-plug-processed.pcap";
+ final String triggerTimesFile = path + "/2018-10/st-plug/st-plug-oct-18-2018.timestamps";
+ final String deviceIp = "192.168.1.246"; // .246 == phone; .142 == SmartThings Hub (note: use eth0 capture for this!)
// 4) Wemo July 30 experiment
// final String inputPcapFile = path + "/2018-07/wemo/wemo.wlan1.local.pcap";
// final String outputPcapFile = path + "/2018-08/hue-bulb/hue-bulb-processed.pcap";
// final String triggerTimesFile = path + "/2018-08/hue-bulb/hue-bulb-aug-7-2018.timestamps";
// final String deviceIp = "192.168.1.246";
+ // October 30 experiment
+// final String inputPcapFile = path + "/2018-10/hue-bulb/hue-bulb.eth1.local.pcap";
+// final String outputPcapFile = path + "/2018-10/hue-bulb/hue-bulb-processed.pcap";
+// final String triggerTimesFile = path + "/2018-10/hue-bulb/hue-bulb-oct-30-2018.timestamps";
+// final String deviceIp = "192.168.1.100"; // .246 == phone; .100 == Hue hub
// 9) Lifx Bulb August 8 experiment
// final String inputPcapFile = path + "/2018-08/lifx-bulb/lifx-bulb.wlan1.local.pcap";
// final String deviceIp = "192.168.1.246"; // .246 == phone; .235 == camera
// 11) Arlo Camera August 10 experiment
- final String inputPcapFile = path + "/2018-08/arlo-camera/arlo-camera.wlan1.local.pcap";
- final String outputPcapFile = path + "/2018-08/arlo-camera/arlo-camera-processed.pcap";
- final String triggerTimesFile = path + "/2018-08/arlo-camera/arlo-camera-aug-10-2018.timestamps";
- final String deviceIp = "192.168.1.246"; // .246 == phone; .140 == camera
+// final String inputPcapFile = path + "/2018-08/arlo-camera/arlo-camera.wlan1.local.pcap";
+// final String outputPcapFile = path + "/2018-08/arlo-camera/arlo-camera-processed.pcap";
+// final String triggerTimesFile = path + "/2018-08/arlo-camera/arlo-camera-aug-10-2018.timestamps";
+// final String deviceIp = "192.168.1.246"; // .246 == phone; .140 == camera
// 12) Blossom sprinkler August 13 experiment
// final String inputPcapFile = path + "/2018-08/blossom/blossom.wlan1.local.pcap";
// final String outputPcapFile = path + "/2018-08/blossom/blossom-processed.pcap";
// final String triggerTimesFile = path + "/2018-08/blossom/blossom-aug-13-2018.timestamps";
-// final String deviceIp = "192.168.1.246"; // .246 == phone; .229 == sprinkler
+// final String deviceIp = "192.168.1.229"; // .246 == phone; .229 == sprinkler
// // 13) DLink siren August 14 experiment
// final String inputPcapFile = path + "/2018-08/dlink-siren/dlink-siren.wlan1.local.pcap";
}
}
// TODO: Merging test
- PcapPacketUtils.mergeSignatures(ppListOfListListOn, sortedAllConversation);
- PcapPacketUtils.sortSignatures(ppListOfListListOn);
+ ppListOfListListOn = PcapPacketUtils.mergeSignatures(ppListOfListListOn, sortedAllConversation);
+ ppListOfListListOn = PcapPacketUtils.sortSignatures(ppListOfListListOn);
PcapPacketUtils.printSignatures(ppListOfListListOn);
//count = 0;
/*for (List<List<PcapPacket>> ll : ppListOfListListOn) {
}
}
// TODO: Merging test
- PcapPacketUtils.mergeSignatures(ppListOfListListOff, sortedAllConversation);
- PcapPacketUtils.sortSignatures(ppListOfListListOff);
+ ppListOfListListOff = PcapPacketUtils.mergeSignatures(ppListOfListListOff, sortedAllConversation);
+ ppListOfListListOff = PcapPacketUtils.sortSignatures(ppListOfListListOff);
PcapPacketUtils.printSignatures(ppListOfListListOff);
//count = 0;
/*for (List<List<PcapPacket>> ll : ppListOfListListOff) {
//final String offSignatureFile = path + "/training/tplink-plug/signatures/tplink-plug-offSignature-device-side.sig";
*/
- // TP-Link Plug experiment
- final String inputPcapFile = path + "/training/arlo-camera/wlan1/arlo-camera.wlan1.local.pcap";
+ // Arlo camera experiment
+// final String inputPcapFile = path + "/training/arlo-camera/wlan1/arlo-camera.wlan1.local.pcap";
+// // TP-Link Plug DEVICE signatures
+// final String onSignatureFile = path + "/training/arlo-camera/signatures/arlo-camera-onSignature-phone-side.sig";
+// final String offSignatureFile = path + "/training/arlo-camera/signatures/arlo-camera-offSignature-phone-side.sig";
+
+ // Amazon Alexa experiment
+ final String inputPcapFile = path + "/training/amazon-alexa/wlan1/alexa2.wlan1.local.pcap";
// TP-Link Plug DEVICE signatures
- final String onSignatureFile = path + "/training/arlo-camera/signatures/arlo-camera-onSignature-phone-side.sig";
- final String offSignatureFile = path + "/training/arlo-camera/signatures/arlo-camera-offSignature-phone-side.sig";
+ final String onSignatureFile = path + "/training/amazon-alexa/signatures/amazon-alexa-onSignature-device-side.sig";
+ final String offSignatureFile = path + "/training/amazon-alexa/signatures/amazon-alexa-offSignature-device-side.sig";
// SmartThings Plug experiment
// final String inputPcapFile = path + "/training/st-plug/wlan1/st-plug.wlan1.local.pcap";
* If after a merging the number of members of a signature falls below this threshold, then we can boldly
* get rid of that signature.
*/
- private static final int SIGNATURE_MERGE_THRESHOLD = 15;
+ private static final int SIGNATURE_MERGE_THRESHOLD = 5;
/**
* Determines if a given {@link PcapPacket} wraps a {@link TcpPacket}.
*/
public static List<List<List<PcapPacket>>>
mergeSignatures(List<List<List<PcapPacket>>> signatures, List<Conversation> conversations) {
- // Make a copy first.
- List<List<List<PcapPacket>>> copySignatures = new ArrayList<>(signatures);
+
+ // TODO: THIS IS NOT A DEEP COPY; IT BASICALLY CREATES A REFERENCE TO THE SAME LIST OBJECT
+ // List<List<List<PcapPacket>>> copySignatures = new ArrayList<>(signatures);
+ // Make a deep copy first.
+ List<List<List<PcapPacket>>> copySignatures = new ArrayList<>();
+ listDeepCopy(copySignatures, signatures);
// Traverse and look into the pairs of signatures.
for (int first = 0; first < signatures.size(); first++) {
List<List<PcapPacket>> firstList = signatures.get(first);
// TODO: DOUBLE CHECK IF WE REALLY NEED TO PRUNE FAILED BINDINGS
// TODO: SOMETIMES THE SEQUENCES ARE JUST INCOMPLETE
// TODO: AND BOTH THE COMPLETE AND INCOMPLETE SEQUENCES ARE VALID SIGNATURES!
- // firstList.removeIf(el -> el.size() < maxNumOfEl);
+ firstList.removeIf(el -> el.size() < maxNumOfEl);
// Remove the merged set of signatures when successful.
signatures.remove(secondList);
} else if (secondList.size() < initialSecondListMembers) {
return signatures;
}
+ /**
+ * Deep copy to create an entirely new {@link List} of {@link List} of {@link List} of {@link PcapPacket} objects.
+ * @param destList A {@link List} of {@link List} of {@link List} of
+ * {@link PcapPacket} objects that will be the final container of the deep copy
+ * @param sourceList A {@link List} of {@link List} of {@link List} of
+ * {@link PcapPacket} objects that will be the source of the deep copy.
+ */
+ private static void listDeepCopy(List<List<List<PcapPacket>>> destList, List<List<List<PcapPacket>>> sourceList) {
+
+ for(List<List<PcapPacket>> llPcapPacket : sourceList) {
+ List<List<PcapPacket>> tmpListOfList = new ArrayList<>();
+ for(List<PcapPacket> lPcapPacket : llPcapPacket) {
+ List<PcapPacket> tmpList = new ArrayList<>();
+ for(PcapPacket pcapPacket : lPcapPacket) {
+ tmpList.add(pcapPacket);
+ }
+ tmpListOfList.add(tmpList);
+ }
+ destList.add(tmpListOfList);
+ }
+ }
+
/**
* Sort the signatures in the {@code List} of {@code List} of {@code List} of {@code PcapPacket} objects.
* The purpose of this is to sort the order of signatures in the signature list. For detection purposes, we need