[Javanetsim-cvs] IceScan TODO,1.13,1.14 csubtarget.h,1.32,1.33
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-12-16 14:42:46
|
Update of /cvsroot/javanetsim/IceScan In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1407 Modified Files: TODO csubtarget.h Log Message: no message Index: csubtarget.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/csubtarget.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** csubtarget.h 16 Dec 2006 11:39:17 -0000 1.32 --- csubtarget.h 16 Dec 2006 14:42:43 -0000 1.33 *************** *** 16,19 **** --- 16,21 ---- #define CONNECT_TIMEOUT 14 + #define MAX_PACKETS 512 + #ifdef __CYGWIN__ #define ICE_FD_SETSIZE (128) *************** *** 384,393 **** perror("Setsockopt HDRINCL:"); - int attempts = 0; ! while(attempts++ < 5){ ! for(std::map <int, scanning_port>::iterator i = scanning_ports.begin(); i!= scanning_ports.end(); ++i){ ! if(! (*i).second.done ){ ! switch(par->scan_type){ case FIN_SCAN: --- 386,408 ---- perror("Setsockopt HDRINCL:"); ! ! int l = scanning_ports.size()/MAX_PACKETS; ! if(scanning_ports.size() % MAX_PACKETS != 0) l++; ! ! ! int j = 0; ! while(j < l){ ! int attempts = 0; ! while(attempts++ < 10){ ! std::map <int, scanning_port>::iterator i = scanning_ports.begin(); ! ! DBGOUTPUT(attempts); ! ! for(int k=0; k < MAX_PACKETS*j; k++) i++; ! j++; ! ! for(int k = j*MAX_PACKETS; (k < (j+1)*MAX_PACKETS) && i!= scanning_ports.end(); ++i, k++){ ! if(! (*i).second.done ){ switch(par->scan_type){ case FIN_SCAN: *************** *** 418,505 **** (*i).second.attempt++; ! iceusleep(1000); } ! } ! ! iceusleep(500000); ! int bytes; ! char response[65535]; ! struct iphdr *ip = (struct iphdr *) response; ! struct tcphdr *tcp; ! int at = 0; ! ! while(at++<10){ ! while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ ! if(ip->saddr = saddress.sin_addr.s_addr){ ! tcp = (struct tcphdr *) (response + 4 * ip->ihl); ! ! if ((tcp->th_flags & TH_RST) && (par->scan_type == FIN_SCAN || par->scan_type == NULL_SCAN || par->scan_type == XMAS_SCAN)) { ! int closed_port = ntohs(tcp->th_sport); ! ! if(scanning_ports.find(closed_port) != scanning_ports.end()){ ! if(!scanning_ports[closed_port].done){ ! set_port_status(closed_port, PORT_CLOSED, "tcp"); ! scanning_ports[closed_port].done = true; ! } ! } ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == WINDOW_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! scanning_ports[port].done = true; ! if(tcp->th_win == 0){ ! set_port_status(port, PORT_CLOSED, "tcp"); ! }else{ ! set_port_status(port, PORT_OPEN, "tcp"); ! } ! } ! } ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == ACK_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! set_port_status(port, PORT_UNFILTERED, "tcp"); ! scanning_ports[port].done = true; ! } ! } ! }else if ((tcp->th_flags & TH_RST) && (par->scan_type == SYN_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(port != MAGIC_PORT){ ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! scanning_ports[port].done = true; ! set_port_status(port, PORT_CLOSED, "tcp"); ! } ! } ! } ! }else if ((tcp->th_flags & (TH_ACK|TH_SYN)) && (par->scan_type == SYN_SCAN)) { ! int port = ntohs(tcp->th_sport); ! ! if(port != MAGIC_PORT){ ! ! if(scanning_ports.find(port) != scanning_ports.end()){ ! if(!scanning_ports[port].done){ ! set_port_status(port, PORT_OPEN, "tcp"); ! rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, port, 0, 0, TH_RST, 0, 0, 0); ! scanning_ports[port].done = true; ! } ! } ! } ! } ! ! ! } ! bzero(response, 65534); ! } ! iceusleep(1000); } } --- 433,449 ---- (*i).second.attempt++; ! recieve_tcp_raw(rawrecv, rawsend, source, saddress, scanning_ports, MAGIC_PORT); } ! } ! usleep(1000000); ! int at = 0; ! while(at++<100){ ! recieve_tcp_raw(rawrecv, rawsend, source, saddress, scanning_ports, MAGIC_PORT); ! iceusleep(1000); } + } } *************** *** 519,522 **** --- 463,538 ---- } + void recieve_tcp_raw(crawsocket &rawrecv, crawsocket &rawsend, icestring &source, struct sockaddr_in &saddress, std::map <int, scanning_port> &scanning_ports, int MAGIC_PORT){ + int bytes; + char response[65535]; + struct iphdr *ip = (struct iphdr *) response; + struct tcphdr *tcp; + + while( bytes = rawrecv.recvfrom(response, 65535, 0, NULL) > 0){ + if(ip->saddr = saddress.sin_addr.s_addr){ + tcp = (struct tcphdr *) (response + 4 * ip->ihl); + + if ((tcp->th_flags & TH_RST) && (par->scan_type == FIN_SCAN || par->scan_type == NULL_SCAN || par->scan_type == XMAS_SCAN)) { + int closed_port = ntohs(tcp->th_sport); + + if(scanning_ports.find(closed_port) != scanning_ports.end()){ + if(!scanning_ports[closed_port].done){ + set_port_status(closed_port, PORT_CLOSED, "tcp"); + scanning_ports[closed_port].done = true; + } + } + }else if ((tcp->th_flags & TH_RST) && (par->scan_type == WINDOW_SCAN)) { + int port = ntohs(tcp->th_sport); + + if(scanning_ports.find(port) != scanning_ports.end()){ + if(!scanning_ports[port].done){ + scanning_ports[port].done = true; + if(tcp->th_win == 0){ + set_port_status(port, PORT_CLOSED, "tcp"); + }else{ + set_port_status(port, PORT_OPEN, "tcp"); + } + } + } + }else if ((tcp->th_flags & TH_RST) && (par->scan_type == ACK_SCAN)) { + int port = ntohs(tcp->th_sport); + + + if(scanning_ports.find(port) != scanning_ports.end()){ + if(!scanning_ports[port].done){ + set_port_status(port, PORT_UNFILTERED, "tcp"); + scanning_ports[port].done = true; + } + } + }else if ((tcp->th_flags & TH_RST) && (par->scan_type == SYN_SCAN)) { + int port = ntohs(tcp->th_sport); + + if(port != MAGIC_PORT){ + + if(scanning_ports.find(port) != scanning_ports.end()){ + if(!scanning_ports[port].done){ + scanning_ports[port].done = true; + set_port_status(port, PORT_CLOSED, "tcp"); + } + } + } + }else if ((tcp->th_flags & (TH_ACK|TH_SYN)) && (par->scan_type == SYN_SCAN)) { + int port = ntohs(tcp->th_sport); + + if(port != MAGIC_PORT){ + + if(scanning_ports.find(port) != scanning_ports.end()){ + if(!scanning_ports[port].done){ + set_port_status(port, PORT_OPEN, "tcp"); + rawsend.send_tcp_raw(source, hostname, MAGIC_PORT, port, 0, 0, TH_RST, 0, 0, 0); + scanning_ports[port].done = true; + } + } + } + } + bzero(response, 65534); + } + } + } void shutdown_scansocket(int j){ Index: TODO =================================================================== RCS file: /cvsroot/javanetsim/IceScan/TODO,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TODO 16 Dec 2006 12:18:05 -0000 1.13 --- TODO 16 Dec 2006 14:42:43 -0000 1.14 *************** *** 16,22 **** --- 16,25 ---- -- Scanning -- + + Mainmon scan (-SM, FIN/ACK) + UDP Scan (-SU) [QweR] + IP Protocol Scan (-SI) [Key] (??) * do setting random window/seq(ack and seg) for raw scanning + + --ttl option and ttl random generation + + --badchksum option + ARP Scan + Fingerprint (??) |