Major revamp of FlowPatternFinder to ensure thread safety. Added generic structure...
[pingpong.git] / Code / Projects / SmartPlugDetector / src / main / java / edu / uci / iotproject / Main.java
1 package edu.uci.iotproject;
2
3 import org.pcap4j.core.*;
4
5 import java.io.EOFException;
6 import java.net.UnknownHostException;
7 import java.util.concurrent.TimeoutException;
8
9 /**
10  * This is a system that reads PCAP files to compare
11  * patterns of DNS hostnames, packet sequences, and packet
12  * lengths with training data to determine certain events
13  * or actions for smart home devices.
14  *
15  * @author Janus Varmarken
16  * @author Rahmadi Trimananda (rtrimana@uci.edu)
17  * @version 0.1
18  */
19 public class Main {
20
21
22     public static void main(String[] args) throws PcapNativeException, NotOpenException, EOFException, TimeoutException, UnknownHostException {
23         final String fileName = "/users/varmarken/Desktop/wlan1.local.dns.pcap";
24 //        final String fileName = "/home/rtrimana/pcap_processing/smart_home_traffic/Code/Projects/SmartPlugDetector/pcap/wlan1.local.remote.dns.pcap";
25
26         // ====== Debug code ======
27         PcapHandle handle;
28         try {
29             handle = Pcaps.openOffline(fileName, PcapHandle.TimestampPrecision.NANO);
30         } catch (PcapNativeException pne) {
31             handle = Pcaps.openOffline(fileName);
32         }
33         FlowPatternFinder fpf = new FlowPatternFinder(handle, FlowPattern.TP_LINK_LOCAL_ON);
34         fpf.start();
35
36         // ========================
37     }
38 }