-
Notifications
You must be signed in to change notification settings - Fork 0
/
httpLib.hpp
50 lines (43 loc) · 1000 Bytes
/
httpLib.hpp
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
#ifndef httpLib_h
#define httpLib_h
#include<iostream>
#include<crafter.h>
#include<string>
#include <algorithm>
#include <vector>
#include"EthernetLibs.hpp"
#include <bits/stdc++.h>
#define iface "ens33"
using namespace std;
using namespace Crafter;
void Http_opsions(string payload){
if(payload.substr(0,3).compare("GET")==0){
cout <<"GET request:\n";
cout <<payload<<endl;
}
else if(payload.substr(0,4).compare("POST")==0){
cout << "POST request: \n";
cout << payload <<endl;
}
else if (payload.substr(0,8).compare("HTTP/1.1")==0)
{
cout << "HTTP Respone:\n";
cout <<payload<<endl;
}
else
{
cout << "encrepted message/ cant idenfiy:\n";
cout << payload << endl;
}
}
void Http_check(Packet* sniff_packet){
RawLayer* raw_payload = sniff_packet->GetLayer<RawLayer>();
if (raw_payload){
cout <<"raw_payload"<<endl;
if(raw_payload->GetPayloadSize()>0){
string payload = raw_payload->GetStringPayload();
Http_opsions(payload);
}
}
}
#endif