[Javanetsim-cvs] IceScan udpscan.h, 1.17, 1.18 csubtarget.h, 1.49, 1.50
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-12-19 09:04:54
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16702 Modified Files: udpscan.h csubtarget.h Log Message: no message Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** csubtarget.h 19 Dec 2006 00:01:26 -0000 1.49 --- csubtarget.h 19 Dec 2006 09:04:49 -0000 1.50 *************** *** 514,519 **** response = readip_pcap(p, &len, NULL); port = 0; ! if(response){ ip = (struct iphdr *) response; if(ip->saddr == saddress.sin_addr.s_addr && ip->protocol == IPPROTO_TCP){ --- 514,520 ---- response = readip_pcap(p, &len, NULL); port = 0; ! //DBGOUTPUT("while"); if(response){ + //DBGOUTPUT("response"); ip = (struct iphdr *) response; if(ip->saddr == saddress.sin_addr.s_addr && ip->protocol == IPPROTO_TCP){ Index: udpscan.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/udpscan.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** udpscan.h 19 Dec 2006 00:01:26 -0000 1.17 --- udpscan.h 19 Dec 2006 09:04:49 -0000 1.18 *************** *** 72,79 **** int recvbytes; unsigned int len; int port; char* response; char hostname[80]; - bool next = true; int recvsize = UDP_SCAN_RECVSIZE; struct timeval tv1,tv2; --- 72,79 ---- int recvbytes; unsigned int len; + bool next = true; int port; char* response; char hostname[80]; int recvsize = UDP_SCAN_RECVSIZE; struct timeval tv1,tv2; *************** *** 91,115 **** sudp.nonblock(true); pcap_t* p = init_pcap(par->source_iface); //check for NULL ! if(p == NULL){ out->line("Can't open pcap: no raw tcp scan. Exitting."); return false; ! } ! char filter_exp[256]; ! sprintf(filter_exp, "icmp", destname.c_str()); ! pcap_filter(p, filter_exp); ! //sicmp.nonblock(true); ! ! int size = 60 * 1024; ! //sicmp.setsockopt(SOL_SOCKET, SO_RCVBUF, (sockbuf_type *) &size, sizeof(size)); ! for(repeats = 1; repeats <= UDP_SCAN_REPEATS && next; repeats++){ ! for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end() && next; ++i){ if(! (*i).second.done ){ sudp.sendto(destname.c_str(), (*i).first, zmsg, UDP_SCAN_ZSIZE, 0); ! iceusleep(50000*repeats); } ! ! do{ ! recvbytes = sudp.recvfrom(recvmsg, UDP_SCAN_RECVSIZE, 0, NULL, NULL); if(recvbytes > 0){ struct udphdr* udp = (struct udphdr*) recvmsg; --- 91,109 ---- sudp.nonblock(true); pcap_t* p = init_pcap(par->source_iface); //check for NULL ! if(p == NULL){ out->line("Can't open pcap: no raw tcp scan. Exitting."); return false; ! } ! for(repeats = 1; repeats <= UDP_SCAN_REPEATS && next; repeats++){ ! for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end() && next; ++i){ if(! (*i).second.done ){ sudp.sendto(destname.c_str(), (*i).first, zmsg, UDP_SCAN_ZSIZE, 0); ! iceusleep(100000*repeats); } ! ! gettimeofday(&tv1, 0); ! do{ ! recvbytes = sudp.recvfrom(recvmsg, UDP_SCAN_RECVSIZE, 0, NULL, NULL); if(recvbytes > 0){ struct udphdr* udp = (struct udphdr*) recvmsg; *************** *** 122,154 **** else{ result = true; ! next = false; ! } } } else{ ! gettimeofday(&tv1, 0); ! do{ ! response = readip_pcap(p, &len, NULL); ! if(response){ ! recvbytes = len; ! port = parse_icmp_udp_packet(response, len, saddress, par, out); ! if(port!=0 && !scanning_ports[port].done && !(scanning_ports.find(port) == scanning_ports.end())){ ! if(isscan){ ! scanning_ports[port].done = true; ! subtarget->set_port_status(port, PORT_CLOSED, "udp"); ! } ! else{ ! result = true; ! next = false; ! } ! } ! } ! iceusleep(1); ! gettimeofday(&tv2, 0); ! }while(SUB_TIMEVALS(tv2,tv1) < 50000*repeats); } ! iceusleep(50000*repeats); ! }while(recvbytes > 0 && next); ! } } if(isscan){ --- 116,147 ---- else{ result = true; ! next = false; ! } } } else{ ! ! response = readip_pcap(p, &len, NULL); ! if(response){ ! recvbytes = len; ! port = parse_icmp_udp_packet(response, len, saddress, par, out); ! if(port!=0 && !scanning_ports[port].done && !(scanning_ports.find(port) == scanning_ports.end())){ ! if(isscan){ ! scanning_ports[port].done = true; ! subtarget->set_port_status(port, PORT_CLOSED, "udp"); ! } ! else{ ! result = true; ! next = false; ! } ! } ! } ! iceusleep(1); ! } ! gettimeofday(&tv2, 0); ! }while(SUB_TIMEVALS(tv2,tv1) < 50000*repeats); ! ! } } if(isscan){ |