mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Updated example.
This commit is contained in:
@@ -58,6 +58,10 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
arp_monitor monitor;
|
||||
Sniffer sniffer(argv[1], 2000, true, "arp");
|
||||
// Sniff on the provided interface in promiscuous mode
|
||||
Sniffer sniffer(argv[1], Sniffer::PROMISC);
|
||||
|
||||
// Only capture arp packets
|
||||
sniffer.set_filter("arp");
|
||||
monitor.run(sniffer);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
};
|
||||
|
||||
void BeaconSniffer::run(const std::string &iface) {
|
||||
Sniffer sniffer(iface, 1500, true, "type mgt subtype beacon", true);
|
||||
Sniffer sniffer(iface, Sniffer::PROMISC, "type mgt subtype beacon", true);
|
||||
sniffer.sniff_loop(make_sniffer_handler(this, &BeaconSniffer::callback));
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,12 @@ int main(int argc, char *argv[])
|
||||
std::cout << "Usage: " << *argv << " <interface>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
// Sniff on the provided interface, maximum packet size 2000
|
||||
// in promiscuos mode and only udp packets sent to port 53
|
||||
Sniffer sniffer(argv[1], 2000, true, "udp and dst port 53");
|
||||
// Sniff on the provided interface in promiscuos mode
|
||||
Sniffer sniffer(argv[1], Sniffer::PROMISC);
|
||||
|
||||
// Only capture udp packets sent to port 53
|
||||
sniffer.set_filter("udp and dst port 53");
|
||||
|
||||
// Start the capture
|
||||
sniffer.sniff_loop(callback);
|
||||
}
|
||||
|
||||
@@ -89,10 +89,15 @@ int main(int argc, char *argv[])
|
||||
std::cout << "Usage: " << *argv << " <interface>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
// Sniff on the provided interface, maximum packet size 2000
|
||||
// in promiscuos mode and only udp packets sent to port 53
|
||||
Sniffer sniffer(argv[1], 2000, true, "udp and dst port 53");
|
||||
// Sniff on the provided interface in promiscuos mode
|
||||
Sniffer sniffer(argv[1], Sniffer::PROMISC);
|
||||
|
||||
// Only capture udp packets sent to port 53
|
||||
sniffer.set_filter("udp and dst port 53");
|
||||
|
||||
// All packets will be sent through the provided interface
|
||||
sender.default_interface(argv[1]);
|
||||
|
||||
// Start the capture
|
||||
sniffer.sniff_loop(callback);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ int main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
Sniffer sniffer(argv[1]);
|
||||
Sniffer sniffer(argv[1], Sniffer::PROMISC);
|
||||
sniffer.set_filter("udp and port 53");
|
||||
dns_monitor monitor;
|
||||
std::thread thread(
|
||||
|
||||
Reference in New Issue
Block a user