-
Notifications
You must be signed in to change notification settings - Fork 0
/
PacketSniffer.h
49 lines (43 loc) · 958 Bytes
/
PacketSniffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#ifndef PACKET_SNIFFER_H
#define PACKET_SNIFFER_H
#include "Analysis.h"
#include <string>
#include <Tins/tins.h>
#include <queue>
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <thread>
using namespace std;
using namespace Tins;
class OUIResolver {
public:
OUIResolver(const string& filename);
string GetNameForOUI(const string& inputMAC) const;
private:
void LoadOUIFile(const string& filename);
map<string, string> ouiMap;
};
class Analyzer {
public:
Analyzer();
void Start();
bool Callback(PDU& pdu);
void DisplayPacket(PDU& pdu);
void UpdateFilter();
void StartSniffing();
void SavetoPCAP();
void ShowInterfaces();
private:
queue<IP> packets;
queue<IP> AnalysisQueue;
string filter;
NetworkInterface iface;
bool isSniffing;
int count;
OUIResolver ouiResolver;
//EventHandler* handler;
};
#endif // PACKET_SNIFFER_H