import edu.uci.iotproject.analysis.TriggerTrafficExtractor;
import edu.uci.iotproject.analysis.UserAction;
+import edu.uci.iotproject.detection.AbstractClusterMatcher;
+import edu.uci.iotproject.detection.ClusterMatcherObserver;
import edu.uci.iotproject.io.PcapHandleReader;
import edu.uci.iotproject.util.PrintUtils;
import org.jgrapht.GraphPath;
* @author Janus Varmarken {@literal <jvarmark@uci.edu>}
* @author Rahmadi Trimananda {@literal <rtrimana@uci.edu>}
*/
-public class SignatureDetector implements PacketListener, Layer3ClusterMatcher.ClusterMatchObserver {
+public class SignatureDetector implements PacketListener, ClusterMatcherObserver {
// Test client
public static void main(String[] args) throws PcapNativeException, NotOpenException {
// TODO: The following are negative tests against the PCAP file from UNSW
// final String inputPcapFile = path + "/UNSW/16-10-04.pcap"; // TODO: Seems to be broken! Zero-payload!
-// final String inputPcapFile = path + "/UNSW/16-10-12.pcap";
+// final String inputPcapFile = path + "/UNSW/16-10-12.pcap";
// final String inputPcapFile = path + "/UNSW/16-09-28.pcap"; // TODO: Seems to be broken! Zero-payload!
// final String inputPcapFile = path + "/UNSW/16-10-02.pcap"; // TODO: Seems to be broken!
// final String inputPcapFile = path + "/UNSW/16-10-01.pcap";
// final String inputPcapFile = path + "/UNSW/16-10-06.pcap";
// Negative test: dataset from UNB
-// final String inputPcapFile = path + "/evaluation/negative-datasets/UNB/Monday-WorkingHours_one-local-endpoint.pcap";
+// final String inputPcapFile = path + "/evaluation/negative-datasets/UNB/Monday-WorkingHours_one-local-endpoint-001.pcap";
// TODO: The following are tests for signatures against training data
// TODO: EXPERIMENT - January 9, 2018
// Blossom Sprinkler experiment
-// final String inputPcapFile = path + "/experimental_result/standalone/blossom-sprinkler/wlan1/blossom-sprinkler.wlan1.local.pcap";
+ final String inputPcapFile = path + "/experimental_result/standalone/blossom-sprinkler/wlan1/blossom-sprinkler.wlan1.local.pcap";
// final String inputPcapFile = path + "/experimental_result/smarthome/blossom-sprinkler/eth0/blossom-sprinkler.eth0.detection.pcap";
- final String inputPcapFile = path + "/experimental_result/smarthome/blossom-sprinkler/wlan1/blossom-sprinkler.wlan1.detection.pcap";
+// final String inputPcapFile = path + "/experimental_result/smarthome/blossom-sprinkler/wlan1/blossom-sprinkler.wlan1.detection.pcap";
// Blossom Sprinkler DEVICE signatures
// final String onSignatureFile = path + "/experimental_result/standalone/blossom-sprinkler/signatures/blossom-sprinkler-onSignature-device-side.sig";
// final String offSignatureFile = path + "/experimental_result/standalone/blossom-sprinkler/signatures/blossom-sprinkler-offSignature-device-side.sig";
List<List<List<PcapPacket>>> offSignature = PrintUtils.deserializeSignatureFromFile(offSignatureFile);
// LAN
- SignatureDetector onDetector = new SignatureDetector(onSignature, null);
- SignatureDetector offDetector = new SignatureDetector(offSignature, null);
+// SignatureDetector onDetector = new SignatureDetector(onSignature, null);
+// SignatureDetector offDetector = new SignatureDetector(offSignature, null);
// WAN
-// SignatureDetector onDetector = new SignatureDetector(onSignature, "128.195.205.105");
-// SignatureDetector offDetector = new SignatureDetector(offSignature, "128.195.205.105");
+ SignatureDetector onDetector = new SignatureDetector(onSignature, "128.195.205.105");
+ SignatureDetector offDetector = new SignatureDetector(offSignature, "128.195.205.105");
final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).
withLocale(Locale.US).withZone(ZoneId.of("America/Los_Angeles"));
}
@Override
- public void onMatch(Layer3ClusterMatcher clusterMatcher, List<PcapPacket> match) {
+ public void onMatch(AbstractClusterMatcher clusterMatcher, List<PcapPacket> match) {
// Add the match at the corresponding index
pendingMatches[mClusterMatcherIds.get(clusterMatcher)].add(match);
checkSignatureMatch();