-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTTFSessionManager.h
More file actions
45 lines (41 loc) · 1.18 KB
/
TTFSessionManager.h
File metadata and controls
45 lines (41 loc) · 1.18 KB
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
#pragma once
#include <tr1/memory>
#include <vector>
#include <map>
#include <set>
#include <utility>
#ifdef _WIN32
#include <iphlpapi.h>
#endif
#include "TTFSession.h"
#include "TTFRule.h"
typedef std::map<unsigned long long, PTTFSession> TTFSessionList;
class TTFSessionManager
{
protected:
const unsigned int localAddr;
TTFSessionList *sessionList;
std::set<std::string> targetProcessList;
std::map<unsigned int,std::string> targetPids;
std::map<unsigned int,int> blockedAddrs;
std::set<unsigned int> blackList;
std::vector<std::pair<unsigned int, unsigned int> > rangedBlackList;
int blackListThreshold;
TTFRules rules;
public:
TTFSessionManager(unsigned int lAddr, int threshold);
~TTFSessionManager();
void commitPacket(unsigned char *data);
void addRule(PTTFRule rule);
void addBlacklistedAddress(unsigned int address);
void addRangedBlacklistedAddress(unsigned int start, unsigned int end);
void updateTargetSessions(void);
void updateTargetProcessPid(void);
void applyFilters(void);
void printTargetSessionsState(void);
private:
void registerToBlackList(PTTFSession session, PTTFRule rule);
#ifdef _WIN32
bool applyBlackListFilter(MIB_TCPROW_OWNER_PID *table);
#endif
};