diff --git a/NmapOps.cc b/NmapOps.cc index 4dc3182e4..1ca0c23b9 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -249,6 +249,7 @@ void NmapOps::Initialize() { resolve_all = 0; dns_servers = NULL; noninteractive = false; + current_scantype = STYPE_UNKNOWN; } bool NmapOps::TCPScan() { diff --git a/NmapOps.h b/NmapOps.h index 835b421a8..ad60c2b94 100644 --- a/NmapOps.h +++ b/NmapOps.h @@ -292,7 +292,7 @@ class NmapOps { int numhosts_scanned; int numhosts_up; int numhosts_scanning; - stype scantype; + stype current_scantype; bool noninteractive; private: diff --git a/global_structures.h b/global_structures.h index bc7bdefb3..8fd28fece 100644 --- a/global_structures.h +++ b/global_structures.h @@ -228,6 +228,6 @@ struct scan_lists { int prot_count; }; -typedef enum { ACK_SCAN, SYN_SCAN, FIN_SCAN, XMAS_SCAN, UDP_SCAN, CONNECT_SCAN, NULL_SCAN, WINDOW_SCAN, RPC_SCAN, MAIMON_SCAN, IPPROT_SCAN, PING_SCAN, PING_SCAN_ARP, IDLE_SCAN, BOUNCE_SCAN, SERVICE_SCAN, OS_SCAN} stype; +typedef enum { STYPE_UNKNOWN, HOST_DISCOVERY, ACK_SCAN, SYN_SCAN, FIN_SCAN, XMAS_SCAN, UDP_SCAN, CONNECT_SCAN, NULL_SCAN, WINDOW_SCAN, RPC_SCAN, MAIMON_SCAN, IPPROT_SCAN, PING_SCAN, PING_SCAN_ARP, IDLE_SCAN, BOUNCE_SCAN, SERVICE_SCAN, OS_SCAN} stype; #endif /*GLOBAL_STRUCTURES_H */ diff --git a/nmap.cc b/nmap.cc index ff56e14d9..2e078e37d 100644 --- a/nmap.cc +++ b/nmap.cc @@ -1342,6 +1342,7 @@ int nmap_main(int argc, char *argv[]) { do { ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, ports); while(Targets.size() < ideal_scan_group_sz) { + o.current_scantype = HOST_DISCOVERY; currenths = nexthost(hstate, exclude_group, ports, &(o.pingtype)); if (!currenths) { /* Try to refill with any remaining expressions */ @@ -1481,13 +1482,13 @@ int nmap_main(int argc, char *argv[]) { for(targetno = 0; targetno < Targets.size(); targetno++) { currenths = Targets[targetno]; if (o.idlescan) { - o.scantype = IDLE_SCAN; + o.current_scantype = IDLE_SCAN; keyWasPressed(); // Check if a status message should be printed idle_scan(currenths, ports->tcp_ports, ports->tcp_count, idleProxy); } if (o.bouncescan) { - o.scantype = BOUNCE_SCAN; + o.current_scantype = BOUNCE_SCAN; keyWasPressed(); // Check if a status message should be printed if (ftp.sd <= 0) ftp_anon_connect(&ftp); if (ftp.sd > 0) bounce_scan(currenths, ports->tcp_ports, @@ -1496,7 +1497,7 @@ int nmap_main(int argc, char *argv[]) { } if (o.servicescan) { - o.scantype = SERVICE_SCAN; + o.current_scantype = SERVICE_SCAN; keyWasPressed(); // Check if a status message should be printed service_scan(Targets); } @@ -1966,6 +1967,8 @@ char *tsseqclass2ascii(int seqclass) { char *scantype2str(stype scantype) { switch(scantype) { + case STYPE_UNKNOWN: return "Unknown Scan Type"; break; + case HOST_DISCOVERY: return "Host Discovery"; break; case ACK_SCAN: return "ACK Scan"; break; case SYN_SCAN: return "SYN Stealth Scan"; break; case FIN_SCAN: return "FIN Scan"; break; diff --git a/osscan.cc b/osscan.cc index d35b07c53..f7257667e 100644 --- a/osscan.cc +++ b/osscan.cc @@ -1427,7 +1427,7 @@ int bestaccidx; if (target->timedOut(NULL)) return 1; -o.scantype = OS_SCAN; +o.current_scantype = OS_SCAN; #ifdef WIN32 if (target->ifType() == devt_loopback) { diff --git a/output.cc b/output.cc index 788797b9d..8f747d506 100644 --- a/output.cc +++ b/output.cc @@ -1493,7 +1493,7 @@ void printStatusMessage() { log_write(LOG_STDOUT, "Stats: %d:%02d:%02d elapsed; %d hosts completed (%d up), %d undergoing %s\n", time/60/24, time/60 % 24, time % 60, o.numhosts_scanned - o.numhosts_scanning, - o.numhosts_up, o.numhosts_scanning, scantype2str(o.scantype)); + o.numhosts_up, o.numhosts_scanning, scantype2str(o.current_scantype)); } diff --git a/scan_engine.cc b/scan_engine.cc index c792cb913..b72ba4862 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -3342,7 +3342,7 @@ void ultra_scan(vector &Targets, struct scan_lists *ports, stype scantype) { UltraScanInfo *USI = NULL; time_t starttime; - o.scantype = scantype; + o.current_scantype = scantype; if (Targets.size() == 0) { return; @@ -3437,7 +3437,7 @@ void ultra_scan(vector &Targets, struct scan_lists *ports, allow FTP bounce scan, I should really allow SOCKS proxy scan. */ void bounce_scan(Target *target, u16 *portarray, int numports, struct ftpinfo *ftp) { - o.scantype = BOUNCE_SCAN; + o.current_scantype = BOUNCE_SCAN; time_t starttime; int res , sd = ftp->sd, i=0; @@ -3607,7 +3607,7 @@ static void reverse_testing_order(struct portinfolist *pil, struct portinfo *sca scan. Now ultra_scan() does all of those, except for RPC scan, which is the only pos_scan now supported. */ void pos_scan(Target *target, u16 *portarray, int numports, stype scantype) { - o.scantype = scantype; + o.current_scantype = scantype; struct scanstats ss; int senddelay = 0;