1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-17 21:19:01 +00:00

fix a bug related to status reporting during dns

This commit is contained in:
fyodor
2006-05-05 00:43:29 +00:00
parent 02a5e06e8b
commit 1c5f438be0
7 changed files with 14 additions and 10 deletions

View File

@@ -249,6 +249,7 @@ void NmapOps::Initialize() {
resolve_all = 0; resolve_all = 0;
dns_servers = NULL; dns_servers = NULL;
noninteractive = false; noninteractive = false;
current_scantype = STYPE_UNKNOWN;
} }
bool NmapOps::TCPScan() { bool NmapOps::TCPScan() {

View File

@@ -292,7 +292,7 @@ class NmapOps {
int numhosts_scanned; int numhosts_scanned;
int numhosts_up; int numhosts_up;
int numhosts_scanning; int numhosts_scanning;
stype scantype; stype current_scantype;
bool noninteractive; bool noninteractive;
private: private:

View File

@@ -228,6 +228,6 @@ struct scan_lists {
int prot_count; 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 */ #endif /*GLOBAL_STRUCTURES_H */

View File

@@ -1342,6 +1342,7 @@ int nmap_main(int argc, char *argv[]) {
do { do {
ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, ports); ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, ports);
while(Targets.size() < ideal_scan_group_sz) { while(Targets.size() < ideal_scan_group_sz) {
o.current_scantype = HOST_DISCOVERY;
currenths = nexthost(hstate, exclude_group, ports, &(o.pingtype)); currenths = nexthost(hstate, exclude_group, ports, &(o.pingtype));
if (!currenths) { if (!currenths) {
/* Try to refill with any remaining expressions */ /* 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++) { for(targetno = 0; targetno < Targets.size(); targetno++) {
currenths = Targets[targetno]; currenths = Targets[targetno];
if (o.idlescan) { if (o.idlescan) {
o.scantype = IDLE_SCAN; o.current_scantype = IDLE_SCAN;
keyWasPressed(); // Check if a status message should be printed keyWasPressed(); // Check if a status message should be printed
idle_scan(currenths, ports->tcp_ports, idle_scan(currenths, ports->tcp_ports,
ports->tcp_count, idleProxy); ports->tcp_count, idleProxy);
} }
if (o.bouncescan) { if (o.bouncescan) {
o.scantype = BOUNCE_SCAN; o.current_scantype = BOUNCE_SCAN;
keyWasPressed(); // Check if a status message should be printed keyWasPressed(); // Check if a status message should be printed
if (ftp.sd <= 0) ftp_anon_connect(&ftp); if (ftp.sd <= 0) ftp_anon_connect(&ftp);
if (ftp.sd > 0) bounce_scan(currenths, ports->tcp_ports, if (ftp.sd > 0) bounce_scan(currenths, ports->tcp_ports,
@@ -1496,7 +1497,7 @@ int nmap_main(int argc, char *argv[]) {
} }
if (o.servicescan) { if (o.servicescan) {
o.scantype = SERVICE_SCAN; o.current_scantype = SERVICE_SCAN;
keyWasPressed(); // Check if a status message should be printed keyWasPressed(); // Check if a status message should be printed
service_scan(Targets); service_scan(Targets);
} }
@@ -1966,6 +1967,8 @@ char *tsseqclass2ascii(int seqclass) {
char *scantype2str(stype scantype) { char *scantype2str(stype scantype) {
switch(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 ACK_SCAN: return "ACK Scan"; break;
case SYN_SCAN: return "SYN Stealth Scan"; break; case SYN_SCAN: return "SYN Stealth Scan"; break;
case FIN_SCAN: return "FIN Scan"; break; case FIN_SCAN: return "FIN Scan"; break;

View File

@@ -1427,7 +1427,7 @@ int bestaccidx;
if (target->timedOut(NULL)) if (target->timedOut(NULL))
return 1; return 1;
o.scantype = OS_SCAN; o.current_scantype = OS_SCAN;
#ifdef WIN32 #ifdef WIN32
if (target->ifType() == devt_loopback) { if (target->ifType() == devt_loopback) {

View File

@@ -1493,7 +1493,7 @@ void printStatusMessage() {
log_write(LOG_STDOUT, log_write(LOG_STDOUT,
"Stats: %d:%02d:%02d elapsed; %d hosts completed (%d up), %d undergoing %s\n", "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, 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));
} }

View File

@@ -3342,7 +3342,7 @@ void ultra_scan(vector<Target *> &Targets, struct scan_lists *ports,
stype scantype) { stype scantype) {
UltraScanInfo *USI = NULL; UltraScanInfo *USI = NULL;
time_t starttime; time_t starttime;
o.scantype = scantype; o.current_scantype = scantype;
if (Targets.size() == 0) { if (Targets.size() == 0) {
return; return;
@@ -3437,7 +3437,7 @@ void ultra_scan(vector<Target *> &Targets, struct scan_lists *ports,
allow FTP bounce scan, I should really allow SOCKS proxy scan. */ allow FTP bounce scan, I should really allow SOCKS proxy scan. */
void bounce_scan(Target *target, u16 *portarray, int numports, void bounce_scan(Target *target, u16 *portarray, int numports,
struct ftpinfo *ftp) { struct ftpinfo *ftp) {
o.scantype = BOUNCE_SCAN; o.current_scantype = BOUNCE_SCAN;
time_t starttime; time_t starttime;
int res , sd = ftp->sd, i=0; 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, scan. Now ultra_scan() does all of those, except for RPC scan,
which is the only pos_scan now supported. */ which is the only pos_scan now supported. */
void pos_scan(Target *target, u16 *portarray, int numports, stype scantype) { void pos_scan(Target *target, u16 *portarray, int numports, stype scantype) {
o.scantype = scantype; o.current_scantype = scantype;
struct scanstats ss; struct scanstats ss;
int senddelay = 0; int senddelay = 0;