[Javanetsim-cvs] IceScan csubtarget.h,1.7,1.8
Status: Beta
Brought to you by:
darkkey
|
From: QweR <qw...@us...> - 2006-12-12 20:34:16
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10094 Modified Files: csubtarget.h Log Message: Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** csubtarget.h 12 Dec 2006 20:07:50 -0000 1.7 --- csubtarget.h 12 Dec 2006 20:33:24 -0000 1.8 *************** *** 34,41 **** class scanning_port{ public: - char hostname[24]; int port_number; bool done; ! long time; int socket_ptr; }; --- 34,40 ---- class scanning_port{ public: int port_number; bool done; ! long time; int socket_ptr; }; *************** *** 69,73 **** std::vector<scanned_port> subtarget_ports; ! csubtarget(const char *hostname, const char *reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ DBGOUTPUT("!!!!"); --- 68,72 ---- std::vector<scanned_port> subtarget_ports; ! csubtarget(icestring hostname, icestring reverse_hostname, iceparams *par, iceoutput *out, ice_service_name_database *isnd){ DBGOUTPUT("!!!!"); *************** *** 79,86 **** DBGOUTPUT("!!!!"); ! this->hostname = (char *) malloc(strlen(hostname) + 1); ! strcpy(this->hostname, hostname); ! this->reversed_hostname = (char *) malloc(strlen(reverse_hostname) + 1); ! strcpy(this->reversed_hostname, reverse_hostname); this->par = par; this->out = out; --- 78,83 ---- DBGOUTPUT("!!!!"); ! this->hostname = hostname; ! this->reversed_hostname = reverse_hostname; this->par = par; this->out = out; *************** *** 97,101 **** ftime(&tp1); ! discovered = host_discover(hostname, par, out); ftime(&tp2); --- 94,98 ---- ftime(&tp1); ! discovered = host_discover(hostname.c_str(), par, out); ftime(&tp2); *************** *** 114,118 **** cprotocol_scan cps(par, out); ! cps.test(hostname); } --- 111,115 ---- cprotocol_scan cps(par, out); ! cps.test(hostname.c_str()); } *************** *** 123,127 **** if(par->verbose>0){ ! sprintf(output_buf, "Starting NetBIOS scan against %s...", hostname); out->line(output_buf); } --- 120,124 ---- if(par->verbose>0){ ! sprintf(output_buf, "Starting NetBIOS scan against %s...", hostname.c_str()); out->line(output_buf); } *************** *** 129,137 **** cnbtwrapper wrap(par); ! wrap.test(hostname, 137); if(par->verbose>0){ bzero(output_buf, 255); ! sprintf(output_buf, "NetBIOS scan finished.", hostname); out->line(output_buf); } --- 126,134 ---- cnbtwrapper wrap(par); ! wrap.test(hostname.c_str(), 137); if(par->verbose>0){ bzero(output_buf, 255); ! sprintf(output_buf, "NetBIOS scan finished.", hostname.c_str()); out->line(output_buf); } *************** *** 155,162 **** if(par->verbose>0){ ! sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname); out->line(output_buf); } - int j = initiate_connect(scanning_ports); DBGOUTPUT(j); --- 152,158 ---- if(par->verbose>0){ ! sprintf(output_buf, "Starting tcp connect() scan against %s...", hostname.c_str()); out->line(output_buf); } int j = initiate_connect(scanning_ports); DBGOUTPUT(j); *************** *** 167,171 **** if(par->verbose>0){ bzero(output_buf, 255); ! sprintf(output_buf, "Connect() scan finished.", hostname); out->line(output_buf); } --- 163,167 ---- if(par->verbose>0){ bzero(output_buf, 255); ! sprintf(output_buf, "Connect() scan finished.", hostname.c_str()); out->line(output_buf); } *************** *** 203,207 **** } ! void init_scanning_ports(char *hostname, iceparams *par, int domain, std::map <int, scanning_port> &scanning_ports){ for(int j = 0; j<par->ports.size(); j++){ port_range pr = par->ports[j]; --- 199,203 ---- } ! void init_scanning_ports(icestring hostname, iceparams *par, int domain, std::map <int, scanning_port> &scanning_ports){ for(int j = 0; j<par->ports.size(); j++){ port_range pr = par->ports[j]; *************** *** 212,216 **** sp.port_number = i; scanning_ports[i] = sp; - strcpy(scanning_ports[i].hostname, hostname); scanning_ports[i].done = false; } --- 208,211 ---- *************** *** 259,263 **** FD_SET(scan_sockets[j].sid, &fd_x); (*i).second.time = time(0); ! int rc = c.connect((*i).second.hostname, (*i).first, 0); DBGOUTPUT("!!!!!"); } --- 254,258 ---- FD_SET(scan_sockets[j].sid, &fd_x); (*i).second.time = time(0); ! int rc = c.connect(hostname.c_str(), (*i).first, 0); DBGOUTPUT("!!!!!"); } *************** *** 313,317 **** scanning_ports[prt].time = time(0); //DBGOUTPUT(scanning_ports[prt].hostname); ! int rc = c.connect(scanning_ports[prt].hostname, prt, 0); switch(rc){ --- 308,312 ---- scanning_ports[prt].time = time(0); //DBGOUTPUT(scanning_ports[prt].hostname); ! int rc = c.connect(hostname.c_str(), prt, 0); switch(rc){ *************** *** 339,349 **** if(ps == PORT_OPEN && par->verbose >= 1){ ! sprintf(output_buf, "Discovered open port %d/tcp on %s.", port, hostname); out->line(output_buf); }else if(ps == PORT_CLOSED && par->verbose > 1){ ! sprintf(output_buf, "Discovered closed port %d/tcp on %s.", port, hostname); out->line(output_buf); }else if(ps == PORT_FILTERED && par->verbose > 2){ ! sprintf(output_buf, "Discovered filtered port %d/tcp on %s.", port, hostname); out->line(output_buf); } --- 334,344 ---- if(ps == PORT_OPEN && par->verbose >= 1){ ! sprintf(output_buf, "Discovered open port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); }else if(ps == PORT_CLOSED && par->verbose > 1){ ! sprintf(output_buf, "Discovered closed port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); }else if(ps == PORT_FILTERED && par->verbose > 2){ ! sprintf(output_buf, "Discovered filtered port %d/tcp on %s.", port, hostname.c_str()); out->line(output_buf); } *************** *** 388,391 **** --- 383,387 ---- enum port_status status = PORT_UNKNOWN; + if(s >= 0 && (FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_rtmp) || FD_ISSET(scan_sockets[(*i).second.socket_ptr].sid, &fd_wtmp) || *************** *** 399,403 **** DBGOUTPUT("!!!!"); ! switch(sopt){ case 0: --- 395,399 ---- DBGOUTPUT("!!!!"); ! switch(sopt){ case 0: *************** *** 498,506 **** else if(open == 0 && closed <= MAX_CLOSED) show_closed = true; ! if(strcmp(hostname, reversed_hostname)) ! *out << "Interesting ports on " << reversed_hostname << " (" << hostname << "):" << iceoutput::endl; ! else ! *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; //DBGOUTPUT(filtered); --- 494,503 ---- else if(open == 0 && closed <= MAX_CLOSED) show_closed = true; ! // if(strcmp(hostname, reversed_hostname)) ! // *out << "Interesting ports on " << reversed_hostname << " (" << hostname << "):" << iceoutput::endl; ! // else ! // *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; + *out << "Interesting ports on " << hostname << ":" << iceoutput::endl; //DBGOUTPUT(filtered); *************** *** 539,544 **** ~csubtarget(){ //DBGOUTPUT("Entering destructor..."); ! free(hostname); ! free(reversed_hostname); free(scan_sockets); subtarget_ports.clear(); --- 536,541 ---- ~csubtarget(){ //DBGOUTPUT("Entering destructor..."); ! //free(hostname); ! //free(reversed_hostname); free(scan_sockets); subtarget_ports.clear(); |