/* Output looks similar to tcpdump -p arp ;-) */ #include #include #include using namespace usipp; char *print_mac(unsigned char *mac) { static char m[100]; // uhhh.... :) memset(m, 0, sizeof(m)); snprintf(m, sizeof(m), "%02x:%02x:%02x:%02x:%02x:%02x", *mac, mac[1], mac[2], mac[3], mac[4], mac[5]); return m; } int main() { ARP *a = new ARP; a->init_device("eth0", 1, 100); char shw[100], sip[100], dip[100]; while (1) { a->sniffpack(); if (a->get_op() == ARPOP_REQUEST) { cout<<"arp who has "<get_tpa(0, dip, 100) <<" tell "<get_spa(1, sip, 100)<get_op() == ARPOP_REPLY) { cout<get_spa(0, sip, 100)<<" is at " <get_sha(shw, 100))<