forked from p0f/p0f
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p0f_info.cpp
67 lines (53 loc) · 1.38 KB
/
p0f_info.cpp
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <string>
#include <map>
#include "p0f_info.h"
#include <QDebug>
using namespace std;
p0f_info::p0f_info(QString ip,info_type packet_type){
ip_address = ip;
type = packet_type;
}
//Return all informations about the packet
QString p0f_info::get_info(){
QString type_of_info = "";
if (type == MTU_INFO){
type_of_info = " MTU";
}
else if (type == SYN_INFO){
type_of_info = " SYN";
}
else if (type == HTTP_REQUEST){
type_of_info = " HTTP REQUEST";
}
else if (type == HTTP_RESPONSE){
type_of_info = " HTTP RESPONSE";
}
else if (type == UPTIME_INFO){
type_of_info = " UPTIME";
}
else if (type == IP_SHARING){
type_of_info = " IP SHARING";
}
else if (type == HOST_CHANGE){
type_of_info = " HOST CHANGE";
}
QString info = "\n\nPACKET" + type_of_info;
foreach (QString key,information.keys()){
if (information.value(key) != "" && information.value(key) != "none"){
info.append("\n" + key + ": " + information.value(key));
}
}
return info;
}
QString p0f_info::get_value(QString field){
return information.value(field);
}
QString p0f_info::get_address(){
return ip_address;
}
info_type p0f_info::get_type(){
return type;
}
void p0f_info::set_info_field(QString key,QString value){
information.insert(key,value);
}