1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-25 11:41:35 +01:00

Add HTTP requests example

This commit is contained in:
Matias Fontanini
2016-02-15 08:29:14 -08:00
parent eb1c43d293
commit 91a724fe2d
5 changed files with 188 additions and 8 deletions

View File

@@ -129,13 +129,12 @@ int main(int argc, char* argv[]) {
cout << "Usage: " << argv[0] << " <interface> <port>" << endl;
return 1;
}
using std::placeholders::_1;
try {
// Construct the sniffer configuration object
SnifferConfiguration config;
// Only capture TCP traffic sent from/to port 80
config.set_filter("tcp port " + string(argv[2]));
// Only capture TCP traffic sent from/to the given port
config.set_filter("tcp port " + to_string(stoi(string(argv[2]))));
// Construct the sniffer we'll use
Sniffer sniffer(argv[1], config);