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