javanetsim-cvs Mailing List for javaNetSim (Page 18)
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-13 14:56:19
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30367/icesockets Modified Files: sock_types.h Log Message: no message Index: sock_types.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_types.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sock_types.h 13 Dec 2006 14:15:21 -0000 1.5 --- sock_types.h 13 Dec 2006 14:56:10 -0000 1.6 *************** *** 157,180 **** // IP Header structure for cygwin #ifdef __CYGWIN__ ! struct pkt_iphdr{ ! #if __BYTE_ORDER == __LITTLE_ENDIAN ! my_uint8_t ihl:4; ! my_uint8_t version:4; ! #elif __BYTE_ORDER == __BIG_ENDIAN ! my_uint8_t version:4; ! my_uint8_t ihl:4; ! #else ! #error "Couldn't determine endianness" ! #endif ! my_uint8_t tos; ! my_uint16_t tot_len; ! my_uint16_t id; ! my_uint16_t frag_off; ! my_uint8_t ttl; ! my_uint8_t protocol; ! my_uint16_t csum; ! my_uint32_t saddr; ! my_uint32_t daddr; ! }; #endif --- 157,183 ---- // IP Header structure for cygwin #ifdef __CYGWIN__ ! struct iphdr ! { ! #if __BYTE_ORDER == __LITTLE_ENDIAN ! unsigned int ihl:4; ! unsigned int version:4; ! #elif __BYTE_ORDER == __BIG_ENDIAN ! unsigned int version:4; ! unsigned int ihl:4; ! #else ! # error "Please fix <bits/endian.h>" ! #endif ! my_uint8_t tos; ! my_uint16_t tot_len; ! my_uint16_t id; ! my_uint16_t frag_off; ! my_uint8_t ttl; ! my_uint8_t protocol; ! my_uint16_t check; ! my_uint32_t saddr; ! my_uint32_t daddr; ! /*The options start here. */ ! }; ! #endif |
From: Alexander B. <da...@us...> - 2006-12-13 14:56:19
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30367 Modified Files: icediscover.h Log Message: no message Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** icediscover.h 13 Dec 2006 14:35:02 -0000 1.6 --- icediscover.h 13 Dec 2006 14:56:11 -0000 1.7 *************** *** 81,86 **** strcpy(t_hostname, hostname); if(!getuid()){ ! //we're root, so can work with raw sockets if(par->verbose>0) --- 81,90 ---- strcpy(t_hostname, hostname); + #ifndef __CYGWIN__ if(!getuid()){ ! #else ! if(1){ ! #endif ! //we're root, so can work with raw sockets if(par->verbose>0) |
From: Alexander B. <da...@us...> - 2006-12-13 14:35:09
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21742/icesockets Modified Files: csocket.h Log Message: no message Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** csocket.h 13 Dec 2006 14:15:21 -0000 1.7 --- csocket.h 13 Dec 2006 14:35:02 -0000 1.8 *************** *** 198,225 **** int sendto(const char *hostname, int port, const void *msg, int len, unsigned int flags){ - struct sockaddr_in saddress; - int slen; - //struct addrinfo hints, *res; - //int salen; - //char cportbuf[8]; - //char *cport = cportbuf; ! //if(port == 0) cport = NULL; ! //else sprintf(cport, "%d", port); ! ! //bzero(&hints, sizeof(struct addrinfo)); ! ! //hints.ai_flags = AI_CANONNAME; ! //hints.ai_family = domain; ! //hints.ai_socktype = type; ! if((slen == make_sockname(saddress, hostname, port, domain))) return sockerror("sockname"); ! ! //if( getaddrinfo(hostname, cport, &hints, &res) != 0 ) ! // return sockerror("getaddrinfo"); ! ! //return ::sendto(sid, msg, len, flags, (const sockaddr *) res->ai_addr, res->ai_addrlen); ! return ::sendto(sid, msg, len, flags, (const sockaddr *) &saddress, slen); ! } --- 198,229 ---- int sendto(const char *hostname, int port, const void *msg, int len, unsigned int flags){ ! // struct addrinfo hints, *res; ! // int salen; ! // char cportbuf[8]; ! // char *cport = cportbuf; ! // ! // if(port == 0) cport = NULL; ! // else sprintf(cport, "%d", port); ! // ! // bzero(&hints, sizeof(struct addrinfo)); ! // ! // hints.ai_flags = AI_CANONNAME; ! // 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); ! ! struct sockaddr_in saddress; ! int slen; ! if((slen == make_sockname(saddress, hostname, port, domain))) return sockerror("sockname"); ! ! return ::sendto(sid, msg, len, flags, (const sockaddr *) &saddress, sizeof(struct sockaddr)); ! } |
From: Alexander B. <da...@us...> - 2006-12-13 14:35:06
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21742 Modified Files: icediscover.h Log Message: no message Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** icediscover.h 13 Dec 2006 14:15:21 -0000 1.5 --- icediscover.h 13 Dec 2006 14:35:02 -0000 1.6 *************** *** 69,74 **** out->line("Sending icmp ping host discovery request (echo_request)..."); - DBGOUTPUT(hostname); - r->sendto(hostname, buftosend, len, 0); --- 69,72 ---- |
From: Alexander B. <da...@us...> - 2006-12-13 14:15:35
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14219/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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sock_types.h 13 Dec 2006 13:22:00 -0000 1.4 --- sock_types.h 13 Dec 2006 14:15:21 -0000 1.5 *************** *** 153,156 **** --- 153,181 ---- #endif + + + // IP Header structure for cygwin + #ifdef __CYGWIN__ + struct pkt_iphdr{ + #if __BYTE_ORDER == __LITTLE_ENDIAN + my_uint8_t ihl:4; + my_uint8_t version:4; + #elif __BYTE_ORDER == __BIG_ENDIAN + my_uint8_t version:4; + my_uint8_t ihl:4; + #else + #error "Couldn't determine endianness" + #endif + my_uint8_t tos; + my_uint16_t tot_len; + my_uint16_t id; + my_uint16_t frag_off; + my_uint8_t ttl; + my_uint8_t protocol; + my_uint16_t csum; + my_uint32_t saddr; + my_uint32_t daddr; + }; + #endif #endif Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** csocket.h 12 Dec 2006 20:40:19 -0000 1.6 --- csocket.h 13 Dec 2006 14:15:21 -0000 1.7 *************** *** 198,219 **** int sendto(const char *hostname, int port, const void *msg, int len, unsigned int flags){ ! struct addrinfo hints, *res; ! int salen; ! char cportbuf[8]; ! char *cport = cportbuf; ! if(port == 0) cport = NULL; ! else sprintf(cport, "%d", port); ! bzero(&hints, sizeof(struct addrinfo)); ! hints.ai_flags = AI_CANONNAME; ! hints.ai_family = domain; ! hints.ai_socktype = type; ! if( getaddrinfo(hostname, cport, &hints, &res) != 0 ) ! return sockerror("getaddrinfo"); ! return ::sendto(sid, msg, len, flags, (const sockaddr *) res->ai_addr, res->ai_addrlen); } --- 198,224 ---- int sendto(const char *hostname, int port, const void *msg, int len, unsigned int flags){ ! struct sockaddr_in saddress; ! int slen; ! //struct addrinfo hints, *res; ! //int salen; ! //char cportbuf[8]; ! //char *cport = cportbuf; ! //if(port == 0) cport = NULL; ! //else sprintf(cport, "%d", port); ! //bzero(&hints, sizeof(struct addrinfo)); ! //hints.ai_flags = AI_CANONNAME; ! //hints.ai_family = domain; ! //hints.ai_socktype = type; ! if((slen == make_sockname(saddress, hostname, port, domain))) ! return sockerror("sockname"); ! //if( getaddrinfo(hostname, cport, &hints, &res) != 0 ) ! // return sockerror("getaddrinfo"); ! //return ::sendto(sid, msg, len, flags, (const sockaddr *) res->ai_addr, res->ai_addrlen); ! return ::sendto(sid, msg, len, flags, (const sockaddr *) &saddress, slen); } |
From: Alexander B. <da...@us...> - 2006-12-13 14:15:25
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14219 Modified Files: icediscover.h Log Message: no message Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** icediscover.h 12 Dec 2006 20:40:19 -0000 1.4 --- icediscover.h 13 Dec 2006 14:15:21 -0000 1.5 *************** *** 42,46 **** void *send_icmp_echo(void *arg){ struct discover_thread_params *dtp = (struct discover_thread_params *) arg; ! crawsocket *r = dtp->r; char *hostname = dtp->hostname; --- 42,46 ---- void *send_icmp_echo(void *arg){ struct discover_thread_params *dtp = (struct discover_thread_params *) arg; ! crawsocket *r = dtp->r; char *hostname = dtp->hostname; *************** *** 69,72 **** --- 69,74 ---- out->line("Sending icmp ping host discovery request (echo_request)..."); + DBGOUTPUT(hostname); + r->sendto(hostname, buftosend, len, 0); *************** *** 79,82 **** --- 81,85 ---- bool icmp_echo_ping(const char *hostname, iceparams *par, iceoutput *out){ char *t_hostname = (char *) malloc(strlen(hostname) + 1); + strcpy(t_hostname, hostname); if(!getuid()){ |
From: Alexander B. <da...@us...> - 2006-12-13 13:22:09
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21429 Modified Files: nbt_wrapper.h icescan.cc csubtarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** icescan.cc 13 Dec 2006 13:13:30 -0000 1.13 --- icescan.cc 13 Dec 2006 13:22:00 -0000 1.14 *************** *** 134,153 **** exit(1); }else{ - // pcrecpp::StringPiece input(argv[i+1]); - // pcrecpp::RE re("(\\d+(-\\d+)*),*"); IceRegex re("(\\d+(-\\d+)*),*"); - - //std::vector<icestring> v; string var, var2 = ""; ! re1.match(argv[i+1]); ! rel.findReset(); ! //re.Consume(&input, &var, &var2) ! while(! re1.findNext()){ ! // DBGOUTPUT(v.size()); ! // DBGOUTPUT(v[0]); ! if( rel.group(1,var) && rel.group(2,var2) ){ struct port_range pr; --- 134,147 ---- 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; *************** *** 163,167 **** } } - exit(-1); i++; } --- 157,160 ---- *************** *** 185,191 **** }else{ //DBGOUTPUT("Target is: " << argv[i]); ! ! par->target.assign(argv[i]); ! //DBGOUTPUT(par->target); } --- 178,182 ---- }else{ //DBGOUTPUT("Target is: " << argv[i]); ! par->target.assign(argv[i]); } *************** *** 198,202 **** exit(0); - print_help(argv[0]); } --- 189,192 ---- Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** csubtarget.h 13 Dec 2006 12:59:06 -0000 1.13 --- csubtarget.h 13 Dec 2006 13:22:00 -0000 1.14 *************** *** 44,47 **** --- 44,48 ---- long time; int socket_ptr; + int attempt; }; *************** *** 155,162 **** icestring source(local_hostname); - DBGOUTPUT("!!!"); std::map <int, scanning_port> scanning_ports; ! DBGOUTPUT("!!!"); ! init_scanning_ports(hostname, par, (int) SOCK_RAW, scanning_ports); --- 156,161 ---- icestring source(local_hostname); std::map <int, scanning_port> scanning_ports; ! init_scanning_ports(hostname, par, (int) SOCK_RAW, scanning_ports); *************** *** 167,175 **** crawsocket rawsend(AF_INET, (int) SOCK_RAW, IPPROTO_RAW); ! ! DBGOUTPUT("All ready!"); ! while(done){ std::map <int, scanning_port>::iterator i; --- 166,176 ---- crawsocket rawsend(AF_INET, (int) SOCK_RAW, IPPROTO_RAW); + crawsocket rawrecv(AF_INET, (int) SOCK_RAW, IPPROTO_TCP); ! rawrecv.nonblock(true); ! int attempts = 0; ! ! while(attempts++ < 5){ std::map <int, scanning_port>::iterator i; *************** *** 177,183 **** if(! (*i).second.done ){ //DBGOUTPUT("!!!!");// ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, (*i).first, 2337818902, 2337818902, TH_FIN, 0, 0, 0); //DBGOUTPUT("!!!!"); (*i).second.time = time(0); usleep(1000); --- 178,186 ---- 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); + + (*i).second.attempt++; usleep(1000); *************** *** 185,192 **** } - //sleep(1); - - crawsocket rawrecv(AF_INET, (int) SOCK_RAW, IPPROTO_TCP); - //rawrecv.nonblock(true); int bytes; --- 188,191 ---- *************** *** 197,212 **** ! for(int k = 1; k<=27; k++){ ! while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL)){ ! //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); ! //} ! //} ! bzero(response, 65534); } ! } done = false; --- 196,215 ---- ! 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; ! ! } } ! bzero(response, 65534); ! } done = false; *************** *** 289,292 **** --- 292,296 ---- sp.port_number = i; scanning_ports[i] = sp; + scanning_ports[i].attempt = 0; scanning_ports[i].done = false; } Index: nbt_wrapper.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbt_wrapper.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nbt_wrapper.h 12 Dec 2006 20:40:19 -0000 1.2 --- nbt_wrapper.h 13 Dec 2006 13:22:00 -0000 1.3 *************** *** 4,11 **** #include <sys/types.h> - #define my_uint16_t uint16_t - #define my_uint32_t uint32_t - #define my_uint8_t uint8_t - #define NBT_MSGSIZE 1024 --- 4,7 ---- |
From: Alexander B. <da...@us...> - 2006-12-13 13:22:05
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21429/icesockets Modified Files: crawsocket.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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sock_types.h 12 Dec 2006 20:40:19 -0000 1.3 --- sock_types.h 13 Dec 2006 13:22:00 -0000 1.4 *************** *** 10,13 **** --- 10,18 ---- #include <netdb.h> + + #define my_uint16_t uint16_t + #define my_uint32_t uint32_t + #define my_uint8_t uint8_t + // Re-Defining string type; use icestring instead of string #ifdef __CYGWIN__ Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** crawsocket.h 13 Dec 2006 12:59:06 -0000 1.3 --- crawsocket.h 13 Dec 2006 13:22:00 -0000 1.4 *************** *** 10,18 **** struct pseudo_header { ! unsigned long s_addr; ! unsigned long d_addr; ! char zero; ! unsigned char protocol; ! unsigned short length; }; --- 10,18 ---- 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; }; *************** *** 162,171 **** 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; --- 162,171 ---- 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; |
From: QweR <qw...@us...> - 2006-12-13 13:13:34
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16202/icesockets Modified Files: iceregex.h Log Message: Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iceregex.h 13 Dec 2006 12:59:06 -0000 1.6 --- iceregex.h 13 Dec 2006 13:13:30 -0000 1.7 *************** *** 122,125 **** --- 122,132 ---- } + 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; + } + private: bool find(icestring const& s, std::vector<icestring> &v, int start){ |
From: QweR <qw...@us...> - 2006-12-13 13:13:34
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16202 Modified Files: icescan.cc Log Message: Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** icescan.cc 13 Dec 2006 12:59:06 -0000 1.12 --- icescan.cc 13 Dec 2006 13:13:30 -0000 1.13 *************** *** 138,151 **** IceRegex re("(\\d+(-\\d+)*),*"); ! std::vector<icestring> v; string var, var2 = ""; //re.Consume(&input, &var, &var2) ! do { ! re1.match(argv[i+1], v); ! DBGOUTPUT(v.size()); ! DBGOUTPUT(v[0]); ! /*struct port_range pr; if(var2 == ""){ --- 138,155 ---- IceRegex re("(\\d+(-\\d+)*),*"); ! //std::vector<icestring> v; string var, var2 = ""; + re1.match(argv[i+1]); + rel.findReset(); //re.Consume(&input, &var, &var2) ! while(! re1.findNext()){ ! // DBGOUTPUT(v.size()); ! // DBGOUTPUT(v[0]); ! ! if( rel.group(1,var) && rel.group(2,var2) ){ ! ! struct port_range pr; if(var2 == ""){ *************** *** 156,161 **** } ! par->ports.push_back(pr);*/ ! }while(! re1.findNext()); exit(-1); i++; --- 160,166 ---- } ! par->ports.push_back(pr); ! } ! } exit(-1); i++; *************** *** 182,186 **** par->target.assign(argv[i]); ! //DBGOUTPUT(par->target); } --- 187,191 ---- par->target.assign(argv[i]); ! //DBGOUTPUT(par->target); } *************** *** 206,210 **** iceoutput out; iceparams par; ! struct timeb tp1, tp2; --- 211,215 ---- iceoutput out; iceparams par; ! struct timeb tp1, tp2; |
From: Alexander B. <da...@us...> - 2006-12-13 12:59:12
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7708/icesockets Modified Files: crawsocket.h iceregex.h Added Files: ice_rand.h Log Message: no message --- NEW FILE: ice_rand.h --- (This appears to be a binary file; contents omitted.) Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** crawsocket.h 30 Nov 2006 12:27:36 -0000 1.2 --- crawsocket.h 13 Dec 2006 12:59:06 -0000 1.3 *************** *** 6,9 **** --- 6,19 ---- #include <netinet/ip.h> #include <netinet/ip_icmp.h> + #define __FAVOR_BSD + #include <netinet/tcp.h> + + struct pseudo_header { + unsigned long s_addr; + unsigned long d_addr; + char zero; + unsigned char protocol; + unsigned short length; + }; class crawsocket : csocket{ *************** *** 89,93 **** } ! int sendto(char *hostname, const void *msg, int len, unsigned int flags){ return csocket::sendto(hostname, 0, msg, len, flags); } --- 99,103 ---- } ! int sendto(const char *hostname, const void *msg, int len, unsigned int flags){ return csocket::sendto(hostname, 0, msg, len, flags); } *************** *** 97,100 **** --- 107,114 ---- } + void nonblock(bool lck){ + csocket::nonblock(lck); + } + bool state(){ return (!sstate) ? true : false; *************** *** 116,120 **** return protocol; } ! }; --- 130,256 ---- return protocol; } ! ! ! int send_tcp_raw( 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 iphdr) + sizeof(struct tcphdr) + datalen]; ! ! struct iphdr *ip = (struct iphdr *) packet; ! struct tcphdr *tcp = (struct tcphdr *) (packet + sizeof(struct iphdr)); ! struct pseudo_header *pseudo = (struct pseudo_header *) (packet + sizeof(struct iphdr) - 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(iphdr) + 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 *)pseudo, sizeof(struct tcphdr) + ! sizeof(struct pseudo_header) + datalen); ! ! bzero(packet, sizeof(struct iphdr)); ! ip->version = 4; ! ip->ihl = 5; ! ip->tot_len = htons(sizeof(struct iphdr) + sizeof(struct tcphdr) + datalen); ! ip->id = rand(); ! ip->ttl = ttl; ! ip->protocol = IPPROTO_TCP; ! ip->saddr = saddress.sin_addr.s_addr; ! ip->daddr = daddress.sin_addr.s_addr; ! ip->check = in_chksum((unsigned short *)ip, sizeof(struct iphdr)); ! ! //print_tcppacket(packet,ntohs(ip->tot_len)); ! ! if ((res = sendto(destination.c_str(), packet, ntohs(ip->tot_len), 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; ! struct tcphdr *tcp = (struct tcphdr *) (packet + sizeof(struct iphdr)); ! char *data = packet + sizeof(struct iphdr) + sizeof(struct tcphdr); ! int tot_len; ! struct in_addr bullshit, bullshit2; ! char sourcehost[16]; ! int i; ! ! if (!packet) { ! std::cerr << "readtcppacket: packet is NULL!\n"; ! return -1; ! } ! ! bullshit.s_addr = ip->saddr; bullshit2.s_addr = ip->daddr; ! tot_len = ntohs(ip->tot_len); ! strncpy(sourcehost, inet_ntoa(bullshit), 16); ! i = 4 * (ntohs(ip->ihl) + ntohs(tcp->th_off)); ! if (ip->protocol == IPPROTO_TCP){ ! if (ip->frag_off){ ! printf("Packet is fragmented, offset field: %u", ip->frag_off); ! } else { ! printf("TCP packet: %s:%d -> %s:%d (total: %d bytes)\n", sourcehost, ! ntohs(tcp->th_sport), inet_ntoa(bullshit2), ! ntohs(tcp->th_dport), tot_len); ! printf("Flags: "); ! if (!tcp->th_flags) printf("(none)"); ! if (tcp->th_flags & TH_RST) printf("RST "); ! if (tcp->th_flags & TH_SYN) printf("SYN "); ! if (tcp->th_flags & TH_ACK) printf("ACK "); ! if (tcp->th_flags & TH_PUSH) printf("PSH "); ! if (tcp->th_flags & TH_FIN) printf("FIN "); ! if (tcp->th_flags & TH_URG) printf("URG "); ! printf("\n"); ! printf("ttl: %hi ", ip->ttl); ! if (tcp->th_flags & (TH_SYN | TH_ACK)) printf("Seq: %lu\tAck: %lu\n", ! tcp->th_seq, tcp->th_ack); ! else if (tcp->th_flags & TH_SYN) printf("Seq: %lu\n", ntohl(tcp->th_seq)); ! else if (tcp->th_flags & TH_ACK) printf("Ack: %lu\n", ntohl(tcp->th_ack)); ! } ! } ! if (readdata && i < tot_len) { ! printf("Data portion:\n"); ! while(i < tot_len) printf("%2X%c", data[i], (++i%16)? ' ' : '\n'); ! printf("\n"); ! } ! ! return 0; ! } ! }; Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iceregex.h 13 Dec 2006 09:08:33 -0000 1.5 --- iceregex.h 13 Dec 2006 12:59:06 -0000 1.6 *************** *** 95,99 **** } ! bool group(int i, char *str, int strsize){ int rc = pcre_copy_substring( subject.c_str(), // Subject that has been successfully matched --- 95,100 ---- } ! bool group(int i, char *str, int strsize){ ! int rc = pcre_copy_substring( subject.c_str(), // Subject that has been successfully matched |
From: Alexander B. <da...@us...> - 2006-12-13 12:59:12
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7708/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** configurations.xml 13 Dec 2006 09:08:33 -0000 1.7 --- configurations.xml 13 Dec 2006 12:59:06 -0000 1.8 *************** *** 6,9 **** --- 6,10 ---- <itemPath>icesockets/csocket.h</itemPath> <itemPath>icesockets/getaddrinfo.h</itemPath> + <itemPath>icesockets/ice_rand.h</itemPath> <itemPath>icesockets/iceregex.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> *************** *** 113,116 **** --- 114,120 ---- <itemTool>3</itemTool> </item> + <item path="icesockets/ice_rand.h"> + <itemTool>3</itemTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-12-13 12:59:10
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7708 Modified Files: iceparams.h icescan.cc csubtarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** icescan.cc 13 Dec 2006 09:15:13 -0000 1.11 --- icescan.cc 13 Dec 2006 12:59:06 -0000 1.12 *************** *** 86,90 **** par->scan_type = PROT_SCAN; break; ! default: --- 86,93 ---- par->scan_type = PROT_SCAN; break; ! ! case 'F': ! par->scan_type = FIN_SCAN; ! break; default: Index: iceparams.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceparams.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iceparams.h 12 Dec 2006 20:34:03 -0000 1.5 --- iceparams.h 13 Dec 2006 12:59:06 -0000 1.6 *************** *** 11,16 **** }; ! enum Scan_type {NO_SCAN, TCP_CONNECT_SCAN, NBT_SCAN, PROT_SCAN}; ! // -S0 -ST -SB -SI --- 11,16 ---- }; ! enum Scan_type {NO_SCAN, TCP_CONNECT_SCAN, NBT_SCAN, PROT_SCAN, FIN_SCAN}; ! // -S0 -ST -SB -SI -SF *************** *** 105,112 **** void init_default_ports(){ ! const int ranges_cnt = 2; ! //int ranges[ranges_cnt][2] = { {1, 24}, {630, 632} }; ! int ranges[ranges_cnt][2] = { {1, 1024}, {3388, 3390} }; if(ports.empty()){ --- 105,112 ---- 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} }; if(ports.empty()){ Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** csubtarget.h 13 Dec 2006 09:08:33 -0000 1.12 --- csubtarget.h 13 Dec 2006 12:59:06 -0000 1.13 *************** *** 19,28 **** #define ICE_FD_SETSIZE (128) #else ! #define ICE_FD_SETSIZE (1024) #endif #define MAX_CLOSED 7 ! enum port_status { PORT_UNKNOWN = -1, PORT_OPEN = 0, PORT_CLOSED = 1, PORT_FILTERED = 2 }; class scanned_port{ --- 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{ *************** *** 105,108 **** --- 105,109 ---- if(par->scan_type == NBT_SCAN) nbt_scan(); if(par->scan_type == PROT_SCAN) prot_scan(); + if(par->scan_type == FIN_SCAN) fin_scan(); } *************** *** 135,138 **** --- 136,224 ---- } + 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); + + DBGOUTPUT("!!!"); + std::map <int, scanning_port> scanning_ports; + DBGOUTPUT("!!!"); + 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); + + + DBGOUTPUT("All ready!"); + + while(done){ + std::map <int, scanning_port>::iterator i; + + 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, 2337818902, 2337818902, TH_FIN, 0, 0, 0); + //DBGOUTPUT("!!!!"); + (*i).second.time = time(0); + + usleep(1000); + } + } + + //sleep(1); + + crawsocket rawrecv(AF_INET, (int) SOCK_RAW, IPPROTO_TCP); + //rawrecv.nonblock(true); + + int bytes; + char response[65535]; + //, remote_hostname[ICEMAXHOSTNAME]; + struct iphdr *ip = (struct iphdr *) response; + struct tcphdr *tcp; + + + for(int k = 1; k<=27; k++){ + while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL)){ + //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); + //} + //} + bzero(response, 65534); + } + } + + done = false; + } + + show_ports(); + + if(par->verbose>0) + out->line("TCP FIN scan finished."); + + scanning_ports.clear(); + } + int connect_scan(){ // connect scan, -ST *************** *** 149,153 **** init_scanning_ports(hostname, par, (int) SOCK_STREAM, scanning_ports); - if(par->verbose>0){ sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname.c_str()); --- 235,238 ---- *************** *** 156,169 **** int j = initiate_connect(scanning_ports); //DBGOUTPUT(j); ! while( ! do_select_round(scanning_ports, subtarget_ports) ) usleep(1000); show_ports(); ! if(par->verbose>0){ ! bzero(output_buf, 255); ! sprintf(output_buf, "Connect() scan finished.", hostname.c_str()); ! out->line(output_buf); ! } ! scanning_ports.clear(); } --- 241,251 ---- int j = initiate_connect(scanning_ports); //DBGOUTPUT(j); ! while( ! do_select_round_connect(scanning_ports, subtarget_ports) ) usleep(1000); show_ports(); ! if(par->verbose>0) ! out->line("Connect() scan finished."); ! scanning_ports.clear(); } *************** *** 211,214 **** --- 293,298 ---- } } + + if(domain == SOCK_RAW) return; std::map <int, scanning_port>::iterator i; *************** *** 244,247 **** --- 328,332 ---- if((*i).second.socket_ptr != -1){ //DBGOUTPUT("!!!!!"); + j = (*i).second.socket_ptr; csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); *************** *** 252,263 **** FD_SET(scan_sockets[j].sid, &fd_r); FD_SET(scan_sockets[j].sid, &fd_x); ! (*i).second.time = time(0); ! int rc = c.connect(hostname.c_str(), (*i).first, 0); ! //DBGOUTPUT("!!!!!"); ! } } return j; } void shutdown_scansocket(int j){ --- 337,373 ---- FD_SET(scan_sockets[j].sid, &fd_r); FD_SET(scan_sockets[j].sid, &fd_x); ! ! (*i).second.time = time(0); ! ! int rc = c.connect(hostname.c_str(), (*i).first, 0); ! ! } } return j; } + + 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; + } void shutdown_scansocket(int j){ *************** *** 305,326 **** FD_SET(c.get_socketid(), &fd_r); FD_SET(c.get_socketid(), &fd_x); ! scanning_ports[prt].time = time(0); //DBGOUTPUT(scanning_ports[prt].hostname); ! int rc = c.connect(hostname.c_str(), prt, 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; ! } //DBGOUTPUT("Connecting to " << prt << " using socket id " << scanning_ports[prt].c->get_socketid()); //DBGOUTPUT("!!!"); --- 415,424 ---- FD_SET(c.get_socketid(), &fd_r); FD_SET(c.get_socketid(), &fd_x); ! //DBGOUTPUT(scanning_ports[prt].hostname); ! //int rc = make_connect(&c, hostname, prt); ! c.connect(hostname.c_str(), prt, 0); ! scanning_ports[prt].time = time(0); //DBGOUTPUT("Connecting to " << prt << " using socket id " << scanning_ports[prt].c->get_socketid()); //DBGOUTPUT("!!!"); *************** *** 345,349 **** // return true if scanning_ports are empty ! bool do_select_round(std::map <int, scanning_port> &scanning_ports, std::vector<scanned_port> &subtarget_ports){ fd_set fd_rtmp, fd_wtmp, fd_xtmp; --- 443,447 ---- // return true if scanning_ports are empty ! bool do_select_round_connect(std::map <int, scanning_port> &scanning_ports, std::vector<scanned_port> &subtarget_ports){ fd_set fd_rtmp, fd_wtmp, fd_xtmp; *************** *** 392,396 **** case 0: #ifdef __CYGWIN__ ! case 1: if(false){ #else --- 490,494 ---- case 0: #ifdef __CYGWIN__ ! //case 1: if(false){ #else *************** *** 426,463 **** } ! struct scanned_port sp; ! sp.port_number = (*i).first; ! ! //DBGOUTPUT("!!!!"); ! ! sp.status = status; ! subtarget_ports.push_back(sp); ! ! //DBGOUTPUT("very well"); ! ! print_port_status(sp.port_number, status); (*i).second.done = true; shutdown_scansocket((*i).second.socket_ptr); ! (*i).second.socket_ptr = -1; ! ! //DBGOUTPUT("Erasing... :" << status); ! //scanning_ports.erase(i++); ! ! //idle_status_dispatcher(scanning_ports, get_first_idle_scanning_port(scanning_ports) ); }else{ if( ( curtime - (*i).second.time) >= CONNECT_TIMEOUT ){ ! struct scanned_port sp; ! sp.port_number = (*i).first; ! sp.status = status = PORT_FILTERED; ! subtarget_ports.push_back(sp); ! ! (*i).second.done = true; ! print_port_status((*i).first, sp.status); ! ! shutdown_scansocket((*i).second.socket_ptr); ! (*i).second.socket_ptr = -1; ! }else done &= false; } --- 524,542 ---- } ! + set_port_status((*i).first, status); (*i).second.done = true; shutdown_scansocket((*i).second.socket_ptr); ! (*i).second.socket_ptr = -1; }else{ if( ( curtime - (*i).second.time) >= CONNECT_TIMEOUT ){ ! status = PORT_FILTERED; ! ! set_port_status((*i).first, status); ! (*i).second.done = true; ! shutdown_scansocket((*i).second.socket_ptr); ! (*i).second.socket_ptr = -1; }else done &= false; } *************** *** 469,472 **** --- 548,558 ---- } + void set_port_status(int port, enum port_status status){ + struct scanned_port sp; + sp.port_number = port; + sp.status = status; + subtarget_ports.push_back(sp); + print_port_status(sp.port_number, status); + } void show_ports(){ *************** *** 532,537 **** ~csubtarget(){ //DBGOUTPUT("Entering destructor..."); - //free(hostname); - //free(reversed_hostname); free(scan_sockets); subtarget_ports.clear(); --- 618,621 ---- |
From: Alexander B. <da...@us...> - 2006-12-13 09:16:56
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27056 Removed Files: icescan Log Message: --- icescan DELETED --- |
From: Alexander B. <da...@us...> - 2006-12-13 09:15:16
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26453 Modified Files: icescan.cc Added Files: icescan Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** icescan.cc 13 Dec 2006 09:08:33 -0000 1.10 --- icescan.cc 13 Dec 2006 09:15:13 -0000 1.11 *************** *** 137,149 **** std::vector<icestring> v; ! string var, var2 = ""; ! re1.match(argv[i+1], v); ! ! DBGOUTPUT(v.size()); - //re.Consume(&input, &var, &var2) ! for (int j=0; j<v.size(); j++) { ! DBGOUTPUT(v[j]); /*struct port_range pr; --- 137,147 ---- std::vector<icestring> v; ! string var, var2 = ""; //re.Consume(&input, &var, &var2) ! do { ! re1.match(argv[i+1], v); ! DBGOUTPUT(v.size()); ! DBGOUTPUT(v[0]); /*struct port_range pr; *************** *** 156,160 **** par->ports.push_back(pr);*/ ! } exit(-1); i++; --- 154,158 ---- par->ports.push_back(pr);*/ ! }while(! re1.findNext()); exit(-1); i++; --- NEW FILE: icescan --- (This appears to be a binary file; contents omitted.) |
From: Alexander B. <da...@us...> - 2006-12-13 09:08:37
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22688/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** configurations.xml 30 Nov 2006 15:25:48 -0000 1.6 --- configurations.xml 13 Dec 2006 09:08:33 -0000 1.7 *************** *** 69,75 **** <itemTool>3</itemTool> </item> - <item path="csubtarget.h"> - <itemTool>3</itemTool> - </item> <item path="icescan.cc"> <itemTool>1</itemTool> --- 69,72 ---- *************** *** 113,116 **** --- 110,116 ---- <itemTool>3</itemTool> </item> + <item path="csubtarget.h"> + <itemTool>3</itemTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-12-13 09:08:36
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22688 Modified Files: icescan.cc ctarget.h iceservice.h csubtarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** icescan.cc 13 Dec 2006 08:34:27 -0000 1.9 --- icescan.cc 13 Dec 2006 09:08:33 -0000 1.10 *************** *** 124,141 **** case 'p': ! if(i+1 < argc){ ! if(! pcrecpp::RE("(\\d|\\,|\\-)+").FullMatch(argv[i+1]) ){ std::cout << "Invalid port range definition format." << std::endl; print_help(argv[0]); exit(1); }else{ ! pcrecpp::StringPiece input(argv[i+1]); ! ! pcrecpp::RE re("(\\d+(-\\d+)*),*"); string var, var2 = ""; ! ! while (re.Consume(&input, &var, &var2)) { ! struct port_range pr; if(var2 == ""){ --- 124,150 ---- case 'p': ! if(i+1 < argc){ ! IceRegex re1("(\\d|\\,|\\-)+"); ! if(! re1.match(argv[i+1]) ){ std::cout << "Invalid port range definition format." << std::endl; print_help(argv[0]); exit(1); }else{ ! // pcrecpp::StringPiece input(argv[i+1]); ! // pcrecpp::RE re("(\\d+(-\\d+)*),*"); ! IceRegex re("(\\d+(-\\d+)*),*"); + std::vector<icestring> v; + string var, var2 = ""; ! re1.match(argv[i+1], v); ! ! DBGOUTPUT(v.size()); ! ! ! //re.Consume(&input, &var, &var2) ! for (int j=0; j<v.size(); j++) { ! DBGOUTPUT(v[j]); ! /*struct port_range pr; if(var2 == ""){ *************** *** 146,152 **** } ! par->ports.push_back(pr); } ! i++; } --- 155,161 ---- } ! par->ports.push_back(pr);*/ } ! exit(-1); i++; } *************** *** 170,176 **** }else{ //DBGOUTPUT("Target is: " << argv[i]); ! // par->target.assign(argv[i]); ! DBGOUTPUT(par->target); } --- 179,185 ---- }else{ //DBGOUTPUT("Target is: " << argv[i]); ! par->target.assign(argv[i]); ! //DBGOUTPUT(par->target); } *************** *** 233,240 **** out << "Warn: Host(s) seems down. If it is really up, but blocking ping probes, try -P0." << iceoutput::endl; } ! ! ! DBGOUTPUT("!!!!!!!!!!"); ! if(discover) ts.scan(); --- 242,246 ---- out << "Warn: Host(s) seems down. If it is really up, but blocking ping probes, try -P0." << iceoutput::endl; } ! if(discover) ts.scan(); Index: iceservice.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceservice.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iceservice.h 30 Nov 2006 12:27:35 -0000 1.3 --- iceservice.h 13 Dec 2006 09:08:33 -0000 1.4 *************** *** 23,27 **** std::cout << "Can't open service names database!" << std::endl; } else { - #ifndef __CYGWIN__ //REGEXes don't work under windows? (segfault) while(!in.eof()){ char tmpbuf[256]; --- 23,26 ---- *************** *** 31,53 **** //DBGOUTPUT("!!!!"); ! pcrecpp::RE re1("^(#.*|\\s*)$"); //DBGOUTPUT("&&&&&"); ! if(! re1.FullMatch(tmpbuf) ){ ! //DBGOUTPUT("!!!!"); ! pcrecpp::RE re("^([-a-z1-9]+)\\s*\\W*([0-9]+)/(tcp|udp)"); ! ! icestring sname = "", protocol = ""; int port; ! pcrecpp::StringPiece input(tmpbuf); ! re.Consume(&input, &sname, &port, &protocol); ! ! if(sname == "") continue; ! //DBGOUTPUT("::" << sname << port << protocol); if(protocol == "tcp") tcp_services[port] = sname; --- 30,59 ---- //DBGOUTPUT("!!!!"); ! //pcrecpp::RE re1("^(#.*|\\s*)$"); ! IceRegex re1("^(#.*|\\s*)$"); //DBGOUTPUT("&&&&&"); ! 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)"); ! ! icestring sname = "", protocol = "", sport = ""; int port; ! //pcrecpp::StringPiece input(tmpbuf); ! //re.Consume(&input, &sname, &port, &protocol); ! ! 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; *************** *** 56,60 **** }//else DBGOUTPUT("#comment"); } - #endif } } --- 62,65 ---- Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** csubtarget.h 13 Dec 2006 08:34:27 -0000 1.11 --- csubtarget.h 13 Dec 2006 09:08:33 -0000 1.12 *************** *** 76,88 **** csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ - DBGOUTPUT("!!!!"); - struct scanned_port sp; subtarget_ports.push_back(sp); ! DBGOUTPUT("!!!!"); ! ! this->hostname.assign(hostname); this->reversed_hostname.assign(reverse_hostname); this->par = par; --- 76,84 ---- csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ struct scanned_port sp; subtarget_ports.push_back(sp); ! this->hostname.assign(hostname); this->reversed_hostname.assign(reverse_hostname); this->par = par; *************** *** 90,97 **** this->isnd = isnd; discovered = false; ! DBGOUTPUT("!!!!"); ! init_scan_sockets(); ! ! DBGOUTPUT("!!!!"); } --- 86,90 ---- this->isnd = isnd; discovered = false; ! init_scan_sockets(); } *************** *** 499,510 **** else if(open == 0 && closed <= MAX_CLOSED) show_closed = true; ! // if(strcmp(hostname, reversed_hostname)) ! // *out << "Interesting ports on " << reversed_hostname << " (" << hostname << "):" << iceoutput::endl; ! // else ! // *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; ! ! *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; ! //DBGOUTPUT(filtered); bzero(output_buf, 255); if(filtered > 0){ --- 492,501 ---- else if(open == 0 && closed <= MAX_CLOSED) show_closed = true; ! if(strcmp(hostname.c_str(), reversed_hostname.c_str())) ! *out << "Interesting ports on " << reversed_hostname << " (" << hostname << "):" << iceoutput::endl; ! else ! *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; + bzero(output_buf, 255); if(filtered > 0){ Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ctarget.h 13 Dec 2006 08:34:27 -0000 1.6 --- ctarget.h 13 Dec 2006 09:08:33 -0000 1.7 *************** *** 41,54 **** if((!is_domainname(hostname)) && par->reverse_dns){ ! get_host_byip(hostname, rev_hostname, ICEMAXHOSTNAME); }else{ rev_hostname.assign(hostname); } ! ! //DBGOUTPUT(rev_hostname); ! for(int i=0; i<st; i++){ csubtarget *cst = new csubtarget(subtargets_addresses[i].c_str(), rev_hostname.c_str(), par, out, isnd); - DBGOUTPUT(subtargets_addresses[i].c_str()); subtargets.push_back(cst); } --- 41,51 ---- if((!is_domainname(hostname)) && par->reverse_dns){ ! get_host_byip(hostname, rev_hostname); }else{ rev_hostname.assign(hostname); } ! 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); } |
From: Alexander B. <da...@us...> - 2006-12-13 09:08:36
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22688/icesockets Modified Files: iceregex.h sock_name.h Log Message: no message Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iceregex.h 13 Dec 2006 02:27:18 -0000 1.4 --- iceregex.h 13 Dec 2006 09:08:33 -0000 1.5 *************** *** 120,123 **** --- 120,124 ---- return true; } + private: bool find(icestring const& s, std::vector<icestring> &v, int start){ Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sock_name.h 13 Dec 2006 08:34:27 -0000 1.6 --- sock_name.h 13 Dec 2006 09:08:33 -0000 1.7 *************** *** 49,52 **** --- 49,58 ---- } + bool is_domainname(icestring &nisname){ + IceRegex re("\\d+\\.\\d+\\.\\d+\\.\\d+"); + return ! (re.match(nisname.c_str())); + } + + short int get_ip_byhost(const char * nisname, char * retname, int retlen){ struct hostent *h; *************** *** 102,106 **** } ! short int get_host_byip(icestring &nisname, icestring &retname, int retlen){ int rc; char hbuf[ICEMAXHOSTNAME]; --- 108,112 ---- } ! short int get_host_byip(icestring &nisname, icestring &retname){ int rc; char hbuf[ICEMAXHOSTNAME]; *************** *** 113,119 **** return -1; } ! ! //retlen = (retlen >= strlen(hbuf) + 1) ? strlen(hbuf) + 1 : retlen; ! retname.assign(hbuf); --- 119,123 ---- return -1; } ! retname.assign(hbuf); |
From: Alexander B. <da...@us...> - 2006-12-13 08:34:31
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7258/icesockets Modified Files: sock_name.h Log Message: no message Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sock_name.h 12 Dec 2006 19:59:15 -0000 1.5 --- sock_name.h 13 Dec 2006 08:34:27 -0000 1.6 *************** *** 102,111 **** } ! short int get_host_byip(const char * nisname, char * retname, int retlen){ int rc; char hbuf[ICEMAXHOSTNAME]; struct sockaddr_in saddr; ! int len = make_sockname(saddr, nisname, 53, AF_INET); if( (rc = getnameinfo((sockaddr *) &saddr, len, hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD)) < 0) { --- 102,111 ---- } ! short int get_host_byip(icestring &nisname, icestring &retname, int retlen){ int rc; char hbuf[ICEMAXHOSTNAME]; struct sockaddr_in saddr; ! int len = make_sockname(saddr, nisname.c_str(), 53, AF_INET); if( (rc = getnameinfo((sockaddr *) &saddr, len, hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD)) < 0) { *************** *** 114,120 **** } ! retlen = (retlen >= strlen(hbuf) + 1) ? strlen(hbuf) + 1 : retlen; ! strncpy(retname, hbuf, retlen); return 0; --- 114,120 ---- } ! //retlen = (retlen >= strlen(hbuf) + 1) ? strlen(hbuf) + 1 : retlen; ! retname.assign(hbuf); return 0; |
From: Alexander B. <da...@us...> - 2006-12-13 08:34:30
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7258 Modified Files: icescan.cc ctarget.h csubtarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** icescan.cc 12 Dec 2006 20:34:03 -0000 1.8 --- icescan.cc 13 Dec 2006 08:34:27 -0000 1.9 *************** *** 170,173 **** --- 170,174 ---- }else{ //DBGOUTPUT("Target is: " << argv[i]); + // par->target.assign(argv[i]); DBGOUTPUT(par->target); *************** *** 227,231 **** ftime(&tp1); - ts.add_subtargets(par.target); --- 228,231 ---- Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** csubtarget.h 13 Dec 2006 02:27:18 -0000 1.10 --- csubtarget.h 13 Dec 2006 08:34:27 -0000 1.11 *************** *** 15,19 **** #define CONNECT_TIMEOUT 7 ! #define ICE_FD_SETSIZE (128) #define MAX_CLOSED 7 --- 15,25 ---- #define CONNECT_TIMEOUT 7 ! ! #ifdef __CYGWIN__ ! #define ICE_FD_SETSIZE (128) ! #else ! #define ICE_FD_SETSIZE (1024) ! #endif ! #define MAX_CLOSED 7 *************** *** 145,151 **** ! DBGOUTPUT("!!!"); std::map <int, scanning_port> scanning_ports; ! DBGOUTPUT("!!!"); init_scanning_ports(hostname, par, (int) SOCK_STREAM, scanning_ports); --- 151,157 ---- ! //DBGOUTPUT("!!!"); std::map <int, scanning_port> scanning_ports; ! //DBGOUTPUT("!!!"); init_scanning_ports(hostname, par, (int) SOCK_STREAM, scanning_ports); *************** *** 244,248 **** //DBGOUTPUT((*i).first); if((*i).second.socket_ptr != -1){ ! DBGOUTPUT("!!!!!"); j = (*i).second.socket_ptr; csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); --- 250,254 ---- //DBGOUTPUT((*i).first); if((*i).second.socket_ptr != -1){ ! //DBGOUTPUT("!!!!!"); j = (*i).second.socket_ptr; csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); *************** *** 255,259 **** (*i).second.time = time(0); int rc = c.connect(hostname.c_str(), (*i).first, 0); ! DBGOUTPUT("!!!!!"); } } --- 261,265 ---- (*i).second.time = time(0); int rc = c.connect(hostname.c_str(), (*i).first, 0); ! //DBGOUTPUT("!!!!!"); } } *************** *** 361,366 **** tv.tv_sec = 0; tv.tv_usec = 10000; ! s = select(maxfd + 1, &fd_rtmp, &fd_wtmp, &fd_xtmp, &tv); ! //(++scanning_ports.rend())->second.c->get_socketid() err = errno; // perror("select"); DBGOUTPUT(s); --- 367,371 ---- tv.tv_sec = 0; tv.tv_usec = 10000; ! s = select(maxfd + 1, &fd_rtmp, &fd_wtmp, &fd_xtmp, &tv); err = errno; // perror("select"); DBGOUTPUT(s); *************** *** 384,388 **** FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_xtmp))){ ! // DBGOUTPUT( (*i).second.socket_ptr); csocket c(AF_INET, (int) domain, scan_sockets[(*i).second.socket_ptr].sid); --- 389,393 ---- FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_xtmp))){ ! //DBGOUTPUT( (*i).second.socket_ptr); csocket c(AF_INET, (int) domain, scan_sockets[(*i).second.socket_ptr].sid); *************** *** 390,397 **** c.getsockopt(SOL_SOCKET, SO_ERROR, (char *) &sopt, (socklen_t *) &soptlen); ! // DBGOUTPUT("!!!!"); switch(sopt){ ! case 0: #ifdef __CYGWIN__ if(false){ #else --- 395,403 ---- c.getsockopt(SOL_SOCKET, SO_ERROR, (char *) &sopt, (socklen_t *) &soptlen); ! // DBGOUTPUT("!!!!"); switch(sopt){ ! case 0: #ifdef __CYGWIN__ + case 1: if(false){ #else *************** *** 430,439 **** sp.port_number = (*i).first; ! // DBGOUTPUT("!!!!"); sp.status = status; subtarget_ports.push_back(sp); ! // DBGOUTPUT("very well"); print_port_status(sp.port_number, status); --- 436,445 ---- sp.port_number = (*i).first; ! //DBGOUTPUT("!!!!"); sp.status = status; subtarget_ports.push_back(sp); ! //DBGOUTPUT("very well"); print_port_status(sp.port_number, status); *************** *** 443,447 **** (*i).second.socket_ptr = -1; ! // DBGOUTPUT("Erasing... :" << status); //scanning_ports.erase(i++); --- 449,453 ---- (*i).second.socket_ptr = -1; ! //DBGOUTPUT("Erasing... :" << status); //scanning_ports.erase(i++); Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ctarget.h 12 Dec 2006 20:34:03 -0000 1.5 --- ctarget.h 13 Dec 2006 08:34:27 -0000 1.6 *************** *** 37,50 **** int add_subtargets(icestring hostname){ int st = get_ips_byhost(hostname.c_str(), subtargets_addresses); ! icestring rev_hostname(hostname); ! ! //if((!is_domainname(hostname)) && par->reverse_dns){ ! // get_host_byip(hostname, rev_hostname, ICEMAXHOSTNAME); ! //}else{ ! //strcpy(rev_hostname, hostname); ! //} ! ! DBGOUTPUT(rev_hostname); for(int i=0; i<st; i++){ --- 37,50 ---- int add_subtargets(icestring hostname){ int st = get_ips_byhost(hostname.c_str(), subtargets_addresses); + + icestring rev_hostname; ! if((!is_domainname(hostname)) && par->reverse_dns){ ! get_host_byip(hostname, rev_hostname, ICEMAXHOSTNAME); ! }else{ ! rev_hostname.assign(hostname); ! } ! ! //DBGOUTPUT(rev_hostname); for(int i=0; i<st; i++){ |
From: QweR <qw...@us...> - 2006-12-13 02:27:23
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1785 Modified Files: csubtarget.h Log Message: Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** csubtarget.h 12 Dec 2006 20:40:19 -0000 1.9 --- csubtarget.h 13 Dec 2006 02:27:18 -0000 1.10 *************** *** 14,19 **** #include "iceprotocol.h" ! #define CONNECT_TIMEOUT 24 ! #define ICE_FD_SETSIZE (1024) #define MAX_CLOSED 7 --- 14,19 ---- #include "iceprotocol.h" ! #define CONNECT_TIMEOUT 7 ! #define ICE_FD_SETSIZE (128) #define MAX_CLOSED 7 *************** *** 78,83 **** DBGOUTPUT("!!!!"); ! this->hostname = hostname; ! this->reversed_hostname = reverse_hostname; this->par = par; this->out = out; --- 78,83 ---- DBGOUTPUT("!!!!"); ! this->hostname.assign(hostname); ! this->reversed_hostname.assign(reverse_hostname); this->par = par; this->out = out; *************** *** 111,115 **** cprotocol_scan cps(par, out); ! //cps.test(hostname.c_str()); } --- 111,115 ---- cprotocol_scan cps(par, out); ! // cps.test(hostname.c_str()); } *************** *** 156,160 **** } int j = initiate_connect(scanning_ports); ! DBGOUTPUT(j); while( ! do_select_round(scanning_ports, subtarget_ports) ) usleep(1000); --- 156,160 ---- } int j = initiate_connect(scanning_ports); ! //DBGOUTPUT(j); while( ! do_select_round(scanning_ports, subtarget_ports) ) usleep(1000); *************** *** 180,184 **** sockets_size = ICE_FD_SETSIZE*2/3; ! scan_sockets = (struct scan_socket *) malloc(sockets_size); for(int i = 0; i < sockets_size; i++){ --- 180,184 ---- sockets_size = ICE_FD_SETSIZE*2/3; ! scan_sockets = (struct scan_socket *) malloc(sizeof(scan_socket) * (sockets_size+1)); for(int i = 0; i < sockets_size; i++){ *************** *** 242,246 **** for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ //check FD_SET ! DBGOUTPUT((*i).first); if((*i).second.socket_ptr != -1){ DBGOUTPUT("!!!!!"); --- 242,246 ---- for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ //check FD_SET ! //DBGOUTPUT((*i).first); if((*i).second.socket_ptr != -1){ DBGOUTPUT("!!!!!"); *************** *** 364,368 **** //(++scanning_ports.rend())->second.c->get_socketid() err = errno; ! //perror("select"); DBGOUTPUT(s); }while(s = -1 && err == EINTR); --- 364,368 ---- //(++scanning_ports.rend())->second.c->get_socketid() err = errno; ! // perror("select"); DBGOUTPUT(s); }while(s = -1 && err == EINTR); *************** *** 373,377 **** if((*i).second.done) continue; - if( (*i).second.socket_ptr == -1){ idle_status_dispatcher(scanning_ports, (*i).first); --- 373,376 ---- *************** *** 379,392 **** continue; } - enum port_status status = PORT_UNKNOWN; - - if(s >= 0 && (FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_rtmp) || FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_wtmp) || FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_xtmp))){ ! DBGOUTPUT( (*i).second.socket_ptr); csocket c(AF_INET, (int) domain, scan_sockets[(*i).second.socket_ptr].sid); --- 378,388 ---- continue; } enum port_status status = PORT_UNKNOWN; if(s >= 0 && (FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_rtmp) || FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_wtmp) || FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_xtmp))){ ! // DBGOUTPUT( (*i).second.socket_ptr); csocket c(AF_INET, (int) domain, scan_sockets[(*i).second.socket_ptr].sid); *************** *** 394,408 **** c.getsockopt(SOL_SOCKET, SO_ERROR, (char *) &sopt, (socklen_t *) &soptlen); ! DBGOUTPUT("!!!!"); ! ! switch(sopt){ ! case 0: if(FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_r)){ status = PORT_OPEN; }else{ ! DBGOUTPUT("WRITE"); usleep(20000); res = c.write("", 0, 0); ! DBGOUTPUT("/WRITE" << res); if(res < 0){ status = PORT_CLOSED; --- 390,407 ---- c.getsockopt(SOL_SOCKET, SO_ERROR, (char *) &sopt, (socklen_t *) &soptlen); ! // DBGOUTPUT("!!!!"); ! switch(sopt){ ! case 0: ! #ifdef __CYGWIN__ ! if(false){ ! #else if(FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_r)){ status = PORT_OPEN; + #endif }else{ ! //DBGOUTPUT("WRITE"); usleep(20000); res = c.write("", 0, 0); ! //DBGOUTPUT("/WRITE" << res); if(res < 0){ status = PORT_CLOSED; *************** *** 431,440 **** sp.port_number = (*i).first; ! DBGOUTPUT("!!!!"); sp.status = status; subtarget_ports.push_back(sp); ! DBGOUTPUT("very well"); print_port_status(sp.port_number, status); --- 430,439 ---- sp.port_number = (*i).first; ! // DBGOUTPUT("!!!!"); sp.status = status; subtarget_ports.push_back(sp); ! // DBGOUTPUT("very well"); print_port_status(sp.port_number, status); *************** *** 444,448 **** (*i).second.socket_ptr = -1; ! DBGOUTPUT("Erasing... :" << status); //scanning_ports.erase(i++); --- 443,447 ---- (*i).second.socket_ptr = -1; ! // DBGOUTPUT("Erasing... :" << status); //scanning_ports.erase(i++); |
From: QweR <qw...@us...> - 2006-12-13 02:27:23
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1785/icesockets Modified Files: iceregex.h Log Message: Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iceregex.h 30 Nov 2006 15:25:48 -0000 1.3 --- iceregex.h 13 Dec 2006 02:27:18 -0000 1.4 *************** *** 60,65 **** ovector_ = new int[3*(capture_count_+1)]; } ! bool match(icestring const& s, std::vector<icestring> &v){ int rc = pcre_exec ( pcre_, /* the compiled pattern */ --- 60,125 ---- ovector_ = new int[3*(capture_count_+1)]; } ! bool match(icestring const& s, std::vector<icestring> &v){ + subject.assign(s); + int res = find(s, v, 0); + if(res) findPoint = ovector_[0]+1; + else findPoint = 0; + return res; + } + + bool match(icestring const& s){ + std::vector<icestring> v; + return match(s, v); + } + + bool match(const char s[]){ + icestring is(s); + return match(is); + } + + bool findNext(){ + std::vector<icestring> v; + if(findPoint >= subject.length()) return false; + int res = find(subject, v, findPoint); + if(res) findPoint = ovector_[0]+1; + return res; + } + + void findReset(){ + findPoint = 0; + } + + int groups(){ + return pcre_result_; + } + + bool group(int i, char *str, int strsize){ + int rc = pcre_copy_substring( + subject.c_str(), // Subject that has been successfully matched + ovector_, // Offset vector that pcre_exec() used + pcre_result_, // Value returned by pcre_exec() + i, // Number of the required substring + str, // Buffer to receive the string + strsize // Size of buffer + ); + if(rc<0){ + icestring aaa; + switch(rc){ + case PCRE_ERROR_NOMEMORY: aaa.assign("PCRE_ERROR_NOMEMORY"); break; + case PCRE_ERROR_NOSUBSTRING: aaa.assign("PCRE_ERROR_NOSUBSTRING"); break; + default: + char tmp[10]; + sprintf(tmp, "%6d", rc); + aaa.assign(tmp); + } + std::cout << "IceRegex error: " << aaa << std::endl; + exit(-1); + return false; + } + return true; + } + private: + bool find(icestring const& s, std::vector<icestring> &v, int start){ int rc = pcre_exec ( pcre_, /* the compiled pattern */ *************** *** 67,75 **** s.c_str(), /* the string to match */ s.length(), /* the length of the string */ ! 0, /* start at offset 0 in the subject */ 0, /* default options */ ovector_, /* output vector for substring information */ 3*(capture_count_+1)); /* number of elements in the output vector */ ! if (rc < 0) { switch (rc) { --- 127,136 ---- s.c_str(), /* the string to match */ s.length(), /* the length of the string */ ! start, /* start at offset 0 in the subject */ 0, /* default options */ ovector_, /* output vector for substring information */ 3*(capture_count_+1)); /* number of elements in the output vector */ ! ! pcre_result_ = rc; if (rc < 0) { switch (rc) { *************** *** 91,110 **** } - bool match(icestring const& s){ - std::vector<icestring> v; - return match(s, v); - } - - bool match(const char s[]){ - icestring is(s); - return match(is); - } - private: pcre* pcre_; unsigned long int capture_count_; icestring pattern; int* ovector_; //UGLY }; --- 152,164 ---- } private: pcre* pcre_; unsigned long int capture_count_; icestring pattern; + icestring subject; int* ovector_; //UGLY + int pcre_result_; + int findPoint; }; |
From: Alexander B. <da...@us...> - 2006-12-12 20:40:29
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12944/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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sock_types.h 30 Nov 2006 15:13:05 -0000 1.2 --- sock_types.h 12 Dec 2006 20:40:19 -0000 1.3 *************** *** 140,148 **** #ifdef KERNEL ! void icmp_error __P((struct mbuf *, int, int, n_long, struct ifnet *)); ! void icmp_input __P((struct mbuf *, int)); ! void icmp_reflect __P((struct mbuf *)); ! void icmp_send __P((struct mbuf *, struct mbuf *)); ! int icmp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); #endif --- 140,148 ---- #ifdef KERNEL ! void icmp_error __P((struct mbuf *, int, int, n_long, struct ifnet *)); ! void icmp_input __P((struct mbuf *, int)); ! void icmp_reflect __P((struct mbuf *)); ! void icmp_send __P((struct mbuf *, struct mbuf *)); ! int icmp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); #endif Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** csocket.h 30 Nov 2006 15:13:05 -0000 1.5 --- csocket.h 12 Dec 2006 20:40:19 -0000 1.6 *************** *** 197,203 **** } ! int sendto(char *hostname, int port, const void *msg, int len, unsigned int flags){ struct addrinfo hints, *res; ! int salen; char cportbuf[8]; char *cport = cportbuf; --- 197,203 ---- } ! int sendto(const char *hostname, int port, const void *msg, int len, unsigned int flags){ struct addrinfo hints, *res; ! int salen; char cportbuf[8]; char *cport = cportbuf; |
From: Alexander B. <da...@us...> - 2006-12-12 20:40:25
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12944 Modified Files: nbt_wrapper.h icediscover.h csubtarget.h Log Message: no message Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** csubtarget.h 12 Dec 2006 20:33:24 -0000 1.8 --- csubtarget.h 12 Dec 2006 20:40:19 -0000 1.9 *************** *** 111,115 **** cprotocol_scan cps(par, out); ! cps.test(hostname.c_str()); } --- 111,115 ---- cprotocol_scan cps(par, out); ! //cps.test(hostname.c_str()); } Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** icediscover.h 29 Nov 2006 12:51:01 -0000 1.3 --- icediscover.h 12 Dec 2006 20:40:19 -0000 1.4 *************** *** 21,25 **** }; ! bool tcp_ack_ping(char *hostname, iceparams *par, iceoutput *out){ csocket s(AF_INET, (int) SOCK_STREAM); --- 21,25 ---- }; ! bool tcp_ack_ping(const char *hostname, iceparams *par, iceoutput *out){ csocket s(AF_INET, (int) SOCK_STREAM); *************** *** 77,81 **** } ! bool icmp_echo_ping(char *hostname, iceparams *par, iceoutput *out){ if(!getuid()){ --- 77,82 ---- } ! bool icmp_echo_ping(const char *hostname, iceparams *par, iceoutput *out){ ! char *t_hostname = (char *) malloc(strlen(hostname) + 1); if(!getuid()){ *************** *** 94,98 **** struct discover_thread_params dtp; ! dtp.hostname = hostname; dtp.par = par; dtp.out = out; --- 95,99 ---- struct discover_thread_params dtp; ! dtp.hostname = t_hostname; dtp.par = par; dtp.out = out; *************** *** 118,122 **** 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)..."); return true; } --- 119,124 ---- 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; } *************** *** 129,132 **** --- 131,136 ---- out->line("UID isn't 0, so can't create raw socket => no ICMP ping..."); + free(t_hostname); + return false; } *************** *** 134,138 **** ! bool host_discover(char *hostname, iceparams *par, iceoutput *out){ if(par->verbose>0) --- 138,142 ---- ! bool host_discover(const char *hostname, iceparams *par, iceoutput *out){ if(par->verbose>0) Index: nbt_wrapper.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbt_wrapper.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** nbt_wrapper.h 28 Nov 2006 17:57:54 -0000 1.1 --- nbt_wrapper.h 12 Dec 2006 20:40:19 -0000 1.2 *************** *** 198,202 **** } ! int test(char *hostname, int port){ char message[NBT_MSGSIZE]; char local_hostname[80]; --- 198,202 ---- } ! int test(const char *hostname, int port){ char message[NBT_MSGSIZE]; char local_hostname[80]; *************** *** 255,259 **** ! int v_print_hostinfo(char *hostname, const struct nb_host_info* hostinfo, int v) { int i, unique; my_uint8_t service; --- 255,259 ---- ! int v_print_hostinfo(const char *hostname, const struct nb_host_info* hostinfo, int v) { int i, unique; my_uint8_t service; *************** *** 291,295 **** } ! int send_query(csocket &sock, char *hostname, int port, my_uint32_t rtt_base) { struct nbname_request request; --- 291,295 ---- } ! int send_query(csocket &sock, const char *hostname, int port, my_uint32_t rtt_base) { struct nbname_request request; |
From: QweR <qw...@us...> - 2006-12-12 20:34:16
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10094 Modified Files: csubtarget.h Log Message: Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** csubtarget.h 12 Dec 2006 20:07:50 -0000 1.7 --- csubtarget.h 12 Dec 2006 20:33:24 -0000 1.8 *************** *** 34,41 **** class scanning_port{ public: - char hostname[24]; int port_number; bool done; ! long time; int socket_ptr; }; --- 34,40 ---- class scanning_port{ public: int port_number; bool done; ! long time; int socket_ptr; }; *************** *** 69,73 **** std::vector<scanned_port> subtarget_ports; ! csubtarget(const char *hostname, const char *reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ DBGOUTPUT("!!!!"); --- 68,72 ---- std::vector<scanned_port> subtarget_ports; ! csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ DBGOUTPUT("!!!!"); *************** *** 79,86 **** DBGOUTPUT("!!!!"); ! this->hostname = (char *) malloc(strlen(hostname) + 1); ! strcpy(this->hostname, hostname); ! this->reversed_hostname = (char *) malloc(strlen(reverse_hostname) + 1); ! strcpy(this->reversed_hostname, reverse_hostname); this->par = par; this->out = out; --- 78,83 ---- DBGOUTPUT("!!!!"); ! this->hostname = hostname; ! this->reversed_hostname = reverse_hostname; this->par = par; this->out = out; *************** *** 97,101 **** ftime(&tp1); ! discovered = host_discover(hostname, par, out); ftime(&tp2); --- 94,98 ---- ftime(&tp1); ! discovered = host_discover(hostname.c_str(), par, out); ftime(&tp2); *************** *** 114,118 **** cprotocol_scan cps(par, out); ! cps.test(hostname); } --- 111,115 ---- cprotocol_scan cps(par, out); ! cps.test(hostname.c_str()); } *************** *** 123,127 **** if(par->verbose>0){ ! sprintf(output_buf, "Starting NetBIOS scan against %s...", hostname); out->line(output_buf); } --- 120,124 ---- if(par->verbose>0){ ! sprintf(output_buf, "Starting NetBIOS scan against %s...", hostname.c_str()); out->line(output_buf); } *************** *** 129,137 **** cnbtwrapper wrap(par); ! wrap.test(hostname, 137); if(par->verbose>0){ bzero(output_buf, 255); ! sprintf(output_buf, "NetBIOS scan finished.", hostname); out->line(output_buf); } --- 126,134 ---- cnbtwrapper wrap(par); ! wrap.test(hostname.c_str(), 137); if(par->verbose>0){ bzero(output_buf, 255); ! sprintf(output_buf, "NetBIOS scan finished.", hostname.c_str()); out->line(output_buf); } *************** *** 155,162 **** if(par->verbose>0){ ! sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname); out->line(output_buf); } - int j = initiate_connect(scanning_ports); DBGOUTPUT(j); --- 152,158 ---- if(par->verbose>0){ ! sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname.c_str()); out->line(output_buf); } int j = initiate_connect(scanning_ports); DBGOUTPUT(j); *************** *** 167,171 **** if(par->verbose>0){ bzero(output_buf, 255); ! sprintf(output_buf, "Connect() scan finished.", hostname); out->line(output_buf); } --- 163,167 ---- if(par->verbose>0){ bzero(output_buf, 255); ! sprintf(output_buf, "Connect() scan finished.", hostname.c_str()); out->line(output_buf); } *************** *** 203,207 **** } ! void init_scanning_ports(char *hostname, iceparams *par, int domain, std::map <int, scanning_port> &scanning_ports){ for(int j = 0; j<par->ports.size(); j++){ port_range pr = par->ports[j]; --- 199,203 ---- } ! void init_scanning_ports(icestring hostname, iceparams *par, int domain, std::map <int, scanning_port> &scanning_ports){ for(int j = 0; j<par->ports.size(); j++){ port_range pr = par->ports[j]; *************** *** 212,216 **** sp.port_number = i; scanning_ports[i] = sp; - strcpy(scanning_ports[i].hostname, hostname); scanning_ports[i].done = false; } --- 208,211 ---- *************** *** 259,263 **** FD_SET(scan_sockets[j].sid, &fd_x); (*i).second.time = time(0); ! int rc = c.connect((*i).second.hostname, (*i).first, 0); DBGOUTPUT("!!!!!"); } --- 254,258 ---- FD_SET(scan_sockets[j].sid, &fd_x); (*i).second.time = time(0); ! int rc = c.connect(hostname.c_str(), (*i).first, 0); DBGOUTPUT("!!!!!"); } *************** *** 313,317 **** scanning_ports[prt].time = time(0); //DBGOUTPUT(scanning_ports[prt].hostname); ! int rc = c.connect(scanning_ports[prt].hostname, prt, 0); switch(rc){ --- 308,312 ---- scanning_ports[prt].time = time(0); //DBGOUTPUT(scanning_ports[prt].hostname); ! int rc = c.connect(hostname.c_str(), prt, 0); switch(rc){ *************** *** 339,349 **** if(ps == PORT_OPEN && par->verbose >= 1){ ! sprintf(output_buf, "Discovered open port %d/tcp on %s.", port, hostname); out->line(output_buf); }else if(ps == PORT_CLOSED && par->verbose > 1){ ! sprintf(output_buf, "Discovered closed port %d/tcp on %s.", port, hostname); out->line(output_buf); }else if(ps == PORT_FILTERED && par->verbose > 2){ ! sprintf(output_buf, "Discovered filtered port %d/tcp on %s.", port, hostname); out->line(output_buf); } --- 334,344 ---- if(ps == PORT_OPEN && par->verbose >= 1){ ! sprintf(output_buf, "Discovered open port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); }else if(ps == PORT_CLOSED && par->verbose > 1){ ! sprintf(output_buf, "Discovered closed port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); }else if(ps == PORT_FILTERED && par->verbose > 2){ ! sprintf(output_buf, "Discovered filtered port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); } *************** *** 388,391 **** --- 383,387 ---- enum port_status status = PORT_UNKNOWN; + if(s >= 0 && (FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_rtmp) || FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_wtmp) || *************** *** 399,403 **** DBGOUTPUT("!!!!"); ! switch(sopt){ case 0: --- 395,399 ---- DBGOUTPUT("!!!!"); ! switch(sopt){ case 0: *************** *** 498,506 **** else if(open == 0 && closed <= MAX_CLOSED) show_closed = true; ! if(strcmp(hostname, reversed_hostname)) ! *out << "Interesting ports on " << reversed_hostname << " (" << hostname << "):" << iceoutput::endl; ! else ! *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; //DBGOUTPUT(filtered); --- 494,503 ---- else if(open == 0 && closed <= MAX_CLOSED) show_closed = true; ! // if(strcmp(hostname, reversed_hostname)) ! // *out << "Interesting ports on " << reversed_hostname << " (" << hostname << "):" << iceoutput::endl; ! // else ! // *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; + *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; //DBGOUTPUT(filtered); *************** *** 539,544 **** ~csubtarget(){ //DBGOUTPUT("Entering destructor..."); ! free(hostname); ! free(reversed_hostname); free(scan_sockets); subtarget_ports.clear(); --- 536,541 ---- ~csubtarget(){ //DBGOUTPUT("Entering destructor..."); ! //free(hostname); ! //free(reversed_hostname); free(scan_sockets); subtarget_ports.clear(); |