//------------------------------------------------------------------- // arpwatch.cpp // // This program executes the 'arp' command once per second to // produce an up-to-date display of this station's ARP Cache. // (A user may terminate this program by typing -C.) // // compile using: $ g++ arpwatch.cpp -o arpwatch // execute using: $ ./arpwatch // // programmer: ALLAN CRUSE // written on: 30 JAN 2009 //------------------------------------------------------------------- #include // for printf() #include // for system() #include // for sleep() char legend[] = "Current contents of the ARP cache"; int main( int argc, char **argv ) { do { printf( "\e[H\e[J" ); printf( "\e[1;1H\n" ); printf( "%55s\n\n", legend ); system( "/sbin/arp" ); printf( "\n" ); sleep( 1 ); } while ( 1 ); }