[Javanetsim-cvs] IceScan/icesockets crawsocket.h,1.8,1.9
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-12-15 16:25:01
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32713/icesockets Modified Files: crawsocket.h Log Message: no message Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** crawsocket.h 15 Dec 2006 15:27:57 -0000 1.8 --- crawsocket.h 15 Dec 2006 16:24:58 -0000 1.9 *************** *** 3,6 **** --- 3,7 ---- #include "csocket.h" + #include "sock_types.h" class crawsocket : csocket{ *************** *** 197,200 **** --- 198,227 ---- } + int send_icmp_packet(icestring Hostname, int Icmp_type, int Icmp_code, int Icmp_id, + int Icmp_seq, int Icmp_checksum, void* Icmp_data, int Icmp_data_len){ + + char buftosend[1500]; + + const char *hostname = Hostname.c_str(); + + bzero(buftosend, 1500); + + struct icmp *icmp = (struct icmp *) buftosend; + + icmp->icmp_type = Icmp_type; + icmp->icmp_code = Icmp_code; + icmp->icmp_id = Icmp_id; + memcpy(icmp->icmp_data, Icmp_data, Icmp_data_len); + icmp->icmp_seq = Icmp_seq; + + int len = 8 + 56; // icmp header + icmp data + + if(!Icmp_checksum) + icmp->icmp_cksum = crawsocket::in_chksum( (unsigned short * ) icmp, len); + else + icmp->icmp_cksum = Icmp_checksum; + + return sendto(hostname, buftosend, len, 0); + } // from Fyodor's "The Art of Port Scanning" |