1
/*** Simple ICMP-monitor. GPL.
6
#include <usi++/usi++.h>
8
int main(int argc, char **argv)
10
ICMP icmp("127.0.0.1");
11
char buf[1000] = {0}, src[1000], dst[1000];
15
cout<<argv[0]<<" [intf]\n";
18
icmp.init_device(argv[1], 1, 500);
20
// icmp.setfilter("icmp");
21
char smac[100], dmac[100];
25
cout<<icmp.sniffpack(buf, 1000)<<endl;
27
cout<<"["<<icmp.get_hwsrc(smac, 100)<<"->"<<icmp.get_hwdst(dmac, 100)<<"]:";
29
cout<<"type:"<<(int)icmp.get_type()<<" ["<<icmp.get_src(1, src, 1000)<<" -> "
30
<<icmp.get_dst(1, dst, 1000)<<"] "<<"seq: "<<icmp.get_seq()
31
<<" ttl: "<<(int)icmp.get_ttl()<<" id: "<<icmp.get_icmpId()<<endl;