javanetsim-cvs Mailing List for javaNetSim (Page 17)
Status: Beta
Brought to you by:
darkkey
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(120) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(1) |
Feb
(69) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(76) |
Oct
(28) |
Nov
(77) |
Dec
(186) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(36) |
Oct
(61) |
Nov
(23) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(17) |
Oct
(105) |
Nov
(5) |
Dec
(1) |
2009 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(8) |
Oct
(9) |
Nov
|
Dec
|
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" |
From: Alexander B. <da...@us...> - 2006-12-15 16:25:01
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32713 Modified Files: nbt_wrapper.h TODO icediscover.h Log Message: no message Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** icediscover.h 15 Dec 2006 15:27:57 -0000 1.11 --- icediscover.h 15 Dec 2006 16:24:58 -0000 1.12 *************** *** 31,67 **** } - void send_icmp_echo(icestring &hostname_, const iceparams *par_, iceoutput *out_, crawsocket *r_){ - crawsocket *r = r_; - const char *hostname = hostname_.c_str(); - iceoutput *out = out_; - const iceparams *par = par_; - - char buftosend[1500]; - int nsent = 1; - - - bzero(buftosend, 1500); - - struct icmp *icmp = (struct icmp *) buftosend; - - icmp->icmp_type = ICMP_ECHO; - icmp->icmp_code = 0; - icmp->icmp_id = getpid(); - gettimeofday( ( struct timeval *) icmp->icmp_data, NULL); - icmp->icmp_seq = nsent++; - - int len = 8 + 56; // icmp header + icmp data - - icmp->icmp_cksum = crawsocket::in_chksum( (unsigned short * ) icmp, len); - - if(par->verbose>0) - out->line("Sending icmp ping host discovery request (echo_request)..."); - - r->sendto(hostname, buftosend, len, 0); - - icesleep(0, 100); - - } - bool icmp_echo_ping(const char *hostname, iceparams *par, iceoutput *out){ //pthread_t send_thread; --- 31,34 ---- *************** *** 91,100 **** r.nonblock(true); ! int at = 0; while(attempts++ < 100){ ! if(at++<ECHO_ATTEMPTS){ ! send_icmp_echo(hostname_, par, out, &r); ! usleep(100000); } --- 58,75 ---- r.nonblock(true); ! int at = 1; while(attempts++ < 100){ ! if(at++<=ECHO_ATTEMPTS){ ! if(par->verbose>0) ! out->line("Sending icmp ping host discovery request (echo_request)..."); ! ! char buf[sizeof(struct timeval) + 1]; ! ! gettimeofday( ( struct timeval *) buf, NULL); ! ! r.send_icmp_packet(hostname, ICMP_ECHO, 0, getpid(), at, 0, buf, sizeof(struct timeval)); ! ! usleep(200000); } Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TODO 14 Dec 2006 16:40:25 -0000 1.9 --- TODO 15 Dec 2006 16:24:58 -0000 1.10 *************** *** 7,10 **** --- 7,11 ---- + add multiple targets handling; * fix reading port range for ack/udp/syn pings; + + add uid option -- Discovering -- *************** *** 13,16 **** --- 14,19 ---- + TCP SYN Scan (-PS [portlist]) [Key] + ICMP Address Mask Ping (-PM) [QweR] + + ARP/UDP Discovery + + ARP Discovery -- Scanning -- *************** *** 24,26 **** --- 27,31 ---- -- Misc -- + + add 'send_icmp_packet' function to crawsocket. + -- Bugs -- Index: nbt_wrapper.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbt_wrapper.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** nbt_wrapper.h 13 Dec 2006 13:22:00 -0000 1.3 --- nbt_wrapper.h 15 Dec 2006 16:24:58 -0000 1.4 *************** *** 7,11 **** /* This file contains a portions of code from Samba package, * ! /* which contains the following license: * / Unix SMB/Netbios implementation --- 7,11 ---- /* This file contains a portions of code from Samba package, * ! /* which contains the following license: * / Unix SMB/Netbios implementation |
From: Alexander B. <da...@us...> - 2006-12-15 15:48:54
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18111 Modified Files: icedbs.h csubtarget.h Log Message: no message Index: icedbs.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icedbs.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** icedbs.h 15 Dec 2006 15:27:57 -0000 1.3 --- icedbs.h 15 Dec 2006 15:48:51 -0000 1.4 *************** *** 27,37 **** in.getline(tmpbuf,256); - //DBGOUTPUT("!!!!"); - IceRegex re1("^(#.*|\\s*)$"); ! //DBGOUTPUT("&&&&&"); ! ! if(! re1.match(tmpbuf) ){ //FullMatch IceRegex re("^([-a-z1-9]+)\\s*\\W*([0-9]+)/(tcp|udp)"); --- 27,33 ---- in.getline(tmpbuf,256); IceRegex re1("^(#.*|\\s*)$"); ! if(! re1.match(tmpbuf) ){ IceRegex re("^([-a-z1-9]+)\\s*\\W*([0-9]+)/(tcp|udp)"); *************** *** 54,58 **** else udp_services[port] = sname; ! }//else DBGOUTPUT("#comment"); } } --- 50,54 ---- else udp_services[port] = sname; ! } } } *************** *** 89,99 **** in.getline(tmpbuf,256); - //DBGOUTPUT("!!!!"); - IceRegex re1("^(#.*|\\s*)$"); ! //DBGOUTPUT("&&&&&"); ! ! if(! re1.match(tmpbuf) ){ //FullMatch IceRegex re("^([A-F0-9]+)\\s*\\W*([-a-z0-9A-Z. +]+)"); --- 85,91 ---- in.getline(tmpbuf,256); IceRegex re1("^(#.*|\\s*)$"); ! if(! re1.match(tmpbuf) ){ IceRegex re("^([A-F0-9]+)\\s*\\W*([-a-z0-9A-Z. +]+)"); *************** *** 109,113 **** vendors[prefix] = company; ! }//else DBGOUTPUT("#comment"); } } --- 101,105 ---- vendors[prefix] = company; ! } } } Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** csubtarget.h 14 Dec 2006 19:45:40 -0000 1.21 --- csubtarget.h 15 Dec 2006 15:48:51 -0000 1.22 *************** *** 7,11 **** #include <vector> #include <errno.h> - #include <pthread.h> #include "iceoutput.h" #include "iceparams.h" --- 7,10 ---- |
From: Alexander B. <da...@us...> - 2006-12-15 15:28:05
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10002 Modified Files: icediscover.h icedbs.h Removed Files: icedebug.h Log Message: no message Index: icedbs.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icedbs.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** icedbs.h 14 Dec 2006 19:45:40 -0000 1.2 --- icedbs.h 15 Dec 2006 15:27:57 -0000 1.3 *************** *** 6,10 **** #include <map> #include <string> - #include "icedebug.h" class ice_service_name_database{ --- 6,9 ---- *************** *** 97,101 **** if(! re1.match(tmpbuf) ){ //FullMatch ! IceRegex re("^([A-F0-9]+)\\s*\\W*([-a-z0-9A-Z.+]+)"); icestring prefix = "", company = ""; --- 96,100 ---- if(! re1.match(tmpbuf) ){ //FullMatch ! IceRegex re("^([A-F0-9]+)\\s*\\W*([-a-z0-9A-Z. +]+)"); icestring prefix = "", company = ""; --- icedebug.h DELETED --- Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** icediscover.h 14 Dec 2006 14:15:08 -0000 1.10 --- icediscover.h 15 Dec 2006 15:27:57 -0000 1.11 *************** *** 8,12 **** #include "iceparams.h" #include "iceoutput.h" - #include "icedebug.h" #define ACK_PING_STANDART_PORT 80 --- 8,11 ---- |
From: Alexander B. <da...@us...> - 2006-12-15 15:28:04
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10002/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** configurations.xml 14 Dec 2006 19:45:40 -0000 1.10 --- configurations.xml 15 Dec 2006 15:27:57 -0000 1.11 *************** *** 28,32 **** <itemPath>ctarget.h</itemPath> <itemPath>icedbs.h</itemPath> - <itemPath>icedebug.h</itemPath> <itemPath>icediscover.h</itemPath> <itemPath>iceoutput.h</itemPath> --- 28,31 ---- *************** *** 70,76 **** <itemTool>3</itemTool> </item> - <item path="icedebug.h"> - <itemTool>3</itemTool> - </item> <item path="icescan.cc"> <itemTool>1</itemTool> --- 69,72 ---- |
From: Alexander B. <da...@us...> - 2006-12-15 15:28:04
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10002/icesockets Modified Files: crawsocket.h sock_arp.h sock_name.h iceregex.h sock_types.h sock_time.h csocket.h sock_err.h Log Message: no message Index: sock_arp.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_arp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sock_arp.h 14 Dec 2006 19:45:40 -0000 1.2 --- sock_arp.h 15 Dec 2006 15:27:57 -0000 1.3 *************** *** 11,23 **** #include "sock_types.h" - #include <stdlib.h> - #include <stdio.h> - #include <net/if_arp.h> - #include <sys/ioctl.h> - #include <netinet/in.h> - #include <arpa/inet.h> - icestring get_arp_from_cache(icestring &ip) { struct sockaddr_in sin = { 0 }; struct arpreq myarp = { { 0 } }; --- 11,19 ---- #include "sock_types.h" icestring get_arp_from_cache(icestring &ip) { + #ifdef __CYGWIN__ + return ""; + #else struct sockaddr_in sin = { 0 }; struct arpreq myarp = { { 0 } }; *************** *** 52,56 **** return ret; ! } --- 48,52 ---- return ret; ! #endif } Index: sock_types.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_types.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sock_types.h 14 Dec 2006 13:42:06 -0000 1.7 --- sock_types.h 15 Dec 2006 15:27:57 -0000 1.8 *************** *** 2,14 **** --- 2,33 ---- #define ICESOCK_SOCK_TYPES_H + #include <vector> #include <string> #include <iostream> //for std + #include <sys/types.h> + + #include <time.h> + #include <sys/timeb.h> + + #include <errno.h> + #include <sys/socket.h> #include <arpa/inet.h> + #include <net/if_arp.h> #include <netinet/in.h> #include <netinet/ip.h> #include <netdb.h> + #include <cstdio> + #include <cstdlib> + + #include <fcntl.h> + #include <sys/ioctl.h> + + #include <netinet/ip.h> + #include <netinet/ip_icmp.h> + #define __FAVOR_BSD + #include <netinet/tcp.h> #define my_uint16_t uint16_t *************** *** 16,19 **** --- 35,46 ---- #define my_uint8_t uint8_t + struct pseudo_header { + my_uint32_t s_addr; + my_uint32_t d_addr; + my_uint8_t zero; + my_uint8_t protocol; + my_uint16_t length; + }; + // Re-Defining string type; use icestring instead of string #ifdef __CYGWIN__ *************** *** 28,33 **** #include <sys/param.h> #include <sys/file.h> - #include <netdb.h> - #include <netinet/in.h> #include <netinet/in_systm.h> --- 55,58 ---- Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sock_name.h 13 Dec 2006 20:06:32 -0000 1.8 --- sock_name.h 15 Dec 2006 15:27:57 -0000 1.9 *************** *** 10,24 **** #endif - #include <stdio.h> - #include <stdlib.h> - #include <errno.h> - #include <netdb.h> - #include <sys/types.h> - #include <sys/socket.h> - #include <netinet/in.h> - #include <arpa/inet.h> - #include <iostream> - #include <vector> #include "iceregex.h" --- 10,15 ---- #endif + #include "sock_types.h" #include "iceregex.h" Index: sock_time.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_time.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sock_time.h 30 Nov 2006 06:43:50 -0000 1.2 --- sock_time.h 15 Dec 2006 15:27:57 -0000 1.3 *************** *** 2,7 **** #define ICESOCK_SOCK_TIME_H ! #include <time.h> ! #include <sys/timeb.h> void icesleep(int secs, int nsecs){ --- 2,6 ---- #define ICESOCK_SOCK_TIME_H ! #include "sock_types.h" void icesleep(int secs, int nsecs){ Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** crawsocket.h 14 Dec 2006 05:21:41 -0000 1.7 --- crawsocket.h 15 Dec 2006 15:27:57 -0000 1.8 *************** *** 4,20 **** #include "csocket.h" - #include <netinet/ip.h> - #include <netinet/ip_icmp.h> - #define __FAVOR_BSD - #include <netinet/tcp.h> - - struct pseudo_header { - my_uint32_t s_addr; - my_uint32_t d_addr; - my_uint8_t zero; - my_uint8_t protocol; - my_uint16_t length; - }; - class crawsocket : csocket{ protected: --- 4,7 ---- Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** csocket.h 14 Dec 2006 19:23:32 -0000 1.11 --- csocket.h 15 Dec 2006 15:27:57 -0000 1.12 *************** *** 2,14 **** #define CSOCKET_H - #include <iostream> - - #include <cstdio> - #include <cstdlib> - #include <fcntl.h> - // Library - #include "sock_err.h" #include "sock_types.h" #include "sock_name.h" #include "sock_time.h" --- 2,8 ---- #define CSOCKET_H // Library #include "sock_types.h" + #include "sock_err.h" #include "sock_name.h" #include "sock_time.h" Index: sock_err.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_err.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_err.h 28 Nov 2006 17:57:54 -0000 1.1 --- sock_err.h 15 Dec 2006 15:27:57 -0000 1.2 *************** *** 2,6 **** #define ICESOCK_ERR_H ! #include <errno.h> #define ICESOCK_TIMEOUT 10 // timeout in when connecting or recieving --- 2,6 ---- #define ICESOCK_ERR_H ! #include "sock_types.h" #define ICESOCK_TIMEOUT 10 // timeout in when connecting or recieving *************** *** 14,16 **** --- 14,18 ---- #define err_print(error, quiet) if(!quiet) perror(error); + #define DBGOUTPUT(TEXT) std::cout << __FILE__ << " " << __LINE__ << ": " << TEXT << std::endl + #endif Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** iceregex.h 13 Dec 2006 22:40:30 -0000 1.8 --- iceregex.h 15 Dec 2006 15:27:57 -0000 1.9 *************** *** 9,19 **** #define _ICEREGEX_H - #include <string> - #include <vector> - #include <pcre.h> #include "sock_types.h" - #include "../icedebug.h" class IceRegex { --- 9,15 ---- |
From: Alexander B. <da...@us...> - 2006-12-14 19:45:48
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9431/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** configurations.xml 14 Dec 2006 19:23:32 -0000 1.9 --- configurations.xml 14 Dec 2006 19:45:40 -0000 1.10 *************** *** 20,24 **** --- 20,26 ---- <itemPath>CHANGELOG</itemPath> <itemPath>COPYING</itemPath> + <itemPath>ieee-oui.txt</itemPath> <itemPath>Makefile</itemPath> + <itemPath>services</itemPath> <itemPath>TODO</itemPath> </logicalFolder> |
From: Alexander B. <da...@us...> - 2006-12-14 19:45:47
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9431 Modified Files: iceparams.h icedbs.h icescan.cc ctarget.h csubtarget.h Added Files: ieee-oui.txt Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** icescan.cc 14 Dec 2006 19:23:32 -0000 1.19 --- icescan.cc 14 Dec 2006 19:45:40 -0000 1.20 *************** *** 229,238 **** int main(int argc, char *argv[]){ iceoutput out; ! iceparams par; ! struct timeb tp1, tp2; ! ! ice_service_name_database isnd("services"); char version_string[255]; --- 229,239 ---- int main(int argc, char *argv[]){ + ice_service_name_database isnd("services"); + ice_mac_name_database ismd("ieee-oui.txt"); + iceoutput out; ! iceparams par(&isnd, &ismd); ! struct timeb tp1, tp2; char version_string[255]; *************** *** 259,263 **** } ! ctargets ts(&par, &out, &isnd); ftime(&tp1); --- 260,264 ---- } ! ctargets ts(&par, &out); ftime(&tp1); *************** *** 273,276 **** --- 274,279 ---- ftime(&tp2); + out.line(""); + out << "IceScan finished: " << ts.subtargets_count() << " IP address(es) (" << ts.up_subtargets_count() << " host(s) up) processed in " << timeb_diff(tp1, tp2) << " seconds." << iceoutput::endl; --- NEW FILE: ieee-oui.txt --- # ieee-oui.txt -- Ethernet vendor OUI file for arp-scan # # This file contains the Ethernet vendor OUIs for arp-scan. These are used # to determine the vendor for a give Ethernet interface given the MAC address. # # Each line of this file contains an OUI-vendor mapping in the form: # # <OUI><TAB><Vendor> # # Where <OUI> is the first three bytes of the MAC address in hex, and <Vendor> # is the name of the vendor. # # Blank lines and lines beginning with "#" are ignored. # # This file was automatically generated by get-oui at 2006-06-25 17:54:10 # using data from http://standards.ieee.org/regauth/oui/oui.txt # # Do not edit this file. If you want to add additional MAC-Vendor mappings, # edit the file mac-vendor.txt instead. [...9318 lines suppressed...] 08008B PYRAMID TECHNOLOGY CORP. 08008C NETWORK RESEARCH CORPORATION 08008D XYVISION INC. 08008E TANDEM COMPUTERS 08008F CHIPCOM CORPORATION 080090 SONOMA SYSTEMS 081443 UNIBRAIN S.A. 08BBCC AK-NORD EDV VERTRIEBSGES. mbH 100000 PRIVATE 10005A IBM CORPORATION 1000E8 NATIONAL SEMICONDUCTOR 1100AA PRIVATE 800010 ATT BELL LABORATORIES A06A00 Verilink Corporation AA0000 DIGITAL EQUIPMENT CORPORATION AA0001 DIGITAL EQUIPMENT CORPORATION AA0002 DIGITAL EQUIPMENT CORPORATION AA0003 DIGITAL EQUIPMENT CORPORATION AA0004 DIGITAL EQUIPMENT CORPORATION ACDE48 PRIVATE Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** csubtarget.h 14 Dec 2006 19:23:32 -0000 1.20 --- csubtarget.h 14 Dec 2006 19:45:40 -0000 1.21 *************** *** 58,63 **** icestring reversed_hostname; - ice_service_name_database *isnd; - // *****scan parameters***** bool raw; --- 58,61 ---- *************** *** 75,79 **** std::vector<scanned_port> subtarget_ports; ! csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ struct scanned_port sp; --- 73,77 ---- std::vector<scanned_port> subtarget_ports; ! csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out){ struct scanned_port sp; *************** *** 85,89 **** this->par = par; this->out = out; - this->isnd = isnd; discovered = false; init_scan_sockets(); --- 83,86 ---- *************** *** 119,123 **** if(mac != ""){ ! *out << "MAC Address: " << mac << "\n"; } #endif --- 116,131 ---- if(mac != ""){ ! char Mac[24], vmac[7]; ! ! strcpy(Mac, mac.c_str()); ! ! vmac[0] = Mac[0]; vmac[1] = Mac[1]; ! vmac[2] = Mac[3]; vmac[3] = Mac[4]; ! vmac[4] = Mac[6]; vmac[5] = Mac[7]; ! vmac[6] = '\0'; ! ! icestring Vmac(vmac); ! ! *out << "MAC Address: " << mac << " (" << par->ismd->get_vendor(vmac) << ")" << "\n"; } #endif *************** *** 721,739 **** bzero(output_buf, 255); if(subtarget_ports[j].status == PORT_OPEN){ ! sprintf(output_buf, "%5d/tcp open %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_OPEN_FILTERED){ ! sprintf(output_buf, "%5d/tcp o|f %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_UNFILTERED){ ! sprintf(output_buf, "%5d/tcp unfilt %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_CLOSED && show_closed){ ! sprintf(output_buf, "%5d/tcp closed %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); } } - out->line(""); } --- 729,746 ---- bzero(output_buf, 255); if(subtarget_ports[j].status == PORT_OPEN){ ! sprintf(output_buf, "%5d/tcp open %s", subtarget_ports[j].port_number, par->isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_OPEN_FILTERED){ ! sprintf(output_buf, "%5d/tcp o|f %s", subtarget_ports[j].port_number, par->isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_UNFILTERED){ ! sprintf(output_buf, "%5d/tcp unfilt %s", subtarget_ports[j].port_number, par->isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); }else if(subtarget_ports[j].status == PORT_CLOSED && show_closed){ ! sprintf(output_buf, "%5d/tcp closed %s", subtarget_ports[j].port_number, par->isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); } } } Index: icedbs.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icedbs.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** icedbs.h 14 Dec 2006 19:23:32 -0000 1.1 --- icedbs.h 14 Dec 2006 19:45:40 -0000 1.2 *************** *** 61,65 **** icestring get_tcp_service(int port){ ! if(tcp_services.find(port) != tcp_services.end()) return udp_services[port]; else return "unknown"; } --- 61,65 ---- icestring get_tcp_service(int port){ ! if(tcp_services.find(port) != tcp_services.end()) return tcp_services[port]; else return "unknown"; } *************** *** 71,73 **** --- 71,124 ---- }; + class ice_mac_name_database{ + + std::map <icestring, icestring> vendors; + + public: + + ice_mac_name_database(char *db_fname){ + std::ifstream in; + + in.open(db_fname); + + if(!in){ + std::cout << "Can't open service names database!" << std::endl; + } else { + while(!in.eof()){ + char tmpbuf[256]; + + in.getline(tmpbuf,256); + + //DBGOUTPUT("!!!!"); + + IceRegex re1("^(#.*|\\s*)$"); + + //DBGOUTPUT("&&&&&"); + + if(! re1.match(tmpbuf) ){ //FullMatch + IceRegex re("^([A-F0-9]+)\\s*\\W*([-a-z0-9A-Z.+]+)"); + + icestring prefix = "", company = ""; + + std::vector<icestring> v; + + re.match(tmpbuf, v); + + if(v.size()<3) continue; + + prefix = v[1]; company = v[2]; + + vendors[prefix] = company; + }//else DBGOUTPUT("#comment"); + } + } + } + + icestring get_vendor(icestring mac){ + if(vendors.find(mac) != vendors.end()) return vendors[mac]; + else return "Unknown vendor"; + } + + }; + #endif Index: iceparams.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceparams.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iceparams.h 13 Dec 2006 20:06:32 -0000 1.7 --- iceparams.h 14 Dec 2006 19:45:40 -0000 1.8 *************** *** 3,6 **** --- 3,7 ---- #include <vector> + #include "icedbs.h" #define NBT_PORT 137 *************** *** 61,64 **** --- 62,70 ---- std::vector <port_range> ports; + + // Databases + + ice_service_name_database *isnd; + ice_mac_name_database *ismd; private: *************** *** 88,92 **** public: ! iceparams(){ default_init(); } --- 94,101 ---- public: ! iceparams(ice_service_name_database *isnd, ice_mac_name_database *ismd){ ! this->isnd = isnd; ! this->ismd = ismd; ! default_init(); } Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ctarget.h 14 Dec 2006 19:23:32 -0000 1.9 --- ctarget.h 14 Dec 2006 19:45:40 -0000 1.10 *************** *** 10,15 **** iceparams *par; - ice_service_name_database *isnd; - std::vector <csubtarget *> subtargets; //subtargets (e.g. aliases for domain name, multiple ips per hostname, e.t.c.) std::vector <icestring> subtargets_addresses; //subtarget ips as string --- 10,13 ---- *************** *** 17,22 **** public: ! ctargets(iceparams *par, iceoutput *out, ice_service_name_database *isnd){ ! this->isnd = isnd; this->par = par; this->out = out; --- 15,19 ---- public: ! ctargets(iceparams *par, iceoutput *out){ this->par = par; this->out = out; *************** *** 49,53 **** for(int i=0; i<st; i++){ ! csubtarget *cst = new csubtarget(subtargets_addresses[i].c_str(), rev_hostname.c_str(), par, out, isnd); subtargets.push_back(cst); } --- 46,50 ---- for(int i=0; i<st; i++){ ! csubtarget *cst = new csubtarget(subtargets_addresses[i].c_str(), rev_hostname.c_str(), par, out); subtargets.push_back(cst); } |
From: Alexander B. <da...@us...> - 2006-12-14 19:45:44
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9431/icesockets Modified Files: sock_arp.h Log Message: no message Index: sock_arp.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_arp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_arp.h 14 Dec 2006 19:23:32 -0000 1.1 --- sock_arp.h 14 Dec 2006 19:45:40 -0000 1.2 *************** *** 42,46 **** } ! sprintf(arp, "%02X:%02X:%02X:%02X:%02X:%02X\n", myarp.arp_ha.sa_data[0] & 0xFF, myarp.arp_ha.sa_data[1] & 0xFF, myarp.arp_ha.sa_data[2] & 0xFF, --- 42,46 ---- } ! sprintf(arp, "%02X:%02X:%02X:%02X:%02X:%02X", myarp.arp_ha.sa_data[0] & 0xFF, myarp.arp_ha.sa_data[1] & 0xFF, myarp.arp_ha.sa_data[2] & 0xFF, |
From: Alexander B. <da...@us...> - 2006-12-14 19:23:35
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1118/icesockets Modified Files: csocket.h ice_rand.h Added Files: sock_arp.h Log Message: no message Index: ice_rand.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/ice_rand.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ice_rand.h 13 Dec 2006 12:59:06 -0000 1.1 --- ice_rand.h 14 Dec 2006 19:23:32 -0000 1.2 *************** *** 15,22 **** #endif ! #if HAVE_OPENSSL ! #include <openssl/rand.h> ! #endif ! int get_random_bytes(void *buf, int numbytes) { static char bytebuf[2048]; --- 15,19 ---- #endif ! // from Fyodor's "The Art of Port Scanning" int get_random_bytes(void *buf, int numbytes) { static char bytebuf[2048]; --- NEW FILE: sock_arp.h --- (This appears to be a binary file; contents omitted.) Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** csocket.h 14 Dec 2006 13:42:06 -0000 1.10 --- csocket.h 14 Dec 2006 19:23:32 -0000 1.11 *************** *** 13,16 **** --- 13,17 ---- #include "sock_name.h" #include "sock_time.h" + #include "sock_arp.h" class csocket{ |
From: Alexander B. <da...@us...> - 2006-12-14 19:23:35
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1118 Modified Files: icescan.cc ctarget.h csubtarget.h Added Files: icedbs.h Removed Files: iceservice.h Log Message: no message --- NEW FILE: icedbs.h --- #ifndef ICEDBS_H #define ICEDBS_H #include <iostream> #include <fstream> #include <map> #include <string> #include "icedebug.h" class ice_service_name_database{ std::map <int, icestring> tcp_services; std::map <int, icestring> udp_services; public: ice_service_name_database(char *db_fname){ std::ifstream in; in.open(db_fname); if(!in){ std::cout << "Can't open service names database!" << std::endl; } else { while(!in.eof()){ char tmpbuf[256]; in.getline(tmpbuf,256); //DBGOUTPUT("!!!!"); IceRegex re1("^(#.*|\\s*)$"); //DBGOUTPUT("&&&&&"); if(! re1.match(tmpbuf) ){ //FullMatch IceRegex re("^([-a-z1-9]+)\\s*\\W*([0-9]+)/(tcp|udp)"); icestring sname = "", protocol = "", sport = ""; int port; std::vector<icestring> v; re.match(tmpbuf, v); if(v.size()<4) continue; sname = v[1]; protocol = v[3]; sport = v[2]; port = atoi(sport.c_str()); if(protocol == "tcp") tcp_services[port] = sname; else udp_services[port] = sname; }//else DBGOUTPUT("#comment"); } } } icestring get_tcp_service(int port){ if(tcp_services.find(port) != tcp_services.end()) return udp_services[port]; else return "unknown"; } icestring get_udp_service(int port){ } }; #endif Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** icescan.cc 14 Dec 2006 16:40:25 -0000 1.18 --- icescan.cc 14 Dec 2006 19:23:32 -0000 1.19 *************** *** 4,8 **** #include "iceversion.h" #include "iceoutput.h" ! #include "iceservice.h" #include "ctarget.h" --- 4,8 ---- #include "iceversion.h" #include "iceoutput.h" ! #include "icedbs.h" #include "ctarget.h" *************** *** 26,29 **** --- 26,30 ---- "\t-SA: ACK scan\n" "\t-SS: SYN scan\n" + "\t-S0: skip scan\n" "PORTS SPECIFICATION:\n" "\t-p <port range>: specify port range to scan (default 1-1024).\n" *************** *** 101,104 **** --- 102,109 ---- break; + case '0': + par->scan_type = NO_SCAN; + break; + case 'X': par->scan_type = XMAS_SCAN; --- iceservice.h DELETED --- Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** csubtarget.h 14 Dec 2006 14:15:08 -0000 1.19 --- csubtarget.h 14 Dec 2006 19:23:32 -0000 1.20 *************** *** 114,117 **** --- 114,127 ---- } + void mac_discover(){ + #ifndef __CYGWIN__ + icestring mac = get_arp_from_cache(hostname); + + if(mac != ""){ + *out << "MAC Address: " << mac << "\n"; + } + #endif + } + int prot_scan(){ Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ctarget.h 14 Dec 2006 13:42:07 -0000 1.8 --- ctarget.h 14 Dec 2006 19:23:32 -0000 1.9 *************** *** 73,76 **** --- 73,77 ---- if(subtargets[i]->discovered){ subtargets[i]->scan(); + subtargets[i]->mac_discover(); } } |
From: Alexander B. <da...@us...> - 2006-12-14 19:23:35
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1118/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** configurations.xml 13 Dec 2006 12:59:06 -0000 1.8 --- configurations.xml 14 Dec 2006 19:23:32 -0000 1.9 *************** *** 8,11 **** --- 8,12 ---- <itemPath>icesockets/ice_rand.h</itemPath> <itemPath>icesockets/iceregex.h</itemPath> + <itemPath>icesockets/sock_arp.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> <itemPath>icesockets/sock_name.h</itemPath> *************** *** 24,27 **** --- 25,29 ---- <itemPath>csubtarget.h</itemPath> <itemPath>ctarget.h</itemPath> + <itemPath>icedbs.h</itemPath> <itemPath>icedebug.h</itemPath> <itemPath>icediscover.h</itemPath> *************** *** 30,34 **** <itemPath>iceprotocol.h</itemPath> <itemPath>icescan.cc</itemPath> - <itemPath>iceservice.h</itemPath> <itemPath>iceversion.h</itemPath> <itemPath>nbt_wrapper.h</itemPath> --- 32,35 ---- *************** *** 78,84 **** <itemTool>3</itemTool> </item> - <item path="iceservice.h"> - <itemTool>3</itemTool> - </item> <item path="icesockets/sock_err.h"> <itemTool>3</itemTool> --- 79,82 ---- *************** *** 117,120 **** --- 115,124 ---- <itemTool>3</itemTool> </item> + <item path="icesockets/sock_arp.h"> + <itemTool>3</itemTool> + </item> + <item path="icedbs.h"> + <itemTool>3</itemTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-12-14 16:40:33
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30877 Modified Files: iceversion.h icescan.cc TODO Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** icescan.cc 14 Dec 2006 13:42:07 -0000 1.17 --- icescan.cc 14 Dec 2006 16:40:25 -0000 1.18 *************** *** 26,30 **** "\t-SA: ACK scan\n" "\t-SS: SYN scan\n" ! "PORTS SPECIFICATION:\n" "\t-p <port range>: specify port range to scan (default 1-1024).\n" "\t You can use: 1-10; 1; 1-10,12-14; etc.\n" --- 26,30 ---- "\t-SA: ACK scan\n" "\t-SS: SYN scan\n" ! "PORTS SPECIFICATION:\n" "\t-p <port range>: specify port range to scan (default 1-1024).\n" "\t You can use: 1-10; 1; 1-10,12-14; etc.\n" Index: iceversion.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceversion.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iceversion.h 29 Nov 2006 12:51:01 -0000 1.2 --- iceversion.h 14 Dec 2006 16:40:25 -0000 1.3 *************** *** 3,9 **** #define ICENAME "IceScan" ! #define ICEVERSION "0.0.2" #define ICEWEBSITE "http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/" // (...) ! #define ICEDATE "28 November 2006" #endif --- 3,9 ---- #define ICENAME "IceScan" ! #define ICEVERSION "0.0.5" #define ICEWEBSITE "http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/" // (...) ! #define ICEDATE "14 December 2006" #endif Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TODO 13 Dec 2006 20:23:10 -0000 1.8 --- TODO 14 Dec 2006 16:40:25 -0000 1.9 *************** *** 7,24 **** + add multiple targets handling; * fix reading port range for ack/udp/syn pings; - * fix reading port range for scans -- Discovering -- + UDP Ping (-PU [portlist]) [QweR] ! + TCP SYN Scan (-SP [portlist]) [Key] -- Scanning -- + UDP Scan (-SU) [QweR] - + ICMP Address Mask Ping (-PM) [QweR] + IP Protocol Scan (-SI) [Key] (??) - * merge many raw scan functions into 1. * do setting random window/seq(ack and seg) for raw scanning -- Misc -- --- 7,24 ---- + add multiple targets handling; * fix reading port range for ack/udp/syn pings; -- Discovering -- + UDP Ping (-PU [portlist]) [QweR] ! + TCP SYN Scan (-PS [portlist]) [Key] ! + ICMP Address Mask Ping (-PM) [QweR] -- Scanning -- + UDP Scan (-SU) [QweR] + IP Protocol Scan (-SI) [Key] (??) * do setting random window/seq(ack and seg) for raw scanning + + ARP Scan + Fingerprint (??) + + --tcpflags NUMBER || FLAGS -- set specific tcp flags when raw tcp scan + iceparams::check_right_params() -- Misc -- |
From: Alexander B. <da...@us...> - 2006-12-14 14:15:14
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6510 Modified Files: icediscover.h csubtarget.h Log Message: no message Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** csubtarget.h 14 Dec 2006 13:42:07 -0000 1.18 --- csubtarget.h 14 Dec 2006 14:15:08 -0000 1.19 *************** *** 106,115 **** if(par->scan_type == NBT_SCAN) nbt_scan(); if(par->scan_type == PROT_SCAN) prot_scan(); ! if(par->scan_type == FIN_SCAN) fin_scan(); ! if(par->scan_type == NULL_SCAN) null_scan(); ! if(par->scan_type == XMAS_SCAN) xmas_scan(); ! if(par->scan_type == WINDOW_SCAN) window_scan(); ! if(par->scan_type == ACK_SCAN) ack_scan(); ! if(par->scan_type == SYN_SCAN) syn_scan(); } --- 106,115 ---- if(par->scan_type == NBT_SCAN) nbt_scan(); if(par->scan_type == PROT_SCAN) prot_scan(); ! if(par->scan_type == FIN_SCAN) raw_tcp_scan("FIN"); ! if(par->scan_type == NULL_SCAN) raw_tcp_scan("NULL"); ! if(par->scan_type == XMAS_SCAN) raw_tcp_scan("XMAS"); ! if(par->scan_type == WINDOW_SCAN) raw_tcp_scan("window"); ! if(par->scan_type == ACK_SCAN) raw_tcp_scan("ACK"); ! if(par->scan_type == SYN_SCAN) raw_tcp_scan("SYN"); } *************** *** 142,146 **** } ! void raw_tcp_scan(){ std::map <int, scanning_port> scanning_ports; struct sockaddr_in saddress; --- 142,146 ---- } ! void raw_tcp_scan(icestring scan_type){ std::map <int, scanning_port> scanning_ports; struct sockaddr_in saddress; *************** *** 149,154 **** char local_hostname[80]; ! //add UID 0 check ! //^^^^^^^^^^^^ UGLY raw = true; --- 149,161 ---- char local_hostname[80]; ! if(par->verbose > 0) ! *out << "Starting TCP " << scan_type << " scan against " << hostname.c_str() << "...\n"; ! ! #ifndef __CYGWIN__ ! if(getuid()){ ! out->line("UID isn't 0, so can't create raw socket => no RAW tcp scan..."); ! return; ! } ! #endif raw = true; *************** *** 301,377 **** scanning_ports.clear(); ! } ! ! int fin_scan(){ ! // -SF ! if(par->verbose > 0) ! *out << "Starting TCP FIN scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP FIN scan finished."); ! } ! ! int null_scan(){ ! // -SN ! if(par->verbose > 0) ! *out << "Starting TCP NULL scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP NULL scan finished."); ! } ! ! int ack_scan(){ ! // -SN ! if(par->verbose > 0) ! *out << "Starting TCP ACK scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP ACK scan finished."); ! } ! ! int xmas_scan(){ ! // -SX ! if(par->verbose > 0) ! *out << "Starting TCP XMAS scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP XMAS scan finished."); ! } ! ! int window_scan(){ ! // -SW ! if(par->verbose > 0) ! *out << "Starting TCP Window scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); if(par->verbose>0) ! out->line("TCP Window scan finished."); } ! int syn_scan(){ ! // -SS ! if(par->verbose > 0) ! *out << "Starting TCP SYN scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP SYN scan finished."); ! } int connect_scan(){ --- 308,319 ---- scanning_ports.clear(); ! ! show_ports(); if(par->verbose>0) ! *out << "TCP " << scan_type << "scan finished.\n"; } ! int connect_scan(){ Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** icediscover.h 14 Dec 2006 13:42:07 -0000 1.9 --- icediscover.h 14 Dec 2006 14:15:08 -0000 1.10 *************** *** 132,137 **** free(t_hostname); ! }else if(par->verbose>0) ! out->line("UID isn't 0, so can't create raw socket => no ICMP ping..."); return false; --- 132,136 ---- free(t_hostname); ! }else out->line("UID isn't 0, so can't create raw socket => no ICMP ping..."); return false; |
From: Alexander B. <da...@us...> - 2006-12-14 13:42:14
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25064 Modified Files: icescan.cc ctarget.h icediscover.h iceservice.h csubtarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** icescan.cc 13 Dec 2006 22:40:30 -0000 1.16 --- icescan.cc 14 Dec 2006 13:42:07 -0000 1.17 *************** *** 1,2 **** --- 1,3 ---- + #include <string> #include "icesockets/csocket.h" #include "iceparams.h" *************** *** 162,166 **** IceRegex re("(\\d+(-\\d+)?),?"); ! icestring var="", var2 = ""; re.match(argv[i+1]); --- 163,167 ---- IceRegex re("(\\d+(-\\d+)?),?"); ! icestring var = "", var2 = ""; re.match(argv[i+1]); *************** *** 168,176 **** //re.Consume(&input, &var, &var2) while(re.findNext()){ ! // DBGOUTPUT(v.size()); ! // DBGOUTPUT(v[0]); re.group(1,var); if(re.groups() > 2) re.group(2,var2); struct port_range pr; if(var2 == ""){ sscanf(var.c_str(), "%d", &pr.lower_port); --- 169,177 ---- //re.Consume(&input, &var, &var2) while(re.findNext()){ ! var2 = ""; var = ""; re.group(1,var); if(re.groups() > 2) re.group(2,var2); struct port_range pr; + if(var2 == ""){ sscanf(var.c_str(), "%d", &pr.lower_port); Index: iceservice.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceservice.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iceservice.h 13 Dec 2006 09:08:33 -0000 1.4 --- iceservice.h 14 Dec 2006 13:42:07 -0000 1.5 *************** *** 2,9 **** #define ICESERVICE_H - #include <pcrecpp.h> #include <iostream> #include <fstream> #include <map> #include "icedebug.h" --- 2,9 ---- #define ICESERVICE_H #include <iostream> #include <fstream> #include <map> + #include <string> #include "icedebug.h" *************** *** 30,34 **** //DBGOUTPUT("!!!!"); - //pcrecpp::RE re1("^(#.*|\\s*)$"); IceRegex re1("^(#.*|\\s*)$"); --- 30,33 ---- *************** *** 36,40 **** if(! re1.match(tmpbuf) ){ //FullMatch - //pcrecpp::RE re("^([-a-z1-9]+)\\s*\\W*([0-9]+)/(tcp|udp)"); IceRegex re("^([-a-z1-9]+)\\s*\\W*([0-9]+)/(tcp|udp)"); --- 35,38 ---- *************** *** 43,49 **** int port; - //pcrecpp::StringPiece input(tmpbuf); - //re.Consume(&input, &sname, &port, &protocol); - std::vector<icestring> v; --- 41,44 ---- *************** *** 65,74 **** } ! string get_tcp_service(int port){ if(tcp_services.find(port) != tcp_services.end()) return udp_services[port]; else return "unknown"; } ! string get_udp_service(int port){ } --- 60,69 ---- } ! icestring get_tcp_service(int port){ if(tcp_services.find(port) != tcp_services.end()) return udp_services[port]; else return "unknown"; } ! icestring get_udp_service(int port){ } Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** csubtarget.h 14 Dec 2006 05:21:42 -0000 1.17 --- csubtarget.h 14 Dec 2006 13:42:07 -0000 1.18 *************** *** 14,18 **** #include "iceprotocol.h" ! #define CONNECT_TIMEOUT 7 #ifdef __CYGWIN__ --- 14,18 ---- #include "iceprotocol.h" ! #define CONNECT_TIMEOUT 14 #ifdef __CYGWIN__ *************** *** 228,262 **** if ((tcp->th_flags & TH_RST) && (par->scan_type == FIN_SCAN || par->scan_type == NULL_SCAN || par->scan_type == XMAS_SCAN)) { int closed_port = ntohs(tcp->th_sport); ! ! set_port_status(closed_port, PORT_CLOSED); ! ! if(scanning_ports.find(closed_port) != scanning_ports.end()) ! scanning_ports[closed_port].done = true; }else if ((tcp->th_flags & TH_RST) && (par->scan_type == WINDOW_SCAN)) { int port = ntohs(tcp->th_sport); ! ! if(tcp->th_win == 0){ ! set_port_status(port, PORT_CLOSED); ! }else{ ! set_port_status(port, PORT_OPEN); ! } ! ! if(scanning_ports.find(port) != scanning_ports.end()) scanning_ports[port].done = true; }else if ((tcp->th_flags & TH_RST) && (par->scan_type == ACK_SCAN)) { int port = ntohs(tcp->th_sport); ! set_port_status(port, PORT_UNFILTERED); ! ! if(scanning_ports.find(port) != scanning_ports.end()) scanning_ports[port].done = true; }else if ((tcp->th_flags & TH_RST) && (par->scan_type == SYN_SCAN)) { int port = ntohs(tcp->th_sport); if(port != MAGIC_PORT){ ! set_port_status(port, PORT_CLOSED); ! ! if(scanning_ports.find(port) != scanning_ports.end()) scanning_ports[port].done = true; } }else if ((tcp->th_flags & (TH_ACK|TH_SYN)) && (par->scan_type == SYN_SCAN)) { --- 228,272 ---- if ((tcp->th_flags & TH_RST) && (par->scan_type == FIN_SCAN || par->scan_type == NULL_SCAN || par->scan_type == XMAS_SCAN)) { int closed_port = ntohs(tcp->th_sport); ! ! if(scanning_ports.find(closed_port) != scanning_ports.end()){ ! if(!scanning_ports[closed_port].done){ ! set_port_status(closed_port, PORT_CLOSED); ! scanning_ports[closed_port].done = true; ! } ! } }else if ((tcp->th_flags & TH_RST) && (par->scan_type == WINDOW_SCAN)) { int port = ntohs(tcp->th_sport); ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ scanning_ports[port].done = true; + if(tcp->th_win == 0){ + set_port_status(port, PORT_CLOSED); + }else{ + set_port_status(port, PORT_OPEN); + } + } + } }else if ((tcp->th_flags & TH_RST) && (par->scan_type == ACK_SCAN)) { int port = ntohs(tcp->th_sport); ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! set_port_status(port, PORT_UNFILTERED); scanning_ports[port].done = true; + } + } }else if ((tcp->th_flags & TH_RST) && (par->scan_type == SYN_SCAN)) { int port = ntohs(tcp->th_sport); if(port != MAGIC_PORT){ ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ scanning_ports[port].done = true; + set_port_status(port, PORT_CLOSED); + } + } } }else if ((tcp->th_flags & (TH_ACK|TH_SYN)) && (par->scan_type == SYN_SCAN)) { *************** *** 264,273 **** if(port != MAGIC_PORT){ ! set_port_status(port, PORT_OPEN); ! ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, port, 0, 0, TH_RST, 0, 0, 0); ! ! if(scanning_ports.find(port) != scanning_ports.end()) scanning_ports[port].done = true; } } --- 274,285 ---- if(port != MAGIC_PORT){ ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! set_port_status(port, PORT_OPEN); ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, port, 0, 0, TH_RST, 0, 0, 0); scanning_ports[port].done = true; + } + } } } *************** *** 440,444 **** for(int j = 0; j<par->ports.size(); j++){ port_range pr = par->ports[j]; ! for(int i = pr.lower_port; i <= pr.upper_port; i++){ if(scanning_ports.find(i) == scanning_ports.end()){ --- 452,456 ---- for(int j = 0; j<par->ports.size(); j++){ port_range pr = par->ports[j]; ! for(int i = pr.lower_port; i <= pr.upper_port; i++){ if(scanning_ports.find(i) == scanning_ports.end()){ Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** icediscover.h 14 Dec 2006 05:21:42 -0000 1.8 --- icediscover.h 14 Dec 2006 13:42:07 -0000 1.9 *************** *** 2,6 **** #define ICEDISCOVER_H - #include <pthread.h> #include <signal.h> #include <sys/time.h> --- 2,5 ---- *************** *** 14,24 **** #define ECHO_ATTEMPTS 5 - struct discover_thread_params{ - char *hostname; - const iceparams *par; - iceoutput *out; - crawsocket *r; - }; - bool tcp_ack_ping(const char *hostname, iceparams *par, iceoutput *out){ --- 13,16 ---- *************** *** 40,88 **** } ! void *send_icmp_echo(void *arg){ ! struct discover_thread_params *dtp = (struct discover_thread_params *) arg; ! ! crawsocket *r = dtp->r; ! char *hostname = dtp->hostname; ! iceoutput *out = dtp->out; ! const iceparams *par = dtp->par; char buftosend[1500]; int nsent = 1; - for(int i=0; i<ECHO_ATTEMPTS; i++){ - bzero(buftosend, 1500); - - struct icmp *icmp = (struct icmp *) buftosend; - - icmp->icmp_type = ICMP_ECHO; - icmp->icmp_code = 0; - icmp->icmp_id = getpid(); - gettimeofday( ( struct timeval *) icmp->icmp_data, NULL); - icmp->icmp_seq = nsent++; - - int len = 8 + 56; // icmp header + icmp data - - icmp->icmp_cksum = crawsocket::in_chksum( (unsigned short * ) icmp, len); - - if(par->verbose>0) - out->line("Sending icmp ping host discovery request (echo_request)..."); - - r->sendto(hostname, buftosend, len, 0); - - icesleep(0, 100); - } ! pthread_exit(NULL); } bool icmp_echo_ping(const char *hostname, iceparams *par, iceoutput *out){ ! #ifndef __CYGWIN__ ! if(!getuid()){ #else ! if(1){ #endif //we're root, so can work with raw sockets char *t_hostname = (char *) malloc(strlen(hostname) + 1); --- 32,78 ---- } ! void send_icmp_echo(icestring &hostname_, const iceparams *par_, iceoutput *out_, crawsocket *r_){ ! crawsocket *r = r_; ! const char *hostname = hostname_.c_str(); ! iceoutput *out = out_; ! const iceparams *par = par_; char buftosend[1500]; int nsent = 1; ! bzero(buftosend, 1500); ! ! struct icmp *icmp = (struct icmp *) buftosend; ! ! icmp->icmp_type = ICMP_ECHO; ! icmp->icmp_code = 0; ! icmp->icmp_id = getpid(); ! gettimeofday( ( struct timeval *) icmp->icmp_data, NULL); ! icmp->icmp_seq = nsent++; ! ! int len = 8 + 56; // icmp header + icmp data ! ! icmp->icmp_cksum = crawsocket::in_chksum( (unsigned short * ) icmp, len); ! ! if(par->verbose>0) ! out->line("Sending icmp ping host discovery request (echo_request)..."); ! ! r->sendto(hostname, buftosend, len, 0); ! ! icesleep(0, 100); ! } bool icmp_echo_ping(const char *hostname, iceparams *par, iceoutput *out){ ! //pthread_t send_thread; ! #ifndef __CYGWIN__ ! if(!getuid()){ #else ! if(1){ #endif //we're root, so can work with raw sockets + icestring hostname_(hostname); char *t_hostname = (char *) malloc(strlen(hostname) + 1); *************** *** 99,148 **** r.setsockopt(SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); - - struct discover_thread_params dtp; - - dtp.hostname = t_hostname; - dtp.par = par; - dtp.out = out; - dtp.r = &r; - - pthread_t send_thread; - - r.nonblock(true); - - pthread_create(&send_thread, NULL, send_icmp_echo, (void *) &dtp); ! pthread_join(send_thread, NULL); ! ! return true; ! while(attempts++ < ECHO_ATTEMPTS){ ! char hostname[1024]; char buf[1500]; //1500 == standart IP Packet size int len = recvfrom(r.get_socketid(), buf, sizeof(buf), 0, NULL, NULL); ! struct ip *ip = (struct ip *) buf; ! int hdrlen = ip->ip_hl << 2; ! ! struct icmp *icmp = (struct icmp *) (buf + hdrlen); ! ! int icmplen = len - hdrlen; ! ! if(icmp -> icmp_type == ICMP_ECHOREPLY && icmp->icmp_id == getpid() && icmplen > 16){ ! if(par->verbose>0) ! out->line("Recieved icmp ping host discovery reply (echo_reply)..."); ! pthread_join(send_thread, NULL); ! free(t_hostname); ! r.shutdown(); ! r.close(); ! return true; ! } } - pthread_join(send_thread, NULL); //--- is it needed here? - r.shutdown(); r.close(); --- 89,130 ---- r.setsockopt(SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); ! r.nonblock(true); ! ! int at = 0; ! while(attempts++ < 100){ ! if(at++<ECHO_ATTEMPTS){ ! send_icmp_echo(hostname_, par, out, &r); ! usleep(100000); ! } ! ! char hostname[1024]; char buf[1500]; //1500 == standart IP Packet size int len = recvfrom(r.get_socketid(), buf, sizeof(buf), 0, NULL, NULL); + if(len > 0){ ! struct ip *ip = (struct ip *) buf; ! int hdrlen = ip->ip_hl << 2; ! ! struct icmp *icmp = (struct icmp *) (buf + hdrlen); ! ! int icmplen = len - hdrlen; ! ! if(icmp -> icmp_type == ICMP_ECHOREPLY && icmp->icmp_id == getpid() && icmplen > 16){ ! if(par->verbose>0) ! out->line("Recieved icmp ping host discovery reply (echo_reply)..."); ! free(t_hostname); ! r.shutdown(); ! r.close(); ! return true; ! } ! ! }else usleep(50000); } r.shutdown(); r.close(); Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ctarget.h 13 Dec 2006 09:08:33 -0000 1.7 --- ctarget.h 14 Dec 2006 13:42:07 -0000 1.8 *************** *** 41,45 **** if((!is_domainname(hostname)) && par->reverse_dns){ ! get_host_byip(hostname, rev_hostname); }else{ rev_hostname.assign(hostname); --- 41,47 ---- if((!is_domainname(hostname)) && par->reverse_dns){ ! get_host_byip(hostname, rev_hostname); ! ! if(rev_hostname == "") rev_hostname.assign(hostname); }else{ rev_hostname.assign(hostname); |
From: Alexander B. <da...@us...> - 2006-12-14 13:42:10
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25064/icesockets Modified Files: csocket.h sock_types.h Log Message: no message Index: sock_types.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_types.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sock_types.h 13 Dec 2006 14:56:10 -0000 1.6 --- sock_types.h 14 Dec 2006 13:42:06 -0000 1.7 *************** *** 2,5 **** --- 2,6 ---- #define ICESOCK_SOCK_TYPES_H + #include <string> #include <iostream> //for std #include <sys/types.h> Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** csocket.h 14 Dec 2006 05:21:41 -0000 1.9 --- csocket.h 14 Dec 2006 13:42:06 -0000 1.10 *************** *** 213,217 **** // hints.ai_socktype = type; - std::cout << "!!!!" << std::endl; // if( getaddrinfo(hostname, cport, &hints, &res) != 0 ) // return sockerror("getaddrinfo"); --- 213,216 ---- |
From: Alexander B. <da...@us...> - 2006-12-14 05:21:46
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16556/icesockets Modified Files: crawsocket.h csocket.h Log Message: no message Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** crawsocket.h 13 Dec 2006 20:06:32 -0000 1.6 --- crawsocket.h 14 Dec 2006 05:21:41 -0000 1.7 *************** *** 131,134 **** --- 131,141 ---- } + int shutdown(){ + return csocket::shutdown(); + } + + void close(){ + return csocket::close(); + } int send_tcp_raw( icestring source, icestring destination, unsigned short sport, unsigned short dport, unsigned long seq, Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** csocket.h 13 Dec 2006 14:35:02 -0000 1.8 --- csocket.h 14 Dec 2006 05:21:41 -0000 1.9 *************** *** 212,220 **** // hints.ai_family = domain; // hints.ai_socktype = type; ! // ! // std::cout << "!!!!" << std::endl; // if( getaddrinfo(hostname, cport, &hints, &res) != 0 ) // return sockerror("getaddrinfo"); ! // // return ::sendto(sid, msg, len, flags, (const sockaddr *) res->ai_addr, res->ai_addrlen); --- 212,220 ---- // hints.ai_family = domain; // hints.ai_socktype = type; ! ! std::cout << "!!!!" << std::endl; // if( getaddrinfo(hostname, cport, &hints, &res) != 0 ) // return sockerror("getaddrinfo"); ! // return ::sendto(sid, msg, len, flags, (const sockaddr *) res->ai_addr, res->ai_addrlen); |
From: Alexander B. <da...@us...> - 2006-12-14 05:21:46
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16556 Modified Files: icediscover.h csubtarget.h Log Message: no message Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** csubtarget.h 13 Dec 2006 20:06:32 -0000 1.16 --- csubtarget.h 14 Dec 2006 05:21:42 -0000 1.17 *************** *** 383,387 **** int j = initiate_connect(scanning_ports); //DBGOUTPUT(j); ! while( ! do_select_round_connect(scanning_ports, subtarget_ports) ) usleep(1000); show_ports(); --- 383,387 ---- int j = initiate_connect(scanning_ports); //DBGOUTPUT(j); ! while( ! do_select_round_connect(scanning_ports, subtarget_ports) ) usleep(1000); show_ports(); *************** *** 506,530 **** } ! int make_connect(csocket *c, icestring &hostname, int port){ ! int rc; ! ! rc = c->connect(hostname.c_str(), port, 0); ! ! switch(rc){ ! case EINPROGRESS: ! case EAGAIN: ! break; ! case ECONNREFUSED: ! DBGOUTPUT("Connection refused."); ! perror("Strange error"); ! exit(0); ! break; ! default: ! perror("Strange error"); ! exit(0); ! break; ! } ! ! return rc; } --- 506,517 ---- } ! int get_max_fd(){ ! int max = -1; ! ! for(int f = 0; f < sockets_size; f++) ! if(scan_sockets[f].sid > max) ! max = scan_sockets[f].sid; ! ! return max; } *************** *** 615,618 **** --- 602,607 ---- int res; bool done = true; + + maxfd = get_max_fd(); fd_rtmp = fd_r; fd_wtmp = fd_w; fd_xtmp = fd_x; Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** icediscover.h 13 Dec 2006 14:56:11 -0000 1.7 --- icediscover.h 14 Dec 2006 05:21:42 -0000 1.8 *************** *** 77,83 **** } ! bool icmp_echo_ping(const char *hostname, iceparams *par, iceoutput *out){ ! char *t_hostname = (char *) malloc(strlen(hostname) + 1); ! strcpy(t_hostname, hostname); #ifndef __CYGWIN__ --- 77,81 ---- } ! bool icmp_echo_ping(const char *hostname, iceparams *par, iceoutput *out){ #ifndef __CYGWIN__ *************** *** 87,90 **** --- 85,91 ---- #endif //we're root, so can work with raw sockets + + char *t_hostname = (char *) malloc(strlen(hostname) + 1); + strcpy(t_hostname, hostname); if(par->verbose>0) *************** *** 93,96 **** --- 94,98 ---- crawsocket r(AF_INET, SOCK_RAW, IPPROTO_ICMP); + int size = 60 * 1024; int attempts = 0; *************** *** 107,112 **** pthread_t send_thread; pthread_create(&send_thread, NULL, send_icmp_echo, (void *) &dtp); ! while(attempts++ < ECHO_ATTEMPTS){ char hostname[1024]; --- 109,120 ---- pthread_t send_thread; + r.nonblock(true); + pthread_create(&send_thread, NULL, send_icmp_echo, (void *) &dtp); ! ! pthread_join(send_thread, NULL); ! ! return true; ! while(attempts++ < ECHO_ATTEMPTS){ char hostname[1024]; *************** *** 114,118 **** int len = recvfrom(r.get_socketid(), buf, sizeof(buf), 0, NULL, NULL); ! struct ip *ip = (struct ip *) buf; int hdrlen = ip->ip_hl << 2; --- 122,127 ---- int len = recvfrom(r.get_socketid(), buf, sizeof(buf), 0, NULL, NULL); ! ! struct ip *ip = (struct ip *) buf; int hdrlen = ip->ip_hl << 2; *************** *** 121,141 **** int icmplen = len - hdrlen; ! if(icmp -> icmp_type == ICMP_ECHOREPLY && icmp->icmp_id == getpid() && icmplen > 16){ if(par->verbose>0) out->line("Recieved icmp ping host discovery reply (echo_reply)..."); ! free(t_hostname); return true; } } ! ! //pthread_join(send_thread, NULL); --- is it needed here? ! }else if(par->verbose>0) out->line("UID isn't 0, so can't create raw socket => no ICMP ping..."); ! ! free(t_hostname); ! return false; } --- 130,156 ---- int icmplen = len - hdrlen; ! if(icmp -> icmp_type == ICMP_ECHOREPLY && icmp->icmp_id == getpid() && icmplen > 16){ if(par->verbose>0) out->line("Recieved icmp ping host discovery reply (echo_reply)..."); ! pthread_join(send_thread, NULL); ! free(t_hostname); ! r.shutdown(); ! r.close(); return true; } } ! ! ! pthread_join(send_thread, NULL); //--- is it needed here? ! ! r.shutdown(); ! r.close(); ! ! free(t_hostname); }else if(par->verbose>0) out->line("UID isn't 0, so can't create raw socket => no ICMP ping..."); ! return false; } |
From: QweR <qw...@us...> - 2006-12-13 22:40:34
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20905/icesockets Modified Files: iceregex.h Log Message: Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iceregex.h 13 Dec 2006 13:13:30 -0000 1.7 --- iceregex.h 13 Dec 2006 22:40:30 -0000 1.8 *************** *** 15,29 **** #include "sock_types.h" class IceRegex { public: IceRegex (const icestring pattern){ ! this->pattern = pattern; init_regex(); } IceRegex (const char pattern[]){ ! icestring is(pattern); ! this->pattern = is; init_regex(); } --- 15,29 ---- #include "sock_types.h" + #include "../icedebug.h" class IceRegex { public: IceRegex (const icestring pattern){ ! this->pattern.assign(pattern); init_regex(); } IceRegex (const char pattern[]){ ! this->pattern.assign(pattern); init_regex(); } *************** *** 64,68 **** subject.assign(s); int res = find(s, v, 0); ! if(res) findPoint = ovector_[0]+1; else findPoint = 0; return res; --- 64,68 ---- subject.assign(s); int res = find(s, v, 0); ! if(res) findPoint = findPoint = ovector_[(pcre_result_-1)*2+1]; else findPoint = 0; return res; *************** *** 83,86 **** --- 83,94 ---- if(findPoint >= subject.length()) return false; int res = find(subject, v, findPoint); + if(res) findPoint = ovector_[(pcre_result_-1)*2+1]; + return res; + } + + bool findNextMin(){ + std::vector<icestring> v; + if(findPoint >= subject.length()) return false; + int res = find(subject, v, findPoint); if(res) findPoint = ovector_[0]+1; return res; *************** *** 123,129 **** bool group(int i, icestring &str){ ! char* cstr = new char[subject.length()+1]; ! int res = group(i, cstr, subject.length()); ! if(res) str.assign(cstr, subject.length()); return res; } --- 131,138 ---- bool group(int i, icestring &str){ ! char* cstr = new char[subject.length()+5]; ! int res = group(i, cstr, subject.length()+4); ! if(res) str.assign(cstr); ! delete[] cstr; return res; } *************** *** 131,134 **** --- 140,146 ---- private: bool find(icestring const& s, std::vector<icestring> &v, int start){ + + // std::cout << s << std::endl; + int rc = pcre_exec ( pcre_, /* the compiled pattern */ *************** *** 139,143 **** 0, /* default options */ ovector_, /* output vector for substring information */ ! 3*(capture_count_+1)); /* number of elements in the output vector */ pcre_result_ = rc; --- 151,159 ---- 0, /* default options */ ovector_, /* output vector for substring information */ ! 3*(capture_count_+1) /* number of elements in the output vector */ ! ); ! ! // std::cout << s << std::endl; ! // std::cout << rc << std::endl; pcre_result_ = rc; |
From: QweR <qw...@us...> - 2006-12-13 22:40:34
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20905 Modified Files: icescan.cc Log Message: Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** icescan.cc 13 Dec 2006 20:06:32 -0000 1.15 --- icescan.cc 13 Dec 2006 22:40:30 -0000 1.16 *************** *** 153,157 **** if(i+1 < argc){ ! IceRegex re1("(\\d|\\,|\\-)+"); if(! re1.match(argv[i+1]) ){ std::cout << "Invalid port range definition format." << std::endl; --- 153,158 ---- if(i+1 < argc){ ! // IceRegex re1("(\\d|\\,|\\-)+"); ! IceRegex re1("((\\d+(-\\d+)?),?)+"); if(! re1.match(argv[i+1]) ){ std::cout << "Invalid port range definition format." << std::endl; *************** *** 159,184 **** exit(1); }else{ ! IceRegex re("(\\d+(-\\d+)*),*"); ! string var, var2 = ""; re.match(argv[i+1]); re.findReset(); ! ! while(! re.findNext()){ ! ! if( re.group(1,var) && re.group(2,var2) ){ ! ! struct port_range pr; ! ! if(var2 == ""){ ! sscanf(var.c_str(), "%d", &pr.lower_port); ! pr.upper_port = pr.lower_port; ! }else{ ! sscanf(var.c_str(), "%d-%d", &pr.lower_port, &pr.upper_port); ! } ! ! par->ports.push_back(pr); } } i++; --- 160,183 ---- exit(1); }else{ ! IceRegex re("(\\d+(-\\d+)?),?"); ! icestring var="", var2 = ""; re.match(argv[i+1]); re.findReset(); ! //re.Consume(&input, &var, &var2) ! while(re.findNext()){ ! // DBGOUTPUT(v.size()); ! // DBGOUTPUT(v[0]); ! re.group(1,var); ! if(re.groups() > 2) re.group(2,var2); ! struct port_range pr; ! if(var2 == ""){ ! sscanf(var.c_str(), "%d", &pr.lower_port); ! pr.upper_port = pr.lower_port; ! }else{ ! sscanf(var.c_str(), "%d-%d", &pr.lower_port, &pr.upper_port); } + par->ports.push_back(pr); } i++; |
From: Alexander B. <da...@us...> - 2006-12-13 20:23:19
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30476 Modified Files: TODO Log Message: no message Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TODO 13 Dec 2006 20:06:32 -0000 1.7 --- TODO 13 Dec 2006 20:23:10 -0000 1.8 *************** *** 1,5 **** IceScan ToDo: ! *** 28 Nov 2006 *** -- UI -- --- 1,5 ---- IceScan ToDo: ! *** 14 Dec 2006 *** -- UI -- *************** *** 12,16 **** + UDP Ping (-PU [portlist]) [QweR] ! + TCP SYN Scan (-SS [portlist]) [Key] -- Scanning -- --- 12,16 ---- + UDP Ping (-PU [portlist]) [QweR] ! + TCP SYN Scan (-SP [portlist]) [Key] -- Scanning -- |
From: Alexander B. <da...@us...> - 2006-12-13 20:06:37
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23589 Modified Files: iceparams.h icescan.cc TODO csubtarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** icescan.cc 13 Dec 2006 13:22:00 -0000 1.14 --- icescan.cc 13 Dec 2006 20:06:32 -0000 1.15 *************** *** 20,23 **** --- 20,28 ---- "\t-SB: udp NetBIOS scan\n" "\t-SI: IP Protocol scan\n" + "\t-SN: Null scan\n" + "\t-SF: Fin scan\n" + "\t-SW: window scan\n" + "\t-SA: ACK scan\n" + "\t-SS: SYN scan\n" "PORTS SPECIFICATION:\n" "\t-p <port range>: specify port range to scan (default 1-1024).\n" *************** *** 91,94 **** --- 96,119 ---- break; + case 'N': + par->scan_type = NULL_SCAN; + break; + + case 'X': + par->scan_type = XMAS_SCAN; + break; + + case 'W': + par->scan_type = WINDOW_SCAN; + break; + + case 'A': + par->scan_type = ACK_SCAN; + break; + + case 'S': + par->scan_type = SYN_SCAN; + break; + default: std::cout << "Invalid scan type: -S" << argv[i][2] << std::endl; Index: iceparams.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceparams.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iceparams.h 13 Dec 2006 12:59:06 -0000 1.6 --- iceparams.h 13 Dec 2006 20:06:32 -0000 1.7 *************** *** 11,16 **** }; ! enum Scan_type {NO_SCAN, TCP_CONNECT_SCAN, NBT_SCAN, PROT_SCAN, FIN_SCAN}; ! // -S0 -ST -SB -SI -SF --- 11,16 ---- }; ! enum Scan_type {NO_SCAN, TCP_CONNECT_SCAN, NBT_SCAN, PROT_SCAN, FIN_SCAN, NULL_SCAN, XMAS_SCAN, WINDOW_SCAN, ACK_SCAN, SYN_SCAN}; ! // -S0 -ST -SB -SI -SF -SN -SX -SW -SA -SS *************** *** 105,111 **** void init_default_ports(){ ! const int ranges_cnt = 1; ! int ranges[ranges_cnt][2] = { {20, 24} }; //, {630, 632} }; //int ranges[ranges_cnt][2] = { {1, 1024}, {3388, 3390} }; --- 105,111 ---- void init_default_ports(){ ! const int ranges_cnt = 2; ! int ranges[ranges_cnt][2] = { {20, 25}, {135, 136} }; //int ranges[ranges_cnt][2] = { {1, 1024}, {3388, 3390} }; Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TODO 30 Nov 2006 06:43:50 -0000 1.6 --- TODO 13 Dec 2006 20:06:32 -0000 1.7 *************** *** 7,10 **** --- 7,11 ---- + add multiple targets handling; * fix reading port range for ack/udp/syn pings; + * fix reading port range for scans -- Discovering -- *************** *** 12,28 **** + UDP Ping (-PU [portlist]) [QweR] + TCP SYN Scan (-SS [portlist]) [Key] - * stop scanning of target if discovery failed: print message -- Scanning -- - * rewrite do_select_round as a template; + UDP Scan (-SU) [QweR] + ICMP Address Mask Ping (-PM) [QweR] - + Window Scan (-SW) [QweR] - + Xmas Tree Scan (-SX) [QweR] + IP Protocol Scan (-SI) [Key] (??) ! + Null Scan (-SN) [Key] ! + TCP SYN Scan (-SS) [Key] ! + The FIN Scan (-SF) [Key] -- Misc -- --- 13,24 ---- + UDP Ping (-PU [portlist]) [QweR] + TCP SYN Scan (-SS [portlist]) [Key] -- Scanning -- + UDP Scan (-SU) [QweR] + ICMP Address Mask Ping (-PM) [QweR] + IP Protocol Scan (-SI) [Key] (??) ! * merge many raw scan functions into 1. ! * do setting random window/seq(ack and seg) for raw scanning -- Misc -- Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** csubtarget.h 13 Dec 2006 18:28:21 -0000 1.15 --- csubtarget.h 13 Dec 2006 20:06:32 -0000 1.16 *************** *** 19,28 **** #define ICE_FD_SETSIZE (128) #else ! #define ICE_FD_SETSIZE (10) #endif #define MAX_CLOSED 7 ! enum port_status { PORT_UNKNOWN = -1, PORT_OPEN = 0, PORT_CLOSED = 1, PORT_FILTERED = 2, PORT_OPEN_FILTERED = 3 }; class scanned_port{ --- 19,28 ---- #define ICE_FD_SETSIZE (128) #else ! #define ICE_FD_SETSIZE (128) #endif #define MAX_CLOSED 7 ! enum port_status { PORT_UNKNOWN = -1, PORT_OPEN = 0, PORT_CLOSED = 1, PORT_FILTERED = 2, PORT_OPEN_FILTERED = 3, PORT_UNFILTERED = 4 }; class scanned_port{ *************** *** 107,110 **** --- 107,115 ---- if(par->scan_type == PROT_SCAN) prot_scan(); if(par->scan_type == FIN_SCAN) fin_scan(); + if(par->scan_type == NULL_SCAN) null_scan(); + if(par->scan_type == XMAS_SCAN) xmas_scan(); + if(par->scan_type == WINDOW_SCAN) window_scan(); + if(par->scan_type == ACK_SCAN) ack_scan(); + if(par->scan_type == SYN_SCAN) syn_scan(); } *************** *** 137,168 **** } ! int fin_scan(){ ! // fin scan, -SF ! raw = true; ! domain = (int) SOCK_RAW; ! struct sockaddr_in saddress; int len; - - len == make_sockname(saddress, hostname.c_str(), 0, domain); - - bool done = true; - int MAGIC_PORT = 54678; //ugly, need to check char local_hostname[80]; ! if(gethostname(local_hostname, 80)) exit(-1); icestring source(local_hostname); ! ! std::map <int, scanning_port> scanning_ports; init_scanning_ports(hostname, par, (int) SOCK_RAW, scanning_ports); - - - //add UID 0 check - if(par->verbose > 0) - *out << "Starting TCP FIN scan against " << hostname.c_str() << "...\n"; - crawsocket rawsend(AF_INET, (int) SOCK_RAW, IPPROTO_RAW); crawsocket rawrecv(AF_INET, (int) SOCK_RAW, IPPROTO_TCP); --- 142,166 ---- } ! void raw_tcp_scan(){ ! std::map <int, scanning_port> scanning_ports; struct sockaddr_in saddress; int len; int MAGIC_PORT = 54678; //ugly, need to check char local_hostname[80]; ! ! //add UID 0 check ! //^^^^^^^^^^^^ UGLY + raw = true; + domain = (int) SOCK_RAW; + len == make_sockname(saddress, hostname.c_str(), 0, domain); + + if(gethostname(local_hostname, 80)) exit(-1); + icestring source(local_hostname); ! init_scanning_ports(hostname, par, (int) SOCK_RAW, scanning_ports); crawsocket rawsend(AF_INET, (int) SOCK_RAW, IPPROTO_RAW); crawsocket rawrecv(AF_INET, (int) SOCK_RAW, IPPROTO_TCP); *************** *** 177,188 **** int attempts = 0; ! std::map <int, scanning_port>::iterator i; ! ! while(attempts++ < 5){ ! for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ if(! (*i).second.done ){ ! //DBGOUTPUT("!!!!");// ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_FIN, 0, 0, 0); ! //DBGOUTPUT("!!!!"); (*i).second.time = time(0); --- 175,206 ---- int attempts = 0; ! while(attempts++ < 5){ ! for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ if(! (*i).second.done ){ ! ! switch(par->scan_type){ ! case FIN_SCAN: ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_FIN, 0, 0, 0); ! break; ! ! case NULL_SCAN: ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, (*i).first, 0, 0, 0, 0, 0, 0); ! break; ! ! case XMAS_SCAN: ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_FIN | TH_URG | TH_PUSH, 0, 0, 0); ! break; ! ! case WINDOW_SCAN: ! case ACK_SCAN: ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_ACK, 0, 0, 0); ! break; ! ! case SYN_SCAN: ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, (*i).first, 0, 0, TH_SYN, 0, 0, 0); ! break; ! } ! ! (*i).second.time = time(0); *************** *** 193,196 **** --- 211,215 ---- } + usleep(500000); int bytes; *************** *** 201,219 **** int at = 0; while(at++<10){ ! while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ if(ip->saddr = saddress.sin_addr.s_addr){ tcp = (struct tcphdr *) (response + 4 * ip->ihl); ! if (tcp->th_flags & TH_RST) { ! //crawsocket::print_tcppacket(response, bytes); int closed_port = ntohs(tcp->th_sport); set_port_status(closed_port, PORT_CLOSED); ! //if(scanning_ports.find(closed_port)) ! scanning_ports[closed_port].done = true; ! //^^^^UGLY, please check ! } } bzero(response, 65534); --- 220,277 ---- int at = 0; + while(at++<10){ ! while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ if(ip->saddr = saddress.sin_addr.s_addr){ tcp = (struct tcphdr *) (response + 4 * ip->ihl); ! ! if ((tcp->th_flags & TH_RST) && (par->scan_type == FIN_SCAN || par->scan_type == NULL_SCAN || par->scan_type == XMAS_SCAN)) { int closed_port = ntohs(tcp->th_sport); set_port_status(closed_port, PORT_CLOSED); ! if(scanning_ports.find(closed_port) != scanning_ports.end()) ! scanning_ports[closed_port].done = true; ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == WINDOW_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(tcp->th_win == 0){ ! set_port_status(port, PORT_CLOSED); ! }else{ ! set_port_status(port, PORT_OPEN); ! } ! ! if(scanning_ports.find(port) != scanning_ports.end()) ! scanning_ports[port].done = true; ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == ACK_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! set_port_status(port, PORT_UNFILTERED); ! ! if(scanning_ports.find(port) != scanning_ports.end()) ! scanning_ports[port].done = true; ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == SYN_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(port != MAGIC_PORT){ ! set_port_status(port, PORT_CLOSED); ! ! if(scanning_ports.find(port) != scanning_ports.end()) ! scanning_ports[port].done = true; ! } ! }else if ((tcp->th_flags & (TH_ACK|TH_SYN)) && (par->scan_type == SYN_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(port != MAGIC_PORT){ ! set_port_status(port, PORT_OPEN); ! ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, port, 0, 0, TH_RST, 0, 0, 0); ! ! if(scanning_ports.find(port) != scanning_ports.end()) ! scanning_ports[port].done = true; ! } } + + } bzero(response, 65534); *************** *** 223,239 **** } ! for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ if(! (*i).second.done){ (*i).second.done = true; set_port_status((*i).first, get_no_response_status()); } ! } show_ports(); if(par->verbose>0) out->line("TCP FIN scan finished."); ! ! scanning_ports.clear(); } --- 281,364 ---- } ! for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ if(! (*i).second.done){ (*i).second.done = true; set_port_status((*i).first, get_no_response_status()); } ! } + scanning_ports.clear(); + } + + int fin_scan(){ + // -SF + if(par->verbose > 0) + *out << "Starting TCP FIN scan against " << hostname.c_str() << "...\n"; + + raw_tcp_scan(); show_ports(); if(par->verbose>0) out->line("TCP FIN scan finished."); ! } ! ! int null_scan(){ ! // -SN ! if(par->verbose > 0) ! *out << "Starting TCP NULL scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP NULL scan finished."); ! } ! ! int ack_scan(){ ! // -SN ! if(par->verbose > 0) ! *out << "Starting TCP ACK scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP ACK scan finished."); ! } ! ! int xmas_scan(){ ! // -SX ! if(par->verbose > 0) ! *out << "Starting TCP XMAS scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP XMAS scan finished."); ! } ! ! int window_scan(){ ! // -SW ! if(par->verbose > 0) ! *out << "Starting TCP Window scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP Window scan finished."); ! } ! ! int syn_scan(){ ! // -SS ! if(par->verbose > 0) ! *out << "Starting TCP SYN scan against " << hostname.c_str() << "...\n"; ! ! raw_tcp_scan(); ! show_ports(); ! ! if(par->verbose>0) ! out->line("TCP SYN scan finished."); } *************** *** 290,295 **** --- 415,427 ---- switch(par->scan_type){ case FIN_SCAN: + case NULL_SCAN: + case XMAS_SCAN: return PORT_OPEN_FILTERED; break; + case WINDOW_SCAN: + case ACK_SCAN: + case SYN_SCAN: + return PORT_FILTERED; + break; } } *************** *** 468,471 **** --- 600,606 ---- sprintf(output_buf, "Discovered open|filtered port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); + }else if(ps == PORT_UNFILTERED && par->verbose > 1){ + sprintf(output_buf, "Discovered unfiltered port %d/tcp on %s.", port, hostname.c_str()); + out->line(output_buf); } } *************** *** 593,597 **** for(i = subtarget_ports.begin(); i!= subtarget_ports.end(); ++i){ total++; ! if((*i).status == PORT_OPEN){ open++; }else if((*i).status == PORT_CLOSED){ --- 728,732 ---- for(i = subtarget_ports.begin(); i!= subtarget_ports.end(); ++i){ total++; ! if((*i).status == PORT_OPEN || (*i).status == PORT_OPEN_FILTERED){ open++; }else if((*i).status == PORT_CLOSED){ *************** *** 638,641 **** --- 773,779 ---- sprintf(output_buf, "%5d/tcp o|f %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); + }else if(subtarget_ports[j].status == PORT_UNFILTERED){ + sprintf(output_buf, "%5d/tcp unfilt %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); + out->line(output_buf); }else if(subtarget_ports[j].status == PORT_CLOSED && show_closed){ sprintf(output_buf, "%5d/tcp closed %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); |
From: Alexander B. <da...@us...> - 2006-12-13 20:06:36
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23589/icesockets Modified Files: crawsocket.h sock_name.h Log Message: no message Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** crawsocket.h 13 Dec 2006 18:28:21 -0000 1.5 --- crawsocket.h 13 Dec 2006 20:06:32 -0000 1.6 *************** *** 204,266 **** ! int send_tcp_raw2( icestring source, icestring destination, unsigned short sport, unsigned short dport, unsigned long seq, ! unsigned long ack, unsigned char flags, unsigned short window, char *data, unsigned short datalen) ! { ! ! ! char packet[sizeof(struct tcphdr) + datalen]; ! ! struct tcphdr *tcp = (struct tcphdr *) (packet); ! //struct pseudo_header *pseudo = (struct pseudo_header *) (packet - sizeof(struct pseudo_header)); ! int res; ! char myname[ICEMAXHOSTNAME + 1]; ! ! struct sockaddr_in saddress, daddress; ! int slen, dlen; ! ! slen == make_sockname(saddress, source.c_str(), 0, domain); ! dlen == make_sockname(daddress, destination.c_str(), 0, domain); ! ! bzero(packet, sizeof(tcphdr)); ! ! // pseudo->s_addr = saddress.sin_addr.s_addr; ! // pseudo->d_addr = daddress.sin_addr.s_addr; ! // pseudo->protocol = IPPROTO_TCP; ! // pseudo->length = htons(sizeof(struct tcphdr) + datalen); ! ! tcp->th_sport = htons(sport); ! tcp->th_dport = htons(dport); ! if (seq) ! tcp->th_seq = htonl(seq); ! else tcp->th_seq = rand() + rand(); ! ! if (flags & TH_ACK && ack) ! tcp->th_ack = htonl(seq); ! else if (flags & TH_ACK) ! tcp->th_ack = rand() + rand(); ! ! tcp->th_off = 5; ! tcp->th_flags = flags; ! ! unsigned short ttl = 121; ! ! if (window) ! tcp->th_win = window; ! else tcp->th_win = htons(1024 * (ttl % 4 + 1)); ! ! tcp->th_sum = in_chksum((unsigned short *)tcp, sizeof(struct tcphdr) + datalen); ! ! ! //print_tcppacket(packet,ntohs(ip->tot_len)); ! ! if ((res = sendto(destination.c_str(), packet, ntohs(sizeof(struct tcphdr) + datalen), 0)) == -1) ! { ! perror("sendto in send_tcp_raw"); ! return -1; ! } ! ! return res; ! } ! static int print_tcppacket(char *packet, int readdata) { struct iphdr *ip = (struct iphdr *) packet; --- 204,208 ---- ! // from Fyodor's "The Art of Port Scanning" static int print_tcppacket(char *packet, int readdata) { struct iphdr *ip = (struct iphdr *) packet; Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sock_name.h 13 Dec 2006 09:08:33 -0000 1.7 --- sock_name.h 13 Dec 2006 20:06:32 -0000 1.8 *************** *** 116,120 **** if( (rc = getnameinfo((sockaddr *) &saddr, len, hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD)) < 0) { ! perror("getnameinfo"); return -1; } --- 116,120 ---- if( (rc = getnameinfo((sockaddr *) &saddr, len, hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD)) < 0) { ! //perror("getnameinfo"); return -1; } |
From: Alexander B. <da...@us...> - 2006-12-13 18:28:26
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16694/icesockets Modified Files: crawsocket.h Log Message: no message Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** crawsocket.h 13 Dec 2006 13:22:00 -0000 1.4 --- crawsocket.h 13 Dec 2006 18:28:21 -0000 1.5 *************** *** 203,206 **** --- 203,266 ---- } + + int send_tcp_raw2( icestring source, icestring destination, unsigned short sport, unsigned short dport, unsigned long seq, + unsigned long ack, unsigned char flags, unsigned short window, char *data, unsigned short datalen) + { + + + char packet[sizeof(struct tcphdr) + datalen]; + + struct tcphdr *tcp = (struct tcphdr *) (packet); + //struct pseudo_header *pseudo = (struct pseudo_header *) (packet - sizeof(struct pseudo_header)); + int res; + char myname[ICEMAXHOSTNAME + 1]; + + struct sockaddr_in saddress, daddress; + int slen, dlen; + + slen == make_sockname(saddress, source.c_str(), 0, domain); + dlen == make_sockname(daddress, destination.c_str(), 0, domain); + + bzero(packet, sizeof(tcphdr)); + + // pseudo->s_addr = saddress.sin_addr.s_addr; + // pseudo->d_addr = daddress.sin_addr.s_addr; + // pseudo->protocol = IPPROTO_TCP; + // pseudo->length = htons(sizeof(struct tcphdr) + datalen); + + tcp->th_sport = htons(sport); + tcp->th_dport = htons(dport); + if (seq) + tcp->th_seq = htonl(seq); + else tcp->th_seq = rand() + rand(); + + if (flags & TH_ACK && ack) + tcp->th_ack = htonl(seq); + else if (flags & TH_ACK) + tcp->th_ack = rand() + rand(); + + tcp->th_off = 5; + tcp->th_flags = flags; + + unsigned short ttl = 121; + + if (window) + tcp->th_win = window; + else tcp->th_win = htons(1024 * (ttl % 4 + 1)); + + tcp->th_sum = in_chksum((unsigned short *)tcp, sizeof(struct tcphdr) + datalen); + + + //print_tcppacket(packet,ntohs(ip->tot_len)); + + if ((res = sendto(destination.c_str(), packet, ntohs(sizeof(struct tcphdr) + datalen), 0)) == -1) + { + perror("sendto in send_tcp_raw"); + return -1; + } + + return res; + } + static int print_tcppacket(char *packet, int readdata) { struct iphdr *ip = (struct iphdr *) packet; |
From: Alexander B. <da...@us...> - 2006-12-13 18:28:26
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16694 Modified Files: csubtarget.h Log Message: no message Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** csubtarget.h 13 Dec 2006 13:22:00 -0000 1.14 --- csubtarget.h 13 Dec 2006 18:28:21 -0000 1.15 *************** *** 162,166 **** //add UID 0 check ! if(par->verbose>0) *out << "Starting TCP FIN scan against " << hostname.c_str() << "...\n"; --- 162,166 ---- //add UID 0 check ! if(par->verbose > 0) *out << "Starting TCP FIN scan against " << hostname.c_str() << "...\n"; *************** *** 170,178 **** rawrecv.nonblock(true); int attempts = 0; ! while(attempts++ < 5){ ! std::map <int, scanning_port>::iterator i; ! for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ if(! (*i).second.done ){ --- 170,183 ---- rawrecv.nonblock(true); + int one = 1; + const int *val = &one; + if (rawsend.setsockopt (IPPROTO_IP, IP_HDRINCL, val, sizeof (one)) < 0) + perror("Setsockopt HDRINCL:"); + int attempts = 0; ! std::map <int, scanning_port>::iterator i; ! ! while(attempts++ < 5){ for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ if(! (*i).second.done ){ *************** *** 191,210 **** int bytes; char response[65535]; - //, remote_hostname[ICEMAXHOSTNAME]; struct iphdr *ip = (struct iphdr *) response; struct tcphdr *tcp; while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ if(ip->saddr = saddress.sin_addr.s_addr){ tcp = (struct tcphdr *) (response + 4 * ip->ihl); if (tcp->th_flags & TH_RST) { ! crawsocket::print_tcppacket(response, bytes); int closed_port = ntohs(tcp->th_sport); set_port_status(closed_port, PORT_CLOSED); ! //if(scanning_ports.find(closed_port)) scanning_ports[closed_port].done = true; } --- 196,217 ---- int bytes; char response[65535]; struct iphdr *ip = (struct iphdr *) response; struct tcphdr *tcp; + int at = 0; + while(at++<10){ while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ if(ip->saddr = saddress.sin_addr.s_addr){ tcp = (struct tcphdr *) (response + 4 * ip->ihl); if (tcp->th_flags & TH_RST) { ! //crawsocket::print_tcppacket(response, bytes); int closed_port = ntohs(tcp->th_sport); set_port_status(closed_port, PORT_CLOSED); ! //if(scanning_ports.find(closed_port)) scanning_ports[closed_port].done = true; + //^^^^UGLY, please check } *************** *** 212,219 **** bzero(response, 65534); } ! ! done = false; } show_ports(); --- 219,233 ---- bzero(response, 65534); } ! usleep(1000); ! } } + for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ + if(! (*i).second.done){ + (*i).second.done = true; + set_port_status((*i).first, get_no_response_status()); + } + } + show_ports(); *************** *** 273,276 **** --- 287,298 ---- } + enum port_status get_no_response_status(){ + switch(par->scan_type){ + case FIN_SCAN: + return PORT_OPEN_FILTERED; + break; + } + } + int get_first_free_socket(){ int f; *************** *** 443,447 **** sprintf(output_buf, "Discovered filtered port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); ! } } --- 465,472 ---- sprintf(output_buf, "Discovered filtered port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); ! }else if(ps == PORT_OPEN_FILTERED && par->verbose > 2){ ! sprintf(output_buf, "Discovered open|filtered port %d/tcp on %s.", port, hostname.c_str()); ! out->line(output_buf); ! } } *************** *** 610,613 **** --- 635,641 ---- sprintf(output_buf, "%5d/tcp open %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); out->line(output_buf); + }else if(subtarget_ports[j].status == PORT_OPEN_FILTERED){ + sprintf(output_buf, "%5d/tcp o|f %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); + out->line(output_buf); }else if(subtarget_ports[j].status == PORT_CLOSED && show_closed){ sprintf(output_buf, "%5d/tcp closed %s", subtarget_ports[j].port_number, isnd->get_tcp_service(subtarget_ports[j].port_number).c_str()); |