javanetsim-cvs Mailing List for javaNetSim (Page 19)
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-12 20:34:07
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10225 Modified Files: iceparams.h icescan.cc ctarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** icescan.cc 12 Dec 2006 19:59:15 -0000 1.7 --- icescan.cc 12 Dec 2006 20:34:03 -0000 1.8 *************** *** 169,175 **** } }else{ ! // DBGOUTPUT("Target is: " << argv[i]); ! par->target = (char *) malloc( strlen(argv[i]) ); ! strcpy(par->target, argv[i]); } --- 169,175 ---- } }else{ ! //DBGOUTPUT("Target is: " << argv[i]); ! par->target.assign(argv[i]); ! DBGOUTPUT(par->target); } *************** *** 218,222 **** par.by_default_init(); ! if(par.target == NULL){ out << "No target hosts/networks specified!" << iceoutput::endl; return 1; --- 218,222 ---- par.by_default_init(); ! if(par.target.empty()){ out << "No target hosts/networks specified!" << iceoutput::endl; return 1; Index: iceparams.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceparams.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iceparams.h 12 Dec 2006 19:59:15 -0000 1.4 --- iceparams.h 12 Dec 2006 20:34:03 -0000 1.5 *************** *** 27,31 **** // Target ! char *target; // PreScan settings --- 27,31 ---- // Target ! icestring target; // PreScan settings *************** *** 92,96 **** } ! ~iceparams(){ delete target; } void by_default_init(){ --- 92,96 ---- } ! ~iceparams(){ } void by_default_init(){ Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ctarget.h 12 Dec 2006 19:59:15 -0000 1.4 --- ctarget.h 12 Dec 2006 20:34:03 -0000 1.5 *************** *** 35,40 **** } ! int add_subtargets(char *hostname){ ! int st = get_ips_byhost(hostname, subtargets_addresses); icestring rev_hostname(hostname); --- 35,40 ---- } ! int add_subtargets(icestring hostname){ ! int st = get_ips_byhost(hostname.c_str(), subtargets_addresses); icestring rev_hostname(hostname); |
From: Alexander B. <da...@us...> - 2006-12-12 20:07:59
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32107 Modified Files: csubtarget.h Log Message: no message Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** csubtarget.h 12 Dec 2006 19:59:15 -0000 1.6 --- csubtarget.h 12 Dec 2006 20:07:50 -0000 1.7 *************** *** 48,54 **** iceparams *par; ! char *hostname; ! char *reversed_hostname; ice_service_name_database *isnd; --- 48,54 ---- iceparams *par; ! icestring hostname; ! icestring reversed_hostname; ice_service_name_database *isnd; *************** *** 150,153 **** --- 150,154 ---- DBGOUTPUT("!!!"); std::map <int, scanning_port> scanning_ports; + DBGOUTPUT("!!!"); init_scanning_ports(hostname, par, (int) SOCK_STREAM, scanning_ports); *************** *** 159,163 **** int j = initiate_connect(scanning_ports); ! //DBGOUTPUT(j); while( ! do_select_round(scanning_ports, subtarget_ports) ) usleep(1000); --- 160,164 ---- int j = initiate_connect(scanning_ports); ! DBGOUTPUT(j); while( ! do_select_round(scanning_ports, subtarget_ports) ) usleep(1000); *************** *** 244,249 **** --- 245,253 ---- int j; + for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ //check FD_SET + 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); *************** *** 256,260 **** (*i).second.time = time(0); int rc = c.connect((*i).second.hostname, (*i).first, 0); ! } } --- 260,264 ---- (*i).second.time = time(0); int rc = c.connect((*i).second.hostname, (*i).first, 0); ! DBGOUTPUT("!!!!!"); } } |
From: Alexander B. <da...@us...> - 2006-12-12 19:59:22
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv28891 Modified Files: iceparams.h icescan.cc ctarget.h icedebug.h csubtarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** icescan.cc 30 Nov 2006 12:27:35 -0000 1.6 --- icescan.cc 12 Dec 2006 19:59:15 -0000 1.7 *************** *** 169,173 **** } }else{ ! //DBGOUTPUT("Target is: " << argv[i]); par->target = (char *) malloc( strlen(argv[i]) ); strcpy(par->target, argv[i]); --- 169,173 ---- } }else{ ! // DBGOUTPUT("Target is: " << argv[i]); par->target = (char *) malloc( strlen(argv[i]) ); strcpy(par->target, argv[i]); *************** *** 227,230 **** --- 227,231 ---- ftime(&tp1); + ts.add_subtargets(par.target); *************** *** 233,236 **** --- 234,240 ---- } + + DBGOUTPUT("!!!!!!!!!!"); + if(discover) ts.scan(); Index: iceparams.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceparams.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iceparams.h 30 Nov 2006 06:43:50 -0000 1.3 --- iceparams.h 12 Dec 2006 19:59:15 -0000 1.4 *************** *** 105,111 **** void init_default_ports(){ ! const int ranges_cnt = 1; ! int ranges[ranges_cnt][2] = { {1, 1024} }; if(ports.empty()){ --- 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()){ Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** csubtarget.h 30 Nov 2006 06:43:50 -0000 1.5 --- csubtarget.h 12 Dec 2006 19:59:15 -0000 1.6 *************** *** 5,8 **** --- 5,9 ---- #include <cstdlib> #include <map> + #include <vector> #include <errno.h> #include <pthread.h> *************** *** 19,23 **** enum port_status { PORT_UNKNOWN = -1, PORT_OPEN = 0, PORT_CLOSED = 1, PORT_FILTERED = 2 }; ! struct scanned_port{ public: int port_number; --- 20,24 ---- enum port_status { PORT_UNKNOWN = -1, PORT_OPEN = 0, PORT_CLOSED = 1, PORT_FILTERED = 2 }; ! class scanned_port{ public: int port_number; *************** *** 25,36 **** }; ! class scan_socket{ ! public: ! csocket *c; ! bool busy; ! ! scan_socket(){ ! c = NULL; ! } }; --- 26,33 ---- }; ! struct scan_socket{ ! int sid; ! bool busy; ! int domain; }; *************** *** 39,55 **** char hostname[24]; int port_number; - csocket *c; bool done; long time; int socket_ptr; - - scanning_port(){ - c = NULL; - } }; class csubtarget{ ! iceoutput *out; --- 36,47 ---- char hostname[24]; int port_number; bool done; long time; int socket_ptr; }; class csubtarget{ ! iceoutput *out; *************** *** 61,64 **** --- 53,65 ---- ice_service_name_database *isnd; + + // *****scan parameters***** + bool raw; + + int domain; + + struct scan_socket* scan_sockets; + + // *****scan parameters***** public: *************** *** 68,72 **** std::vector<scanned_port> subtarget_ports; ! csubtarget(char *hostname, char *reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ this->hostname = (char *) malloc(strlen(hostname) + 1); strcpy(this->hostname, hostname); --- 69,82 ---- std::vector<scanned_port> subtarget_ports; ! csubtarget(const char *hostname, const char *reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ ! ! DBGOUTPUT("!!!!"); ! ! struct scanned_port sp; ! ! subtarget_ports.push_back(sp); ! ! DBGOUTPUT("!!!!"); ! this->hostname = (char *) malloc(strlen(hostname) + 1); strcpy(this->hostname, hostname); *************** *** 77,81 **** --- 87,94 ---- this->isnd = isnd; discovered = false; + DBGOUTPUT("!!!!"); init_scan_sockets(); + + DBGOUTPUT("!!!!"); } *************** *** 130,138 **** char output_buf[255]; ! ! //DBGOUTPUT("!!!"); std::map <int, scanning_port> scanning_ports; init_scanning_ports(hostname, par, (int) SOCK_STREAM, scanning_ports); if(par->verbose>0){ sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname); --- 143,156 ---- char output_buf[255]; ! ! raw = false; ! domain = (int) SOCK_STREAM; ! ! ! DBGOUTPUT("!!!"); std::map <int, scanning_port> scanning_ports; init_scanning_ports(hostname, par, (int) SOCK_STREAM, scanning_ports); + if(par->verbose>0){ sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname); *************** *** 158,180 **** fd_set fd_r, fd_w, fd_x; - std::vector<scan_socket> scan_sockets; int free_sockets; int maxfd; void init_scan_sockets(){ ! for(int i = 0; i< ICE_FD_SETSIZE*2/3; i++){ ! struct scan_socket st; ! st.c = NULL; ! st.busy = false; ! scan_sockets.push_back(st); ! } ! free_sockets = 0; } int get_first_free_socket(){ int f; ! ! for(f = 0; f < scan_sockets.size(); f++) ! if(!scan_sockets.at(f).busy && scan_sockets.at(f).c == NULL) return f; --- 176,200 ---- fd_set fd_r, fd_w, fd_x; int free_sockets; int maxfd; + int sockets_size; void init_scan_sockets(){ ! sockets_size = ICE_FD_SETSIZE*2/3; ! ! scan_sockets = (struct scan_socket *) malloc(sockets_size); ! ! for(int i = 0; i < sockets_size; i++){ ! scan_sockets[i].busy = false; ! scan_sockets[i].sid = -1; ! } ! free_sockets = sockets_size; } int get_first_free_socket(){ int f; ! ! for(f = 0; f < sockets_size; f++) ! if(!scan_sockets[f].busy && scan_sockets[f].sid < 0) return f; *************** *** 201,215 **** for(i = scanning_ports.begin(), j = 0; i!= scanning_ports.end(); ++i, j++){ ! if(j < scan_sockets.size()){ ! scan_sockets[j].c = new csocket(AF_INET, domain); ! (*i).second.c = scan_sockets[j].c; ! maxfd = scan_sockets[j].c->get_socketid(); ! scan_sockets[j].busy = true; (*i).second.socket_ptr = j; }else{ ! (*i).second.c = NULL; ! (*i).second.socket_ptr = -1; } } } --- 221,237 ---- for(i = scanning_ports.begin(), j = 0; i!= scanning_ports.end(); ++i, j++){ ! if(j < sockets_size){ ! csocket c(AF_INET, domain); ! scan_sockets[j].domain = domain; ! scan_sockets[j].sid = c.get_socketid(); ! maxfd = scan_sockets[j].sid; ! scan_sockets[j].busy = true; (*i).second.socket_ptr = j; + free_sockets--; }else{ ! (*i).second.socket_ptr = -1; } } + } *************** *** 223,237 **** for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ //check FD_SET ! if((*i).second.c != NULL){ ! ! (*i).second.c->nonblock(true); ! ! FD_SET((*i).second.c->get_socketid(), &fd_w); ! FD_SET((*i).second.c->get_socketid(), &fd_r); ! FD_SET((*i).second.c->get_socketid(), &fd_x); (*i).second.time = time(0); ! int rc = (*i).second.c->connect((*i).second.hostname, (*i).first, 0); ! free_sockets--; ! } } --- 245,260 ---- for(i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ //check FD_SET ! if((*i).second.socket_ptr != -1){ ! j = (*i).second.socket_ptr; ! csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); ! ! c.nonblock(true); ! ! FD_SET(scan_sockets[j].sid, &fd_w); ! 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((*i).second.hostname, (*i).first, 0); ! } } *************** *** 240,260 **** } ! void shutdown_scansocket(csocket *c, int ptr){ ! //DBGOUTPUT("ptr = " << ptr); ! FD_CLR(c->get_socketid(), &fd_w); ! FD_CLR(c->get_socketid(), &fd_r); ! FD_CLR(c->get_socketid(), &fd_x); ! //DBGOUTPUT(c->get_socketid() << " shutdowned."); ! ! c->shutdown(); ! c->close(); ! ! delete c; ! free_sockets++; ! scan_sockets[ptr].busy = false; ! scan_sockets[ptr].c = NULL; ! //DBGOUTPUT("Freeing socket " << ptr); } --- 263,279 ---- } ! void shutdown_scansocket(int j){ ! csocket c(AF_INET, scan_sockets[j].domain, scan_sockets[j].sid); ! ! FD_CLR(c.get_socketid(), &fd_w); ! FD_CLR(c.get_socketid(), &fd_r); ! FD_CLR(c.get_socketid(), &fd_x); ! c.shutdown(); ! c.close(); ! free_sockets++; ! scan_sockets[j].busy = false; ! scan_sockets[j].sid = -1; } *************** *** 265,269 **** for(i = --scanning_ports.end(); i!= scanning_ports.begin(); --i){ ! if((*i).second.c == NULL && (! (*i).second.done)) return (*i).first; } --- 284,288 ---- for(i = --scanning_ports.end(); i!= scanning_ports.begin(); --i){ ! if((*i).second.socket_ptr == -1 && (! (*i).second.done)) return (*i).first; } *************** *** 274,296 **** void idle_status_dispatcher(std::map <int, scanning_port> &scanning_ports, int prt){ ! if(prt>=0 && free_sockets < 1){ ! int f = get_first_free_socket(); ! //DBGOUTPUT(f << " " << free_sockets); if(f < 0) return; ! //if(scan_sockets[f].c ) return; ! scan_sockets[f].c = new csocket(AF_INET, (int) SOCK_STREAM); scan_sockets[f].busy = true; ! scanning_ports[prt].c = scan_sockets[f].c; free_sockets--; - scanning_ports[prt].socket_ptr = f; //DBGOUTPUT(prt); ! scanning_ports[prt].c->nonblock(true); //DBGOUTPUT("!!!"); ! FD_SET(scanning_ports[prt].c->get_socketid(), &fd_w); ! FD_SET(scanning_ports[prt].c->get_socketid(), &fd_r); ! FD_SET(scanning_ports[prt].c->get_socketid(), &fd_x); scanning_ports[prt].time = time(0); //DBGOUTPUT(scanning_ports[prt].hostname); ! int rc = scanning_ports[prt].c->connect(scanning_ports[prt].hostname, prt, 0); switch(rc){ --- 293,313 ---- void idle_status_dispatcher(std::map <int, scanning_port> &scanning_ports, int prt){ ! if(prt>=0 && free_sockets > 1){ ! int f = get_first_free_socket(); if(f < 0) return; ! csocket c(AF_INET, (int) domain); ! scan_sockets[f].sid = c.get_socketid(); scan_sockets[f].busy = true; ! scanning_ports[prt].socket_ptr = f; free_sockets--; //DBGOUTPUT(prt); ! c.nonblock(true); //DBGOUTPUT("!!!"); ! FD_SET(c.get_socketid(), &fd_w); ! 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(scanning_ports[prt].hostname, prt, 0); switch(rc){ *************** *** 358,362 **** if((*i).second.done) continue; ! if( (*i).second.c == NULL){ idle_status_dispatcher(scanning_ports, (*i).first); done = false; --- 375,379 ---- if((*i).second.done) continue; ! if( (*i).second.socket_ptr == -1){ idle_status_dispatcher(scanning_ports, (*i).first); done = false; *************** *** 364,386 **** } enum port_status status = PORT_UNKNOWN; ! //DBGOUTPUT("..."); ! if(s >= 0 && (FD_ISSET((*i).second.c->get_socketid(), &fd_rtmp) || ! FD_ISSET((*i).second.c->get_socketid(), &fd_wtmp) || ! FD_ISSET((*i).second.c->get_socketid(), &fd_xtmp))){ ! (*i).second.c->getsockopt(SOL_SOCKET, SO_ERROR, (char *) &sopt, (socklen_t *) &soptlen); switch(sopt){ case 0: ! if(FD_ISSET((*i).second.c->get_socketid(), &fd_r)){ status = PORT_OPEN; }else{ ! //DBGOUTPUT("WRITE"); usleep(20000); ! res = (*i).second.c->write("", 0, 0); ! //DBGOUTPUT("/WRITE" << res); if(res < 0){ status = PORT_CLOSED; --- 381,408 ---- } + 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); ! 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; *************** *** 405,421 **** status = PORT_UNKNOWN; } ! struct scanned_port sp; sp.port_number = (*i).first; sp.status = status; subtarget_ports.push_back(sp); ! ! print_port_status((*i).first, status); ! (*i).second.done = true; ! shutdown_scansocket((*i).second.c, (*i).second.socket_ptr); ! (*i).second.c = NULL; ! //DBGOUTPUT("Erasing... :" << status); //scanning_ports.erase(i++); --- 427,448 ---- status = PORT_UNKNOWN; } ! 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++); *************** *** 432,439 **** print_port_status((*i).first, sp.status); ! shutdown_scansocket((*i).second.c, (*i).second.socket_ptr); ! (*i).second.c = NULL; ! //scanning_ports.erase(i++); ! //idle_status_dispatcher(scanning_ports, get_first_idle_scanning_port(scanning_ports)); }else done &= false; --- 459,464 ---- print_port_status((*i).first, sp.status); ! shutdown_scansocket((*i).second.socket_ptr); ! (*i).second.socket_ptr = -1; }else done &= false; *************** *** 512,516 **** free(hostname); free(reversed_hostname); ! scan_sockets.clear(); subtarget_ports.clear(); //DBGOUTPUT("Leaving destructor..."); --- 537,541 ---- free(hostname); free(reversed_hostname); ! free(scan_sockets); subtarget_ports.clear(); //DBGOUTPUT("Leaving destructor..."); Index: icedebug.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icedebug.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** icedebug.h 28 Nov 2006 17:57:54 -0000 1.1 --- icedebug.h 12 Dec 2006 19:59:15 -0000 1.2 *************** *** 4,8 **** #include <iostream> ! #define DBGOUTPUT(TEXT) std::cout << TEXT << std::endl #endif --- 4,8 ---- #include <iostream> ! #define DBGOUTPUT(TEXT) std::cout << __FILE__ << " " << __LINE__ << ": " << TEXT << std::endl #endif Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ctarget.h 30 Nov 2006 06:43:50 -0000 1.3 --- ctarget.h 12 Dec 2006 19:59:15 -0000 1.4 *************** *** 13,17 **** std::vector <csubtarget *> subtargets; //subtargets (e.g. aliases for domain name, multiple ips per hostname, e.t.c.) ! std::vector <char *> subtargets_addresses; //subtarget ips as string public: --- 13,17 ---- 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 public: *************** *** 38,60 **** int st = get_ips_byhost(hostname, subtargets_addresses); ! char *rev_hostname = new char[ICEMAXHOSTNAME]; ! ! if((!is_domainname(hostname)) && par->reverse_dns) ! get_host_byip(hostname, rev_hostname, ICEMAXHOSTNAME); ! else ! strcpy(rev_hostname, hostname); ! for(int i=0; i<st; i++){ ! char *subtarget_hostname; ! subtarget_hostname = subtargets_addresses[i]; ! ! csubtarget *cst = new csubtarget(subtarget_hostname, rev_hostname, par, out, isnd); ! ! subtargets.push_back(cst); ! } ! delete rev_hostname; ! return st; } --- 38,58 ---- int st = get_ips_byhost(hostname, 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++){ ! 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); ! } ! ! return st; } *************** *** 83,87 **** for(int i=0; i<subtargets.size(); i++){ delete subtargets[i]; - delete subtargets_addresses[i]; } } --- 81,84 ---- |
From: Alexander B. <da...@us...> - 2006-12-12 19:59:20
|
Update of /cvsroot/javanetsim/IceScan/nbproject/private In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv28891/nbproject/private Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/private/configurations.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** configurations.xml 30 Nov 2006 06:43:50 -0000 1.3 --- configurations.xml 12 Dec 2006 19:59:15 -0000 1.4 *************** *** 6,10 **** <conf name="Default" type="1"> <runprofile version="4"> ! <args>80.70.228.177</args> <rundir>.</rundir> <buildfirst>true</buildfirst> --- 6,10 ---- <conf name="Default" type="1"> <runprofile version="4"> ! <args>-P0 -v -r mail.th-china.ru</args> <rundir>.</rundir> <buildfirst>true</buildfirst> |
From: Alexander B. <da...@us...> - 2006-12-12 19:59:20
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv28891/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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sock_name.h 30 Nov 2006 15:28:41 -0000 1.4 --- sock_name.h 12 Dec 2006 19:59:15 -0000 1.5 *************** *** 72,76 **** } ! short int get_ips_byhost(const char * nisname, std::vector <char *> &v){ struct addrinfo hints, *res; char hname[1024]; --- 72,76 ---- } ! short int get_ips_byhost(const char * nisname, std::vector <icestring> &v){ struct addrinfo hints, *res; char hname[1024]; *************** *** 91,102 **** while(res){ - char *retname = new char [24]; rname = inet_ntoa( *( &( ((sockaddr_in *)res->ai_addr)->sin_addr ) ) ); ! int retlen = (strlen(rname) >= 24) ? strlen(rname) : 24; ! strncpy(retname, rname, retlen); ! ! v.push_back(retname); res = res->ai_next; ! cnt++; } --- 91,100 ---- while(res){ rname = inet_ntoa( *( &( ((sockaddr_in *)res->ai_addr)->sin_addr ) ) ); ! icestring is(rname); ! ! v.push_back(is); res = res->ai_next; ! cnt++; } |
From: Alexander B. <da...@us...> - 2006-11-30 15:36:36
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7027 Modified Files: .cvsignore Log Message: no message Index: .cvsignore =================================================================== RCS file: /cvsroot/javanetsim/IceScan/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 28 Nov 2006 18:02:23 -0000 1.1 --- .cvsignore 30 Nov 2006 15:36:33 -0000 1.2 *************** *** 1 **** ! icescan icescan.o --- 1 ---- ! icescan icescan.o Makefile |
From: Alexander B. <da...@us...> - 2006-11-30 15:28:45
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3753 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sock_name.h 30 Nov 2006 12:27:36 -0000 1.3 --- sock_name.h 30 Nov 2006 15:28:41 -0000 1.4 *************** *** 18,25 **** #include <netinet/in.h> #include <arpa/inet.h> - #include <pcrecpp.h> #include <iostream> #include <vector> #ifdef __CYGWIN__ #include "getaddrinfo.h" --- 18,26 ---- #include <netinet/in.h> #include <arpa/inet.h> #include <iostream> #include <vector> + #include "iceregex.h" + #ifdef __CYGWIN__ #include "getaddrinfo.h" *************** *** 44,53 **** bool is_domainname(char * nisname){ ! return ! #ifndef __CYGWIN__ //REGEXes don't work under windows? (segfault) ! !(pcrecpp::RE("\\d+\\.\\d+\\.\\d+\\.\\d+").FullMatch(nisname)); ! #else ! true; ! #endif } --- 45,50 ---- bool is_domainname(char * nisname){ ! IceRegex re("\\d+\\.\\d+\\.\\d+\\.\\d+"); ! return ! (re.match(nisname)); } |
From: Alexander B. <da...@us...> - 2006-11-30 15:25:55
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2586 Modified Files: Makefile Log Message: no message Index: Makefile =================================================================== RCS file: /cvsroot/javanetsim/IceScan/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 28 Nov 2006 17:57:54 -0000 1.1 --- Makefile 30 Nov 2006 15:25:48 -0000 1.2 *************** *** 1,4 **** ! CXXFLAGS=-g -lpthread -lpcrecpp ! LDFLAGS=-g -lpthread -lpcrecpp all: icescan --- 1,4 ---- ! CXXFLAGS=-g -lpthread -lpcrecpp -lpcre ! LDFLAGS=-g -lpthread -lpcrecpp -lpcre all: icescan |
From: Alexander B. <da...@us...> - 2006-11-30 15:25:51
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2586/icesockets Modified Files: iceregex.h Removed Files: test.cc Log Message: no message Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iceregex.h 30 Nov 2006 15:13:05 -0000 1.2 --- iceregex.h 30 Nov 2006 15:25:48 -0000 1.3 *************** *** 18,35 **** class IceRegex { public: ! IceRegex (const icestring& pattern){ ! init_regex(pattern.c_str()); } IceRegex (const char pattern[]){ ! init_regex(pattern); } ! void init_regex(const char pattern[]){ const char *error; int error_offset; ! pcre_ = pcre_compile ( ! pattern, 0, &error, --- 18,42 ---- class IceRegex { public: ! IceRegex (const icestring pattern){ ! this->pattern = pattern; ! init_regex(); } IceRegex (const char pattern[]){ ! icestring is(pattern); ! this->pattern = is; ! init_regex(); } ! ~IceRegex(){ ! delete ovector_; ! } ! ! void init_regex(){ const char *error; int error_offset; ! pcre_ = pcre_compile ( ! pattern.c_str(), 0, &error, *************** *** 42,45 **** --- 49,54 ---- } + capture_count_ = 0; + int rc; rc = pcre_fullinfo( *************** *** 48,52 **** PCRE_INFO_CAPTURECOUNT, /* what is required */ &capture_count_); /* where to put the data */ ! ovector_ = new int[3*(capture_count_+1)]; } --- 57,61 ---- PCRE_INFO_CAPTURECOUNT, /* what is required */ &capture_count_); /* where to put the data */ ! ovector_ = new int[3*(capture_count_+1)]; } *************** *** 95,98 **** --- 104,108 ---- pcre* pcre_; unsigned long int capture_count_; + icestring pattern; int* ovector_; //UGLY --- test.cc DELETED --- |
From: Alexander B. <da...@us...> - 2006-11-30 15:25:51
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2586/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** configurations.xml 30 Nov 2006 12:27:36 -0000 1.5 --- configurations.xml 30 Nov 2006 15:25:48 -0000 1.6 *************** *** 6,9 **** --- 6,10 ---- <itemPath>icesockets/csocket.h</itemPath> <itemPath>icesockets/getaddrinfo.h</itemPath> + <itemPath>icesockets/iceregex.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> <itemPath>icesockets/sock_name.h</itemPath> *************** *** 109,112 **** --- 110,116 ---- <itemTool>3</itemTool> </item> + <item path="icesockets/iceregex.h"> + <itemTool>3</itemTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-11-30 15:13:10
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30155 Modified Files: csocket.h iceregex.h sock_types.h test.cc Log Message: no message Index: sock_types.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_types.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_types.h 30 Nov 2006 12:27:36 -0000 1.1 --- sock_types.h 30 Nov 2006 15:13:05 -0000 1.2 *************** *** 3,6 **** --- 3,12 ---- #include <iostream> //for std + #include <sys/types.h> + #include <sys/socket.h> + #include <arpa/inet.h> + #include <netinet/in.h> + #include <netinet/ip.h> + #include <netdb.h> // Re-Defining string type; use icestring instead of string Index: test.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/test.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test.cc 30 Nov 2006 15:02:41 -0000 1.1 --- test.cc 30 Nov 2006 15:13:05 -0000 1.2 *************** *** 5,10 **** int main(){ ! std::string rg = "^\\d+$"; ! IceRegex re(rg); std::cout << re.match("1234r5678") << std::endl; --- 5,9 ---- int main(){ ! IceRegex re("^\\d+$"); std::cout << re.match("1234r5678") << std::endl; Index: iceregex.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/iceregex.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iceregex.h 30 Nov 2006 15:02:41 -0000 1.1 --- iceregex.h 30 Nov 2006 15:13:05 -0000 1.2 *************** *** 18,27 **** class IceRegex { public: ! IceRegex (const icestring& pattern){ const char *error; int error_offset; pcre_ = pcre_compile ( ! pattern.c_str(), 0, &error, --- 18,35 ---- class IceRegex { public: ! IceRegex (const icestring& pattern){ ! init_regex(pattern.c_str()); ! } ! ! IceRegex (const char pattern[]){ ! init_regex(pattern); ! } ! ! void init_regex(const char pattern[]){ const char *error; int error_offset; pcre_ = pcre_compile ( ! pattern, 0, &error, *************** *** 42,91 **** ovector_ = new int[3*(capture_count_+1)]; ! } ! bool match(icestring const& s, std::vector<icestring> &v){ ! int rc = pcre_exec ( ! pcre_, /* the compiled pattern */ ! 0, /* no extra data - pattern was not studied */ ! 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) { ! case PCRE_ERROR_NOMATCH: ! return false; ! default: ! std::cout << "IceRegex strange error!" << std::endl; ! exit(-1); ! } } ! else { ! for (int i=0; i<rc; i++) { ! v.push_back(s.substr(ovector_[2*i], ovector_[2*i+1] - ovector_[2*i])); ! } } ! return true; ! } ! ! 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_; ! int* ovector_; //UGLY }; --- 50,99 ---- ovector_ = new int[3*(capture_count_+1)]; ! } ! bool match(icestring const& s, std::vector<icestring> &v){ ! int rc = pcre_exec ( ! pcre_, /* the compiled pattern */ ! 0, /* no extra data - pattern was not studied */ ! 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) { ! case PCRE_ERROR_NOMATCH: ! return false; ! default: ! std::cout << "IceRegex strange error!" << std::endl; ! exit(-1); ! } ! } ! else { ! for (int i=0; i<rc; i++) { ! v.push_back(s.substr(ovector_[2*i], ovector_[2*i+1] - ovector_[2*i])); ! } ! } ! ! return true; } ! ! 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_; ! int* ovector_; //UGLY }; Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** csocket.h 30 Nov 2006 12:27:36 -0000 1.4 --- csocket.h 30 Nov 2006 15:13:05 -0000 1.5 *************** *** 4,13 **** #include <iostream> - #include <sys/types.h> - #include <sys/socket.h> - #include <arpa/inet.h> - #include <netinet/in.h> - #include <netinet/ip.h> - #include <netdb.h> #include <cstdio> #include <cstdlib> --- 4,7 ---- |
From: Alexander B. <da...@us...> - 2006-11-30 15:02:44
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25766 Added Files: iceregex.h test.cc Log Message: no message --- NEW FILE: iceregex.h --- (This appears to be a binary file; contents omitted.) --- NEW FILE: test.cc --- #include <iostream> #include "iceregex.h" int main(){ std::string rg = "^\\d+$"; IceRegex re(rg); std::cout << re.match("1234r5678") << std::endl; std::cout << re.match("123456789") << std::endl; return 0; } |
From: Alexander B. <da...@us...> - 2006-11-30 12:27:40
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27210/icesockets Modified Files: crawsocket.h csocket.h sock_name.h Added Files: getaddrinfo.h sock_types.h Log Message: no message --- NEW FILE: sock_types.h --- #ifndef ICESOCK_SOCK_TYPES_H #define ICESOCK_SOCK_TYPES_H #include <iostream> //for std // Re-Defining string type; use icestring instead of string #ifdef __CYGWIN__ typedef std::string icestring; #else typedef std::string icestring; #endif // Structure and constants for icmp packets #ifdef __CYGWIN__ #include <sys/param.h> #include <sys/file.h> #include <netdb.h> #include <netinet/in.h> #include <netinet/in_systm.h> /* * Structure of an icmp header. */ struct icmp { u_char icmp_type; /* type of message, see below */ u_char icmp_code; /* type sub code */ u_short icmp_cksum; /* ones complement cksum of struct */ union { u_char ih_pptr; /* ICMP_PARAMPROB */ struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ struct ih_idseq { n_short icd_id; n_short icd_seq; } ih_idseq; int ih_void; /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ struct ih_pmtu { n_short ipm_void; n_short ipm_nextmtu; } ih_pmtu; } icmp_hun; #define icmp_pptr icmp_hun.ih_pptr #define icmp_gwaddr icmp_hun.ih_gwaddr #define icmp_id icmp_hun.ih_idseq.icd_id #define icmp_seq icmp_hun.ih_idseq.icd_seq #define icmp_void icmp_hun.ih_void #define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void #define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu union { struct id_ts { n_time its_otime; n_time its_rtime; n_time its_ttime; } id_ts; struct id_ip { struct ip idi_ip; /* options and then 64 bits of data */ } id_ip; u_long id_mask; char id_data[1]; } icmp_dun; #define icmp_otime icmp_dun.id_ts.its_otime #define icmp_rtime icmp_dun.id_ts.its_rtime #define icmp_ttime icmp_dun.id_ts.its_ttime #define icmp_ip icmp_dun.id_ip.idi_ip #define icmp_mask icmp_dun.id_mask #define icmp_data icmp_dun.id_data }; /* * Lower bounds on packet lengths for various types. * For the error advice packets must first insure that the * packet is large enought to contain the returned ip header. * Only then can we do the check to see if 64 bits of packet * data have been returned, since we need to check the returned * ip header length. */ #define ICMP_MINLEN 8 /* abs minimum */ #define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ #define ICMP_MASKLEN 12 /* address mask */ #define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ #define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) /* N.B.: must separately check that ip_hl >= 5 */ /* * Definition of type and code field values. */ #define ICMP_ECHOREPLY 0 /* echo reply */ #define ICMP_UNREACH 3 /* dest unreachable, codes: */ #define ICMP_UNREACH_NET 0 /* bad net */ #define ICMP_UNREACH_HOST 1 /* bad host */ #define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ #define ICMP_UNREACH_PORT 3 /* bad port */ #define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ #define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ #define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ #define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ #define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ #define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */ #define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */ #define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ #define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ #define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ #define ICMP_REDIRECT 5 /* shorter route, codes: */ #define ICMP_REDIRECT_NET 0 /* for network */ #define ICMP_REDIRECT_HOST 1 /* for host */ #define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ #define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ #define ICMP_ECHO 8 /* echo service */ #define ICMP_ROUTERADVERT 9 /* router advertisement */ #define ICMP_ROUTERSOLICIT 10 /* router solicitation */ #define ICMP_TIMXCEED 11 /* time exceeded, code: */ #define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ #define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ #define ICMP_PARAMPROB 12 /* ip header bad */ #define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ #define ICMP_TSTAMP 13 /* timestamp request */ #define ICMP_TSTAMPREPLY 14 /* timestamp reply */ #define ICMP_IREQ 15 /* information request */ #define ICMP_IREQREPLY 16 /* information reply */ #define ICMP_MASKREQ 17 /* address mask request */ #define ICMP_MASKREPLY 18 /* address mask reply */ #define ICMP_MAXTYPE 18 #define ICMP_INFOTYPE(type) \ ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) #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 #endif #endif Index: crawsocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/crawsocket.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** crawsocket.h 28 Nov 2006 17:57:54 -0000 1.1 --- crawsocket.h 30 Nov 2006 12:27:36 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- #include "csocket.h" + #include <netinet/ip.h> #include <netinet/ip_icmp.h> *************** *** 119,120 **** --- 120,122 ---- #endif + Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** csocket.h 29 Nov 2006 12:51:01 -0000 1.3 --- csocket.h 30 Nov 2006 12:27:36 -0000 1.4 *************** *** 16,19 **** --- 16,20 ---- // Library #include "sock_err.h" + #include "sock_types.h" #include "sock_name.h" #include "sock_time.h" --- NEW FILE: getaddrinfo.h --- /* * Copyright (c) 2001, 02 Motoyuki Kasahara * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef GETADDRINFO_H #define GETADDRINFO_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> /********************************************************************/ /* * Undefine all the macros. * <netdb.h> might defines some of them. */ #ifdef EAI_ADDRFAMILY #undef EAI_ADDRFAMILY #endif #ifdef EAI_AGAIN #undef EAI_AGAIN #endif #ifdef EAI_BADFLAGS #undef EAI_BADFLAGS #endif #ifdef EAI_FAIL #undef EAI_FAIL #endif #ifdef EAI_FAMILY #undef EAI_FAMILY #endif #ifdef EAI_MEMORY #undef EAI_MEMORY #endif #ifdef EAI_NONAME #undef EAI_NONAME #endif #ifdef EAI_OVERFLOW #undef EAI_OVERFLOW #endif #ifdef EAI_SERVICE #undef EAI_SERVICE #endif #ifdef EAI_SOCKTYPE #undef EAI_SOCKTYPE #endif #ifdef EAI_SYSTEM #undef EAI_SYSTEM #endif #ifdef AI_PASSIVE #undef AI_PASSIVE #endif #ifdef AI_CANONNAME #undef AI_CANONNAME #endif #ifdef AI_NUMERICHOST #undef AI_NUMERICHOST #endif #ifdef AI_NUMERICSERV #undef AI_NUMERICSERV #endif #ifdef AI_V4MAPPED #undef AI_V4MAPPED #endif #ifdef AI_ALL #undef AI_ALL #endif #ifdef AI_ADDRCONFIG #undef AI_ADDRCONFIG #endif #ifdef AI_DEFAULT #undef AI_DEFAULT #endif #ifdef NI_NOFQDN #undef NI_NOFQDN #endif #ifdef NI_NUMERICHOST #undef NI_NUMERICHOST #endif #ifdef NI_NAMEREQD #undef NI_NAMEREQD #endif #ifdef NI_NUMERICSERV #undef NI_NUMERICSERV #endif #ifdef NI_NUMERICSCOPE #undef NI_NUMERICSCOPE #endif #ifdef NI_DGRAM #undef NI_DGRAM #endif #ifdef NI_MAXHOST #undef NI_MAXHOST #endif #ifdef NI_MAXSERV #undef NI_MAXSERV #endif /* * Fake struct and function names. * <netdb.h> might declares all or some of them. */ #if defined(HAVE_GETADDRINFO) || defined(HAVE_GETNAMEINFO) #define addrinfo my_addrinfo #define gai_strerror my_gai_strerror #define freeaddrinfo my_freeaddrinfo #define getaddrinfo my_getaddrinfo #define getnameinfo my_getnameinfo #endif /********************************************************************/ /* * Error codes. */ #define EAI_ADDRFAMILY 1 #define EAI_AGAIN 2 #define EAI_BADFLAGS 3 #define EAI_FAIL 4 #define EAI_FAMILY 5 #define EAI_MEMORY 6 #define EAI_NONAME 7 #define EAI_OVERFLOW 8 #define EAI_SERVICE 9 #define EAI_SOCKTYPE 10 #define EAI_SYSTEM 11 /* * Flags for getaddrinfo(). */ #define AI_ADDRCONFIG 0x0001 #define AI_ALL 0x0002 #define AI_CANONNAME 0x0004 #define AI_NUMERICHOST 0x0008 #define AI_NUMERICSERV 0x0010 #define AI_PASSIVE 0x0020 #define AI_V4MAPPED 0x0040 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG) /* * Flags for getnameinfo(). */ #define NI_DGRAM 0x0001 #define NI_NAMEREQD 0x0002 #define NI_NOFQDN 0x0004 #define NI_NUMERICHOST 0x0008 #define NI_NUMERICSCOPE 0x0010 #define NI_NUMERICSERV 0x0020 /* * Maximum length of FQDN and servie name for getnameinfo(). */ #define NI_MAXHOST 1025 #define NI_MAXSERV 32 /* * Address families and Protocol families. */ #ifndef AF_UNSPEC #define AF_UNSPEC AF_INET #endif #ifndef PF_UNSPEC #define PF_UNSPEC PF_INET #endif /* * struct addrinfo. */ struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; socklen_t ai_addrlen; char *ai_canonname; struct sockaddr *ai_addr; struct addrinfo *ai_next; }; /* * Functions. */ /* * This program provides getaddrinfo() and getnameinfo() described in * RFC2133, 2553 and 3493. These functions are mainly used for IPv6 * application to resolve hostname or address. * * This program is designed to be working on traditional IPv4 systems * which don't have those functions. Therefore, this implementation * supports IPv4 only. * * This program is useful for application which should support both IPv6 * and traditional IPv4 systems. Use genuine getaddrinfo() and getnameinfo() * provided by system if the system supports IPv6. Otherwise, use this * implementation. * * This program is intended to be used in combination with GNU Autoconf. * * This program also provides freeaddrinfo() and gai_strerror(). * * To use this program in your application, insert the following lines to * C source files after including `sys/types.h', `sys/socket.h' and * `netdb.h'. `getaddrinfo.h' defines `struct addrinfo' and AI_, NI_, * EAI_ macros. * * #ifndef HAVE_GETADDRINFO * #include "getaddrinfo.h" * #endif * * Restriction: * getaddrinfo() and getnameinfo() of this program are NOT thread * safe, unless the cpp macro ENABLE_PTHREAD is defined. */ /* * Add the following code to your configure.ac (or configure.in). * AC_C_CONST * AC_HEADER_STDC * AC_CHECK_HEADERS(string.h memory.h stdlib.h) * AC_CHECK_FUNCS(memcpy) * AC_REPLACE_FUNCS(memset) * AC_TYPE_SOCKLEN_T * AC_TYPE_IN_PORT_T * AC_DECL_H_ERRNO * * AC_CHECK_FUNCS(getaddrinfo getnameinfo) * if test "$ac_cv_func_getaddrinfo$ac_cv_func_getnameinfo" != yesyes ; then * LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext" * fi */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <sys/types.h> #include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #if defined(STDC_HEADERS) || defined(HAVE_STRING_H) #include <string.h> #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include <memory.h> #endif /* not STDC_HEADERS and HAVE_MEMORY_H */ #else /* not STDC_HEADERS and not HAVE_STRING_H */ #include <strings.h> #endif /* not STDC_HEADERS and not HAVE_STRING_H */ #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef ENABLE_PTHREAD #include <pthread.h> #endif #ifdef ENABLE_NLS #include <libintl.h> #endif /*#ifndef HAVE_MEMCPY #define memcpy(d, s, n) bcopy((s), (d), (n)) #ifdef __STDC__ void *memchr(const void *, int, size_t); int memcmp(const void *, const void *, size_t); void *memmove(void *, const void *, size_t); void *memset(void *, int, size_t); #else /* not __STDC__ */ /*char *memchr(); int memcmp(); char *memmove(); char *memset(); #endif /* not __STDC__ */ //#endif /* not HAVE_MEMCPY */ #ifndef H_ERRNO_DECLARED extern int h_errno; #endif #ifdef ENABLE_NLS #define _(string) gettext(string) #ifdef gettext_noop #define N_(string) gettext_noop(string) #else #define N_(string) (string) #endif #else #define gettext(string) (string) #define _(string) (string) #define N_(string) (string) #endif /* * Error messages for gai_strerror(). */ static char *eai_errlist[] = { N_("Success"), /* EAI_ADDRFAMILY */ N_("Address family for hostname not supported"), /* EAI_AGAIN */ N_("Temporary failure in name resolution"), /* EAI_BADFLAGS */ N_("Invalid value for ai_flags"), /* EAI_FAIL */ N_("Non-recoverable failure in name resolution"), /* EAI_FAMILY */ N_("ai_family not supported"), /* EAI_MEMORY */ N_("Memory allocation failure"), /* EAI_NONAME */ N_("hostname nor servname provided, or not known"), /* EAI_OVERFLOW */ N_("An argument buffer overflowed"), /* EAI_SERVICE */ N_("servname not supported for ai_socktype"), /* EAI_SOCKTYPE */ N_("ai_socktype not supported"), /* EAI_SYSTEM */ N_("System error returned in errno") }; /* * Default hints for getaddrinfo(). */ static struct addrinfo default_hints = { 0, PF_UNSPEC, 0, 0, 0, NULL, NULL, NULL }; /* * Mutex. */ #undef ENABLE_PTHREAD #ifdef ENABLE_PTHREAD static pthread_mutex_t gai_mutex = PTHREAD_MUTEX_INITIALIZER; #endif /* * gai_strerror(). */ const char * gai_strerror(int ecode) { if (ecode < 0 || ecode > EAI_SYSTEM) return _("Unknown error"); return gettext(eai_errlist[ecode]); } /* * freeaddrinfo(). */ void freeaddrinfo(struct addrinfo *ai) { struct addrinfo *next_ai; while (ai != NULL) { if (ai->ai_canonname != NULL) free(ai->ai_canonname); if (ai->ai_addr != NULL) free(ai->ai_addr); next_ai = ai->ai_next; free(ai); ai = next_ai; } } /* * Return 1 if the string `s' represents an integer. */ static int is_integer(const char *s) { if (*s == '-' || *s == '+') s++; if (*s < '0' || '9' < *s) return 0; s++; while ('0' <= *s && *s <= '9') s++; return (*s == '\0'); } /* * Return 1 if the string `s' represents an IPv4 address. * Unlike inet_addr(), it doesn't permit malformed nortation such * as "192.168". */ static int is_address(const char *s) { const static char delimiters[] = {'.', '.', '.', '\0'}; int i, j; int octet; for (i = 0; i < 4; i++) { if (*s == '0' && *(s + 1) != delimiters[i]) return 0; for (j = 0, octet = 0; '0' <= *s && *s <= '9' && j < 3; s++, j++) octet = octet * 10 + (*s - '0'); if (j == 0 || octet > 255 || *s != delimiters[i]) return 0; s++; } return 1; } /* * Calcurate length of the string `s', where `s' is set by * sprintf(s, "%d", n). */ static int itoa_length(int n) { int result = 1; if (n < 0) { n = -n; result++; } while (n >= 10) { result++; n /= 10; } return result; } /* * getaddrinfo(). */ int getaddrinfo( const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res) { struct addrinfo *head_res = NULL; struct addrinfo *tail_res = NULL; struct addrinfo *new_res; struct sockaddr_in *sa_in; struct in_addr **addr_list; struct in_addr *addr_list_buf[2]; struct in_addr addr_buf; struct in_addr **ap; struct servent *servent; struct hostent *hostent; const char *canonname = NULL; in_port_t port; int saved_h_errno; int result = 0; #ifdef ENABLE_PTHREAD pthread_mutex_lock(&gai_mutex); #endif saved_h_errno = h_errno; if (nodename == NULL && servname == NULL) { result = EAI_NONAME; goto end; } if (hints != NULL) { if (hints->ai_family != PF_INET && hints->ai_family != PF_UNSPEC) { result = EAI_FAMILY; goto end; } if (hints->ai_socktype != SOCK_DGRAM && hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != 0) { result = EAI_SOCKTYPE; goto end; } } else { hints = &default_hints; } if (servname != NULL) { if (is_integer(servname)) port = htons(atoi(servname)); else { if (hints->ai_flags & AI_NUMERICSERV) { result = EAI_NONAME; goto end; } if (hints->ai_socktype == SOCK_DGRAM) servent = getservbyname(servname, "udp"); else if (hints->ai_socktype == SOCK_STREAM) servent = getservbyname(servname, "tcp"); else if (hints->ai_socktype == 0) servent = getservbyname(servname, "tcp"); else { result = EAI_SOCKTYPE; goto end; } if (servent == NULL) { result = EAI_SERVICE; goto end; } port = servent->s_port; } } else { port = htons(0); } if (nodename != NULL) { if (is_address(nodename)) { addr_buf.s_addr = inet_addr(nodename); addr_list_buf[0] = &addr_buf; addr_list_buf[1] = NULL; addr_list = addr_list_buf; if (hints->ai_flags & AI_CANONNAME && !(hints->ai_flags & AI_NUMERICHOST)) { hostent = gethostbyaddr((char *)&addr_buf, sizeof(struct in_addr), AF_INET); if (hostent != NULL) canonname = hostent->h_name; else canonname = nodename; } } else { if (hints->ai_flags & AI_NUMERICHOST) { result = EAI_NONAME; goto end; } hostent = gethostbyname(nodename); if (hostent == NULL) { switch (h_errno) { case HOST_NOT_FOUND: case NO_DATA: result = EAI_NONAME; goto end; case TRY_AGAIN: result = EAI_AGAIN; goto end; default: result = EAI_FAIL; goto end; } } addr_list = (struct in_addr **)hostent->h_addr_list; if (hints->ai_flags & AI_CANONNAME) canonname = hostent->h_name; } } else { if (hints->ai_flags & AI_PASSIVE) addr_buf.s_addr = htonl(INADDR_ANY); else addr_buf.s_addr = htonl(0x7F000001); addr_list_buf[0] = &addr_buf; addr_list_buf[1] = NULL; addr_list = addr_list_buf; } for (ap = addr_list; *ap != NULL; ap++) { new_res = (struct addrinfo *)malloc(sizeof(struct addrinfo)); if (new_res == NULL) { if (head_res != NULL) freeaddrinfo(head_res); result = EAI_MEMORY; goto end; } new_res->ai_family = PF_INET; new_res->ai_socktype = hints->ai_socktype; new_res->ai_protocol = hints->ai_protocol; new_res->ai_addr = NULL; new_res->ai_addrlen = sizeof(struct sockaddr_in); new_res->ai_canonname = NULL; new_res->ai_next = NULL; new_res->ai_addr = (struct sockaddr *) malloc(sizeof(struct sockaddr_in)); if (new_res->ai_addr == NULL) { free(new_res); if (head_res != NULL) freeaddrinfo(head_res); result = EAI_MEMORY; goto end; } sa_in = (struct sockaddr_in *)new_res->ai_addr; memset(sa_in, 0, sizeof(struct sockaddr_in)); sa_in->sin_family = PF_INET; sa_in->sin_port = port; memcpy(&sa_in->sin_addr, *ap, sizeof(struct in_addr)); if (head_res == NULL) head_res = new_res; else tail_res->ai_next = new_res; tail_res = new_res; } if (canonname != NULL && head_res != NULL) { head_res->ai_canonname = (char *)malloc(strlen(canonname) + 1); if (head_res->ai_canonname != NULL) strcpy(head_res->ai_canonname, canonname); } *res = head_res; end: h_errno = saved_h_errno; #ifdef ENABLE_PTHREAD pthread_mutex_unlock(&gai_mutex); #endif return result; } /* * getnameinfo(). */ int getnameinfo( const struct sockaddr *sa, socklen_t salen, char *node, socklen_t nodelen, char *serv, socklen_t servlen, int flags) { const struct sockaddr_in *sa_in = (const struct sockaddr_in *)sa; struct hostent *hostent; struct servent *servent; char *ntoa_address; int saved_h_errno; int result = 0; #ifdef ENABLE_PTHREAD pthread_mutex_lock(&gai_mutex); #endif saved_h_errno = h_errno; if (sa_in->sin_family != PF_INET) { result = EAI_FAMILY; goto end; } else if (node == NULL && serv == NULL) { result = EAI_NONAME; goto end; } if (serv != NULL && servlen > 0) { if (flags & NI_NUMERICSERV) servent = NULL; else if (flags & NI_DGRAM) servent = getservbyport(sa_in->sin_port, "udp"); else servent = getservbyport(sa_in->sin_port, "tcp"); if (servent != NULL) { if (servlen <= strlen(servent->s_name)) { result = EAI_OVERFLOW; goto end; } strcpy(serv, servent->s_name); } else { if (servlen <= itoa_length(ntohs(sa_in->sin_port))) { result = EAI_OVERFLOW; goto end; } sprintf(serv, "%d", ntohs(sa_in->sin_port)); } } if (node != NULL && nodelen > 0) { if (flags & NI_NUMERICHOST) hostent = NULL; else { hostent = gethostbyaddr((char *)&sa_in->sin_addr, sizeof(struct in_addr), AF_INET); } if (hostent != NULL) { if (nodelen <= strlen(hostent->h_name)) { result = EAI_OVERFLOW; goto end; } strcpy(node, hostent->h_name); } else { if (flags & NI_NAMEREQD) { result = EAI_NONAME; goto end; } ntoa_address = inet_ntoa(sa_in->sin_addr); if (nodelen <= strlen(ntoa_address)) { result = EAI_OVERFLOW; goto end; } strcpy(node, ntoa_address); } } end: h_errno = saved_h_errno; #ifdef ENABLE_PTHREAD pthread_mutex_unlock(&gai_mutex); #endif return result; } #endif /* GETADDRINFO_H */ Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sock_name.h 30 Nov 2006 06:43:50 -0000 1.2 --- sock_name.h 30 Nov 2006 12:27:36 -0000 1.3 *************** *** 2,6 **** #define ICESOCK_SOCK_NAME_H ! #define ICEMAXHOSTNAME NI_MAXHOST #include <stdio.h> --- 2,12 ---- #define ICESOCK_SOCK_NAME_H ! #ifndef __CYGWIN__ ! #define ICEMAXHOSTNAME NI_MAXHOST ! #define ICEMAXSERVNAME NI_MAXSERV ! #else ! #define ICEMAXHOSTNAME 1025 ! #define ICEMAXSERVNAME 25 ! #endif #include <stdio.h> *************** *** 16,19 **** --- 22,29 ---- #include <vector> + #ifdef __CYGWIN__ + #include "getaddrinfo.h" + #endif + int make_sockname(struct sockaddr_in& saddr, const char *hostname, int port, int domain) { saddr.sin_family = domain; *************** *** 34,38 **** bool is_domainname(char * nisname){ ! return !(pcrecpp::RE("\\d+\\.\\d+\\.\\d+\\.\\d+").FullMatch(nisname)); } --- 44,53 ---- bool is_domainname(char * nisname){ ! return ! #ifndef __CYGWIN__ //REGEXes don't work under windows? (segfault) ! !(pcrecpp::RE("\\d+\\.\\d+\\.\\d+\\.\\d+").FullMatch(nisname)); ! #else ! true; ! #endif } |
From: Alexander B. <da...@us...> - 2006-11-30 12:27:40
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27210 Modified Files: iceoutput.h icescan.cc iceservice.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** icescan.cc 30 Nov 2006 06:43:50 -0000 1.5 --- icescan.cc 30 Nov 2006 12:27:35 -0000 1.6 *************** *** 199,203 **** ice_service_name_database isnd("services"); ! char version_string[255]; --- 199,203 ---- ice_service_name_database isnd("services"); ! char version_string[255]; *************** *** 238,241 **** --- 238,242 ---- 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; + return 0; } Index: iceservice.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceservice.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iceservice.h 30 Nov 2006 06:43:50 -0000 1.2 --- iceservice.h 30 Nov 2006 12:27:35 -0000 1.3 *************** *** 10,15 **** class ice_service_name_database{ ! std::map <int, string> tcp_services; ! std::map <int, string> udp_services; public: --- 10,15 ---- class ice_service_name_database{ ! std::map <int, icestring> tcp_services; ! std::map <int, icestring> udp_services; public: *************** *** 23,35 **** std::cout << "Can't open service names database!" << std::endl; } else { while(!in.eof()){ char tmpbuf[256]; in.getline(tmpbuf,256); ! ! if(! pcrecpp::RE("^(#.*|\\s*)$").FullMatch(tmpbuf) ){ pcrecpp::RE re("^([-a-z1-9]+)\\s*\\W*([0-9]+)/(tcp|udp)"); ! ! string sname = "", protocol = ""; int port; --- 23,44 ---- 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]; in.getline(tmpbuf,256); ! ! //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; *************** *** 47,50 **** --- 56,60 ---- }//else DBGOUTPUT("#comment"); } + #endif } } Index: iceoutput.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceoutput.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iceoutput.h 28 Nov 2006 18:59:18 -0000 1.2 --- iceoutput.h 30 Nov 2006 12:27:35 -0000 1.3 *************** *** 3,6 **** --- 3,7 ---- #include <fstream> + #include <string> #include <iostream> #include <vector> *************** *** 46,51 **** std::cout << buf; } ! ! iceoutput &operator<<(const string &str){ std::cout << str; } --- 47,52 ---- std::cout << buf; } ! ! iceoutput &operator<<(const icestring &str){ std::cout << str; } |
From: Alexander B. <da...@us...> - 2006-11-30 12:27:40
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27210/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** configurations.xml 30 Nov 2006 06:43:50 -0000 1.4 --- configurations.xml 30 Nov 2006 12:27:36 -0000 1.5 *************** *** 5,11 **** --- 5,13 ---- <itemPath>icesockets/crawsocket.h</itemPath> <itemPath>icesockets/csocket.h</itemPath> + <itemPath>icesockets/getaddrinfo.h</itemPath> <itemPath>icesockets/sock_err.h</itemPath> <itemPath>icesockets/sock_name.h</itemPath> <itemPath>icesockets/sock_time.h</itemPath> + <itemPath>icesockets/sock_types.h</itemPath> </logicalFolder> <logicalFolder name="ExternalFiles" *************** *** 101,104 **** --- 103,112 ---- <itemTool>3</itemTool> </item> + <item path="icesockets/getaddrinfo.h"> + <itemTool>3</itemTool> + </item> + <item path="icesockets/sock_types.h"> + <itemTool>3</itemTool> + </item> </conf> </confs> |
From: Alexander B. <da...@us...> - 2006-11-30 06:43:56
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20305 Modified Files: CHANGELOG iceparams.h icescan.cc ctarget.h TODO iceservice.h csubtarget.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** icescan.cc 29 Nov 2006 12:51:01 -0000 1.4 --- icescan.cc 30 Nov 2006 06:43:50 -0000 1.5 *************** *** 15,18 **** --- 15,19 ---- "\t-PA: ACK Ping host discovery\n" "\t-PE: ICMP Echo (aka standart ping) host discovery\n" + "\t-r: no reverse-dns lookups\n" "SCAN TYPES:\n" "\t-ST: tcp connect() scan\n" *************** *** 56,59 **** --- 57,64 ---- exit(0); break; + + case 'r': + par->reverse_dns = false; + break; case '?': *************** *** 189,193 **** iceoutput out; ! iceparams par; ice_service_name_database isnd("services"); --- 194,200 ---- iceoutput out; ! iceparams par; ! ! struct timeb tp1, tp2; ice_service_name_database isnd("services"); *************** *** 195,198 **** --- 202,207 ---- char version_string[255]; + bool discover = false; + time_t rawtime; *************** *** 209,218 **** par.by_default_init(); ! ctarget t(par.target, &par, &out, &isnd); ! ! t.discover(); ! ! t.scan(); return 0; } --- 218,241 ---- par.by_default_init(); ! if(par.target == NULL){ ! out << "No target hosts/networks specified!" << iceoutput::endl; ! return 1; ! } ! ! ctargets ts(&par, &out, &isnd); ! ! ftime(&tp1); ! ! ts.add_subtargets(par.target); + if(! (discover = ts.discover()) ){ + out << "Warn: Host(s) seems down. If it is really up, but blocking ping probes, try -P0." << iceoutput::endl; + } + + if(discover) ts.scan(); + + ftime(&tp2); + + 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; return 0; } Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** csubtarget.h 30 Nov 2006 05:27:39 -0000 1.4 --- csubtarget.h 30 Nov 2006 06:43:50 -0000 1.5 *************** *** 6,10 **** #include <map> #include <errno.h> - #include <sys/timeb.h> #include <pthread.h> #include "iceoutput.h" --- 6,9 ---- *************** *** 58,61 **** --- 57,62 ---- char *hostname; + + char *reversed_hostname; ice_service_name_database *isnd; *************** *** 67,73 **** std::vector<scanned_port> subtarget_ports; ! csubtarget(char *hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ ! this->hostname = (char *) malloc(strlen(hostname)); strcpy(this->hostname, hostname); this->par = par; this->out = out; --- 68,76 ---- std::vector<scanned_port> subtarget_ports; ! csubtarget(char *hostname, char *reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ ! 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; *************** *** 83,98 **** discovered = host_discover(hostname, par, out); ftime(&tp2); ! ! int secs = tp2.time - tp1.time; ! int msecs = tp2.millitm - tp1.millitm; ! ! if(msecs < 0){ ! secs--; ! msecs = 1000 + msecs; ! } ! ! float dt = secs + 0.001*msecs; ! ! if(par->verbose) *out << "Discovery taken " << dt << " seconds.\n"; return discovered; --- 86,91 ---- discovered = host_discover(hostname, par, out); ftime(&tp2); ! ! if(par->verbose) *out << "Discovery taken " << timeb_diff(tp1, tp2) << " seconds.\n"; return discovered; *************** *** 476,482 **** else if(open == 0 && closed <= MAX_CLOSED) show_closed = true; ! bzero(output_buf, 255); ! sprintf(output_buf, "Interesting ports on %s:", hostname); ! out->line(output_buf); //DBGOUTPUT(filtered); --- 469,476 ---- 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); *************** *** 517,520 **** --- 511,515 ---- //DBGOUTPUT("Entering destructor..."); free(hostname); + free(reversed_hostname); scan_sockets.clear(); subtarget_ports.clear(); Index: CHANGELOG =================================================================== RCS file: /cvsroot/javanetsim/IceScan/CHANGELOG,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CHANGELOG 30 Nov 2006 05:27:39 -0000 1.2 --- CHANGELOG 30 Nov 2006 06:43:50 -0000 1.3 *************** *** 8,11 **** * fixed icmp echo discovery (icmplen). * fixed selecting discovery type from command line. ! ! * fixed format string vulnerability when showing port table. \ No newline at end of file --- 8,13 ---- * fixed icmp echo discovery (icmplen). * fixed selecting discovery type from command line. ! * fixed format string vulnerability when showing port table. ! + added scan time reporting at the end of the scan ! * fixed crash on empty target ! + added reverse dns lookup (and -r key to command line) \ No newline at end of file Index: iceservice.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceservice.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iceservice.h 28 Nov 2006 17:57:54 -0000 1.1 --- iceservice.h 30 Nov 2006 06:43:50 -0000 1.2 *************** *** 52,56 **** string get_tcp_service(int port){ if(tcp_services.find(port) != tcp_services.end()) return udp_services[port]; ! else return ""; } --- 52,56 ---- string get_tcp_service(int port){ if(tcp_services.find(port) != tcp_services.end()) return udp_services[port]; ! else return "unknown"; } Index: iceparams.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceparams.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iceparams.h 28 Nov 2006 21:01:33 -0000 1.2 --- iceparams.h 30 Nov 2006 06:43:50 -0000 1.3 *************** *** 31,35 **** // PreScan settings ! bool reverse_dns; //-RY (default); -RN params: resolve given ip to hostname or not? // Host discovery (default: -PA, -PI) --- 31,35 ---- // PreScan settings ! bool reverse_dns; //(true by default); -r -- no reverse dns lookup // Host discovery (default: -PA, -PI) *************** *** 94,130 **** ~iceparams(){ delete target; } ! void by_default_init(){ ! if( ! (no_host_discovery || ack_ping_discovery || syn_ping_discovery || icmp_echo_ping_discovery || ! icmp_mask_ping_discovery || icmp_timestamp_ping_discovery || udp_ping_discovery) ){ ! ack_ping_discovery = true; ! icmp_echo_ping_discovery = true; ! } ! init_default_ports(); ! } ! void init_default_ports(){ ! const int ranges_cnt = 1; ! int ranges[ranges_cnt][2] = { {1, 1024} }; ! if(ports.empty()){ ! struct port_range pr; ! for(int i = 0; i < ranges_cnt; i++){ ! pr.lower_port = ranges[i][0]; pr.upper_port = ranges[i][1]; ports.push_back(pr); ! } ! } ! } ! int calc_ports_count(){ ! int cnt = 0; ! for(int i = 0; i < ports.size(); i++){ ! cnt += (ports[i].upper_port - ports[i].lower_port) + 1; ! } ! return cnt; ! } }; --- 94,130 ---- ~iceparams(){ delete target; } ! void by_default_init(){ ! if( ! (no_host_discovery || ack_ping_discovery || syn_ping_discovery || icmp_echo_ping_discovery || ! icmp_mask_ping_discovery || icmp_timestamp_ping_discovery || udp_ping_discovery) ){ ! ack_ping_discovery = true; ! icmp_echo_ping_discovery = true; ! } ! init_default_ports(); ! } ! void init_default_ports(){ ! const int ranges_cnt = 1; ! int ranges[ranges_cnt][2] = { {1, 1024} }; ! if(ports.empty()){ ! struct port_range pr; ! for(int i = 0; i < ranges_cnt; i++){ ! pr.lower_port = ranges[i][0]; pr.upper_port = ranges[i][1]; ports.push_back(pr); ! } ! } ! } ! int calc_ports_count(){ ! int cnt = 0; ! for(int i = 0; i < ports.size(); i++){ ! cnt += (ports[i].upper_port - ports[i].lower_port) + 1; ! } ! return cnt; ! } }; Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ctarget.h 30 Nov 2006 05:27:39 -0000 1.2 --- ctarget.h 30 Nov 2006 06:43:50 -0000 1.3 *************** *** 1,14 **** ! #ifndef CTARGET_H ! #define CTARGET_H #include "csubtarget.h" ! class ctarget{ iceoutput *out; ! iceparams *par; ! ! char *hostname; ice_service_name_database *isnd; --- 1,12 ---- ! #ifndef CTARGETS_H ! #define CTARGETS_H #include "csubtarget.h" ! class ctargets{ iceoutput *out; ! iceparams *par; ice_service_name_database *isnd; *************** *** 17,53 **** std::vector <char *> subtargets_addresses; //subtarget ips as string ! int get_subtargets(){ int st = get_ips_byhost(hostname, subtargets_addresses); for(int i=0; i<st; i++){ char *subtarget_hostname; subtarget_hostname = subtargets_addresses[i]; ! csubtarget *cst = new csubtarget(subtarget_hostname, par, out, isnd); subtargets.push_back(cst); } ! return st; ! } ! ! ! public: ! ! ctarget(char *hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ ! this->hostname = (char *) malloc(strlen(hostname)); ! this->isnd = isnd; ! strcpy(this->hostname, hostname); ! this->par = par; ! this->out = out; ! } ! bool discover(){ - int st = get_subtargets(); - bool discovered = false; ! for(int i=0; i<st; i++){ if(par->no_host_discovery) discovered |= (subtargets[i]->discovered = true); --- 15,66 ---- std::vector <char *> subtargets_addresses; //subtarget ips as string ! public: ! ! ctargets(iceparams *par, iceoutput *out, ice_service_name_database *isnd){ ! this->isnd = isnd; ! this->par = par; ! this->out = out; ! } ! ! int subtargets_count(){ ! return subtargets.size(); ! } ! ! int up_subtargets_count(){ ! int up = 0; ! ! for(int i = 0; i<subtargets.size(); i++){ ! if(subtargets[i]->discovered) up++; ! } ! } ! ! int add_subtargets(char *hostname){ int st = get_ips_byhost(hostname, subtargets_addresses); + + char *rev_hostname = new char[ICEMAXHOSTNAME]; + if((!is_domainname(hostname)) && par->reverse_dns) + get_host_byip(hostname, rev_hostname, ICEMAXHOSTNAME); + else + strcpy(rev_hostname, hostname); + for(int i=0; i<st; i++){ char *subtarget_hostname; subtarget_hostname = subtargets_addresses[i]; ! csubtarget *cst = new csubtarget(subtarget_hostname, rev_hostname, par, out, isnd); subtargets.push_back(cst); } ! ! delete rev_hostname; ! return st; ! } bool discover(){ bool discovered = false; ! for(int i=0; i<subtargets.size(); i++){ if(par->no_host_discovery) discovered |= (subtargets[i]->discovered = true); *************** *** 59,77 **** } ! void scan(){ ! for(int i=0; i<subtargets.size(); i++){ ! if(subtargets[i]->discovered){ ! subtargets[i]->scan(); ! } ! } ! } ! ~ctarget(){ ! free(hostname); ! for(int i=0; i<subtargets.size(); i++){ ! delete subtargets[i]; ! delete subtargets_addresses[i]; ! } ! } private: --- 72,89 ---- } ! void scan(){ ! for(int i=0; i<subtargets.size(); i++){ ! if(subtargets[i]->discovered){ ! subtargets[i]->scan(); ! } ! } ! } ! ~ctargets(){ ! for(int i=0; i<subtargets.size(); i++){ ! delete subtargets[i]; ! delete subtargets_addresses[i]; ! } ! } private: Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TODO 30 Nov 2006 05:27:39 -0000 1.5 --- TODO 30 Nov 2006 06:43:50 -0000 1.6 *************** *** 5,9 **** -- UI -- - + add enable/disable reverse dns lookup; + add multiple targets handling; * fix reading port range for ack/udp/syn pings; --- 5,8 ---- *************** *** 29,36 **** -- Misc -- - + add scan time reporting - -- Bugs -- - - * crash on empty target - * handling multiple subtargets \ No newline at end of file --- 28,30 ---- |
From: Alexander B. <da...@us...> - 2006-11-30 06:43:55
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20305/icesockets Modified Files: sock_name.h sock_time.h Log Message: no message Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_name.h 28 Nov 2006 17:57:54 -0000 1.1 --- sock_name.h 30 Nov 2006 06:43:50 -0000 1.2 *************** *** 2,5 **** --- 2,7 ---- #define ICESOCK_SOCK_NAME_H + #define ICEMAXHOSTNAME NI_MAXHOST + #include <stdio.h> #include <stdlib.h> *************** *** 32,36 **** bool is_domainname(char * nisname){ ! return !(pcrecpp::RE("\\d+\\.\\d+\\.\\d\\.\\d+").FullMatch(nisname)); } --- 34,38 ---- bool is_domainname(char * nisname){ ! return !(pcrecpp::RE("\\d+\\.\\d+\\.\\d+\\.\\d+").FullMatch(nisname)); } *************** *** 91,115 **** short int get_host_byip(const char * nisname, char * retname, int retlen){ ! char rname[1025]; ! char temp[32]; ! int rc; struct sockaddr_in saddr; - struct addrinfo hints, *res; int len = make_sockname(saddr, nisname, 53, AF_INET); ! bzero(&hints, sizeof(hints)); ! ! hints.ai_flags = AI_CANONNAME; ! hints.ai_family = AF_INET; ! ! if( (rc = getnameinfo((sockaddr *) &saddr, len, rname, 1024, temp, 32, 0)) < 0) { perror("getnameinfo"); return -1; } ! retlen = (retlen >= strlen(rname) + 1) ? strlen(rname) + 1 : retlen; ! strncpy(retname, rname, retlen); return 0; --- 93,110 ---- 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) { perror("getnameinfo"); return -1; } ! retlen = (retlen >= strlen(hbuf) + 1) ? strlen(hbuf) + 1 : retlen; ! strncpy(retname, hbuf, retlen); return 0; Index: sock_time.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_time.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sock_time.h 28 Nov 2006 17:57:54 -0000 1.1 --- sock_time.h 30 Nov 2006 06:43:50 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- #include <time.h> + #include <sys/timeb.h> void icesleep(int secs, int nsecs){ *************** *** 12,14 **** --- 13,32 ---- } + + float timeb_diff(timeb &tp1, timeb &tp2){ + float dt; + + int secs = tp2.time - tp1.time; + int msecs = tp2.millitm - tp1.millitm; + + if(msecs < 0){ + secs--; + msecs = 1000 + msecs; + } + + dt = secs + 0.001*msecs; + + return dt; + } + #endif |
From: Alexander B. <da...@us...> - 2006-11-30 06:43:55
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20305/nbproject Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** configurations.xml 29 Nov 2006 12:51:01 -0000 1.3 --- configurations.xml 30 Nov 2006 06:43:50 -0000 1.4 *************** *** 12,16 **** --- 12,18 ---- displayName="Important Files" projectFiles="false"> + <itemPath>.cvsignore</itemPath> <itemPath>CHANGELOG</itemPath> + <itemPath>COPYING</itemPath> <itemPath>Makefile</itemPath> <itemPath>TODO</itemPath> |
From: Alexander B. <da...@us...> - 2006-11-30 06:43:55
|
Update of /cvsroot/javanetsim/IceScan/nbproject/private In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20305/nbproject/private Modified Files: configurations.xml Log Message: no message Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/private/configurations.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configurations.xml 28 Nov 2006 18:59:18 -0000 1.2 --- configurations.xml 30 Nov 2006 06:43:50 -0000 1.3 *************** *** 6,10 **** <conf name="Default" type="1"> <runprofile version="4"> ! <args></args> <rundir>.</rundir> <buildfirst>true</buildfirst> --- 6,10 ---- <conf name="Default" type="1"> <runprofile version="4"> ! <args>80.70.228.177</args> <rundir>.</rundir> <buildfirst>true</buildfirst> |
From: Alexander B. <da...@us...> - 2006-11-30 05:27:48
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23013 Modified Files: CHANGELOG ctarget.h TODO csubtarget.h Log Message: no message Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** csubtarget.h 29 Nov 2006 12:51:01 -0000 1.3 --- csubtarget.h 30 Nov 2006 05:27:39 -0000 1.4 *************** *** 487,491 **** sprintf(output_buf, "Not shown: %d filtered ports.", filtered); }else{ ! sprintf(output_buf, "Not shown: %d filtered && %d closed ports.", closed); } out->line(output_buf); --- 487,491 ---- sprintf(output_buf, "Not shown: %d filtered ports.", filtered); }else{ ! sprintf(output_buf, "Not shown: %d filtered && %d closed ports.", filtered, closed); } out->line(output_buf); Index: ctarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/ctarget.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ctarget.h 28 Nov 2006 17:57:54 -0000 1.1 --- ctarget.h 30 Nov 2006 05:27:39 -0000 1.2 *************** *** 23,28 **** char *subtarget_hostname; subtarget_hostname = subtargets_addresses[i]; ! ! csubtarget *cst = new csubtarget(hostname, par, out, isnd); subtargets.push_back(cst); --- 23,28 ---- char *subtarget_hostname; subtarget_hostname = subtargets_addresses[i]; ! ! csubtarget *cst = new csubtarget(subtarget_hostname, par, out, isnd); subtargets.push_back(cst); Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TODO 29 Nov 2006 12:51:01 -0000 1.4 --- TODO 30 Nov 2006 05:27:39 -0000 1.5 *************** *** 5,9 **** -- UI -- ! + add enable/disable reverse dns lookup; * fix reading port range for ack/udp/syn pings; --- 5,10 ---- -- UI -- ! + add enable/disable reverse dns lookup; ! + add multiple targets handling; * fix reading port range for ack/udp/syn pings; *************** *** 12,15 **** --- 13,17 ---- + UDP Ping (-PU [portlist]) [QweR] + TCP SYN Scan (-SS [portlist]) [Key] + * stop scanning of target if discovery failed: print message -- Scanning -- *************** *** 27,34 **** -- Misc -- ! + add scan/discovery/full time reporting -- Bugs -- ! * crash on empty target ! * connect() scan for scanme.nmap.org: 3 filtered && 0 closed ports??? (see nmap result) \ No newline at end of file --- 29,36 ---- -- Misc -- ! + add scan time reporting -- Bugs -- ! * crash on empty target ! * handling multiple subtargets \ No newline at end of file Index: CHANGELOG =================================================================== RCS file: /cvsroot/javanetsim/IceScan/CHANGELOG,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CHANGELOG 29 Nov 2006 12:51:01 -0000 1.1 --- CHANGELOG 30 Nov 2006 05:27:39 -0000 1.2 *************** *** 7,9 **** + added printing time at startup. * fixed icmp echo discovery (icmplen). ! * fixed selecting discovery type from command line. \ No newline at end of file --- 7,11 ---- + added printing time at startup. * fixed icmp echo discovery (icmplen). ! * fixed selecting discovery type from command line. ! ! * fixed format string vulnerability when showing port table. \ No newline at end of file |
From: Alexander B. <da...@us...> - 2006-11-29 12:51:06
|
Update of /cvsroot/javanetsim/IceScan/nbproject In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10368/nbproject Modified Files: configurations.xml Log Message: + added printing time at startup. * fixed icmp echo discovery (icmplen). * fixed selecting discovery type from command line. Index: configurations.xml =================================================================== RCS file: /cvsroot/javanetsim/IceScan/nbproject/configurations.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configurations.xml 28 Nov 2006 21:01:33 -0000 1.2 --- configurations.xml 29 Nov 2006 12:51:01 -0000 1.3 *************** *** 12,15 **** --- 12,16 ---- displayName="Important Files" projectFiles="false"> + <itemPath>CHANGELOG</itemPath> <itemPath>Makefile</itemPath> <itemPath>TODO</itemPath> |
From: Alexander B. <da...@us...> - 2006-11-29 12:51:05
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10368/icesockets Modified Files: csocket.h Log Message: + added printing time at startup. * fixed icmp echo discovery (icmplen). * fixed selecting discovery type from command line. Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** csocket.h 28 Nov 2006 21:01:33 -0000 1.2 --- csocket.h 29 Nov 2006 12:51:01 -0000 1.3 *************** *** 193,207 **** rsize = ::recvfrom(sid, buf, len, flags, (struct sockaddr *) &from, (socklen_t*) &fromlen); ! ! //std::cout << "csocket:recvfrom : " << iptohost(from.sin_addr) << "\n"; ! ! if (srchostname) strcpy(srchostname, iptohost(from.sin_addr)); ! ! //std::cout << "csocket:recvfrom2\n"; ! if (srchostport) *srchostport = ntohs(from.sin_port); - - //std::cout << "csocket:recvfrom3\n"; - return rsize; } --- 193,198 ---- rsize = ::recvfrom(sid, buf, len, flags, (struct sockaddr *) &from, (socklen_t*) &fromlen); ! if (srchostname) strcpy(srchostname, iptohost(from.sin_addr)); if (srchostport) *srchostport = ntohs(from.sin_port); return rsize; } |
From: Alexander B. <da...@us...> - 2006-11-29 12:51:05
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10368 Modified Files: iceversion.h icescan.cc TODO icediscover.h csubtarget.h Added Files: CHANGELOG Log Message: + added printing time at startup. * fixed icmp echo discovery (icmplen). * fixed selecting discovery type from command line. Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** icescan.cc 28 Nov 2006 21:01:33 -0000 1.3 --- icescan.cc 29 Nov 2006 12:51:01 -0000 1.4 *************** *** 14,18 **** "\t-P0: skip host discovery\n" "\t-PA: ACK Ping host discovery\n" ! "\t-PE: ICMP Echo (aka standart ping) host discovery)\n" "SCAN TYPES:\n" "\t-ST: tcp connect() scan\n" --- 14,18 ---- "\t-P0: skip host discovery\n" "\t-PA: ACK Ping host discovery\n" ! "\t-PE: ICMP Echo (aka standart ping) host discovery\n" "SCAN TYPES:\n" "\t-ST: tcp connect() scan\n" *************** *** 105,109 **** break; ! case 'I': par->icmp_echo_ping_discovery = true; break; --- 105,109 ---- break; ! case 'E': par->icmp_echo_ping_discovery = true; break; *************** *** 195,199 **** char version_string[255]; ! sprintf(version_string, "%s v %s %s, %s", ICENAME, ICEVERSION, ICEWEBSITE, ICEDATE); std::cout << version_string << std::endl; --- 195,203 ---- char version_string[255]; ! time_t rawtime; ! ! time(&rawtime); ! ! sprintf(version_string, "%s v %s (%s) started at %s", ICENAME, ICEVERSION, ICEWEBSITE, ctime(&rawtime)); std::cout << version_string << std::endl; Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** csubtarget.h 28 Nov 2006 21:01:33 -0000 1.2 --- csubtarget.h 29 Nov 2006 12:51:01 -0000 1.3 *************** *** 6,9 **** --- 6,10 ---- #include <map> #include <errno.h> + #include <sys/timeb.h> #include <pthread.h> #include "iceoutput.h" *************** *** 77,81 **** --- 78,99 ---- bool discover(){ + struct timeb tp1, tp2; + + ftime(&tp1); discovered = host_discover(hostname, par, out); + ftime(&tp2); + + int secs = tp2.time - tp1.time; + int msecs = tp2.millitm - tp1.millitm; + + if(msecs < 0){ + secs--; + msecs = 1000 + msecs; + } + + float dt = secs + 0.001*msecs; + + if(par->verbose) *out << "Discovery taken " << dt << " seconds.\n"; + return discovered; } --- NEW FILE: CHANGELOG --- IceScan CHANGELOG (+ -- new feature, * -- bugfix) *** IceScan v. 0.0.3, 12 Dec 2006 *** + added printing time at startup. * fixed icmp echo discovery (icmplen). * fixed selecting discovery type from command line. Index: icediscover.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icediscover.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** icediscover.h 28 Nov 2006 18:59:18 -0000 1.2 --- icediscover.h 29 Nov 2006 12:51:01 -0000 1.3 *************** *** 107,113 **** char buf[1500]; //1500 == standart IP Packet size ! int len = r.recvfrom(buf, sizeof(buf), 0, hostname); ! ! //DBGOUTPUT(hostname); struct ip *ip = (struct ip *) buf; --- 107,111 ---- 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; *************** *** 117,122 **** 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)..."); --- 115,120 ---- 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)..."); *************** *** 141,147 **** *out << "Starting discovery of host " << hostname << "...\n"; ! if( tcp_ack_ping(hostname, par, out) ) return true; ! if( icmp_echo_ping(hostname, par, out) ) return true; return false; --- 139,145 ---- *out << "Starting discovery of host " << hostname << "...\n"; ! if(par->ack_ping_discovery) if( tcp_ack_ping(hostname, par, out) ) return true; ! if(par->icmp_echo_ping_discovery) if( icmp_echo_ping(hostname, par, out) ) return true; return false; Index: iceversion.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/iceversion.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iceversion.h 28 Nov 2006 17:57:54 -0000 1.1 --- iceversion.h 29 Nov 2006 12:51:01 -0000 1.2 *************** *** 4,8 **** #define ICENAME "IceScan" #define ICEVERSION "0.0.2" ! #define ICEWEBSITE "" // (http://sf.net/projects/...) #define ICEDATE "28 November 2006" --- 4,8 ---- #define ICENAME "IceScan" #define ICEVERSION "0.0.2" ! #define ICEWEBSITE "http://javanetsim.cvs.sourceforge.net/javanetsim/IceScan/" // (...) #define ICEDATE "28 November 2006" Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TODO 28 Nov 2006 21:01:33 -0000 1.3 --- TODO 29 Nov 2006 12:51:01 -0000 1.4 *************** *** 20,24 **** + Window Scan (-SW) [QweR] + Xmas Tree Scan (-SX) [QweR] ! + IP Protocol Scan (-SI) [Key] + Null Scan (-SN) [Key] + TCP SYN Scan (-SS) [Key] --- 20,24 ---- + Window Scan (-SW) [QweR] + Xmas Tree Scan (-SX) [QweR] ! + IP Protocol Scan (-SI) [Key] (??) + Null Scan (-SN) [Key] + TCP SYN Scan (-SS) [Key] |
From: Alexander B. <da...@us...> - 2006-11-28 21:01:54
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11204 Modified Files: iceparams.h icescan.cc TODO csubtarget.h Added Files: iceprotocol.h Log Message: no message Index: icescan.cc =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icescan.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** icescan.cc 28 Nov 2006 18:59:18 -0000 1.2 --- icescan.cc 28 Nov 2006 21:01:33 -0000 1.3 *************** *** 17,20 **** --- 17,22 ---- "SCAN TYPES:\n" "\t-ST: tcp connect() scan\n" + "\t-SB: udp NetBIOS scan\n" + "\t-SI: IP Protocol scan\n" "PORTS SPECIFICATION:\n" "\t-p <port range>: specify port range to scan (default 1-1024).\n" *************** *** 76,79 **** --- 78,86 ---- break; + case 'I': + par->scan_type = PROT_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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iceparams.h 28 Nov 2006 17:57:54 -0000 1.1 --- iceparams.h 28 Nov 2006 21:01:33 -0000 1.2 *************** *** 11,16 **** }; ! enum Scan_type {NO_SCAN, TCP_CONNECT_SCAN, NBT_SCAN}; ! // -S0 -ST -SB --- 11,16 ---- }; ! enum Scan_type {NO_SCAN, TCP_CONNECT_SCAN, NBT_SCAN, PROT_SCAN}; ! // -S0 -ST -SB -SI *************** *** 25,31 **** int UID; // we're root or not? ! // Target ! char *target; // PreScan settings --- 25,31 ---- int UID; // we're root or not? ! // Target ! char *target; // PreScan settings Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** csubtarget.h 28 Nov 2006 17:57:54 -0000 1.1 --- csubtarget.h 28 Nov 2006 21:01:33 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- #include "icediscover.h" #include "nbt_wrapper.h" + #include "iceprotocol.h" #define CONNECT_TIMEOUT 24 *************** *** 83,87 **** --- 84,96 ---- if(par->scan_type == TCP_CONNECT_SCAN) connect_scan(); if(par->scan_type == NBT_SCAN) nbt_scan(); + if(par->scan_type == PROT_SCAN) prot_scan(); } + + int prot_scan(){ + + cprotocol_scan cps(par, out); + cps.test(hostname); + + } int nbt_scan(){ Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TODO 28 Nov 2006 19:19:27 -0000 1.2 --- TODO 28 Nov 2006 21:01:33 -0000 1.3 *************** *** 20,24 **** + Window Scan (-SW) [QweR] + Xmas Tree Scan (-SX) [QweR] ! + IP Protocol Scan (-SO) [Key] + Null Scan (-SN) [Key] + TCP SYN Scan (-SS) [Key] --- 20,24 ---- + Window Scan (-SW) [QweR] + Xmas Tree Scan (-SX) [QweR] ! + IP Protocol Scan (-SI) [Key] + Null Scan (-SN) [Key] + TCP SYN Scan (-SS) [Key] --- NEW FILE: iceprotocol.h --- #ifndef ICEPROTOCOL_H #define ICEPROTOCOL_H #include "icesockets/csocket.h" #include "icesockets/crawsocket.h" // protocol scan and etc... class cprotocol_scan{ iceoutput *out; iceparams *par; public: cprotocol_scan(iceparams *par, iceoutput *out){ this->out = out; this->par = par; } int test(char *hostname){ //dummy return 0; char bufts[2] = " "; bufts[0] = 0; bufts[1] = 0; crawsocket r(AF_INET, SOCK_RAW, 6); r.sendto(hostname, bufts, sizeof(bufts), 0); DBGOUTPUT("packet sent"); char dhostname[1024] = ""; char buf[1500]; //1500 == standart IP Packet size int len = r.recvfrom(buf, sizeof(buf), 0, dhostname); DBGOUTPUT("packet recieved"); DBGOUTPUT(dhostname); } }; #endif |
From: Alexander B. <da...@us...> - 2006-11-28 21:01:43
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11204/icesockets Modified Files: csocket.h Log Message: no message Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** csocket.h 28 Nov 2006 17:57:54 -0000 1.1 --- csocket.h 28 Nov 2006 21:01:33 -0000 1.2 *************** *** 194,200 **** --- 194,207 ---- rsize = ::recvfrom(sid, buf, len, flags, (struct sockaddr *) &from, (socklen_t*) &fromlen); + //std::cout << "csocket:recvfrom : " << iptohost(from.sin_addr) << "\n"; + if (srchostname) strcpy(srchostname, iptohost(from.sin_addr)); + + //std::cout << "csocket:recvfrom2\n"; + if (srchostport) *srchostport = ntohs(from.sin_port); + //std::cout << "csocket:recvfrom3\n"; + return rsize; } |