diff --git a/Target.cc b/Target.cc index a04365c27..3cf9ac011 100644 --- a/Target.cc +++ b/Target.cc @@ -122,7 +122,6 @@ void Target::Initialize() { targetname = NULL; memset(&seq, 0, sizeof(seq)); distance = -1; - FPR1 = NULL; FPR = NULL; osscan_flag = OS_NOTPERF; wierd_responses = flags = 0; @@ -178,7 +177,6 @@ void Target::FreeInternal() { nameIPBuf = NULL; } - if (FPR1) delete FPR1; if (FPR) delete FPR; } diff --git a/Target.h b/Target.h index 1ba6eaf29..3b8a84623 100644 --- a/Target.h +++ b/Target.h @@ -246,8 +246,7 @@ class Target { struct seq_info seq; int distance; - FingerPrintResults *FPR1; /* FP results get by the old OS scan system. */ - FingerPrintResults *FPR; /* FP results get by the new OS scan system. */ + FingerPrintResults *FPR; /* FP results get by the OS scan system. */ PortList ports; // unsigned int up; diff --git a/nmap.cc b/nmap.cc index f0632e007..975dfe17c 100644 --- a/nmap.cc +++ b/nmap.cc @@ -2358,19 +2358,6 @@ n -sS -O -v example.com/24\n\ f --spoof \"/usr/local/bin/pico -z hello.c\" -sS -oN e.log example.com/24\n\n"); } -char *seqreport1(struct seq_info *seq) { - static char report[512]; - - Snprintf(report, sizeof(report), "TCP Sequence Prediction: Difficulty=%d (%s)\n", seq->index, seqidx2difficultystr1(seq->index)); - return report; -} - -/* Convert a TCP sequence prediction difficulty index like 1264386 - into a difficulty string like "Worthy Challenge */ -const char *seqidx2difficultystr1(unsigned long idx) { - return (idx < 10)? "Trivial joke" : (idx < 80)? "Easy" : (idx < 3000)? "Medium" : (idx < 5000)? "Formidable" : (idx < 100000)? "Worthy challenge" : "Good luck!"; -} - char *seqreport(struct seq_info *seq) { static char report[512]; diff --git a/nse_nmaplib.cc b/nse_nmaplib.cc index a9543be6a..22eb8d64b 100644 --- a/nse_nmaplib.cc +++ b/nse_nmaplib.cc @@ -233,15 +233,8 @@ void set_hostinfo(lua_State* l, Target *currenths) { } FingerPrintResults *FPR = NULL; - int osscanSys; - if (currenths->FPR != NULL && currenths->FPR1 == NULL) { - osscanSys = 2; - FPR = currenths->FPR; - } else if(currenths->FPR == NULL && currenths->FPR1 != NULL) { - osscanSys = 1; - FPR = currenths->FPR1; - } + FPR = currenths->FPR; /* if there has been an os scan which returned a pretty certain * result, we will use it in the scripts diff --git a/output.cc b/output.cc index 0a450d0eb..c46987008 100644 --- a/output.cc +++ b/output.cc @@ -1452,44 +1452,15 @@ void printosscanoutput(Target *currenths) { char numlst[512]; /* For creating lists of numbers */ char *p; /* Used in manipulating numlst above */ FingerPrintResults *FPR; - int osscanSys = 0; int distance = -1; int osscan_flag; if (!(osscan_flag = currenths->osscanPerformed())) return; - if (currenths->FPR == NULL && currenths->FPR1 == NULL) { + if (currenths->FPR == NULL) return; - } else if (currenths->FPR != NULL && currenths->FPR1 == NULL) { - osscanSys = 2; - FPR = currenths->FPR; - } else if (currenths->FPR == NULL && currenths->FPR1 != NULL) { - osscanSys = 1; - FPR = currenths->FPR1; - } - else { - /* Neither is NULL. This happens when new OS scan system fails to - get a perfect match and falls back on the old OS scan - system. */ - if (currenths->FPR->num_perfect_matches > 0) { - osscanSys = 2; - FPR = currenths->FPR; /* Just an ensurance. */ - } else if (currenths->FPR1->num_perfect_matches > 0) { - osscanSys = 1; - FPR = currenths->FPR1; - } else if (currenths->FPR->overall_results == OSSCAN_SUCCESS) { - osscanSys = 2; - FPR = currenths->FPR; - } else if (currenths->FPR1->overall_results == OSSCAN_SUCCESS) { - osscanSys = 1; - FPR = currenths->FPR1; - } else { - /* Both fails. */ - osscanSys = 2; - FPR = currenths->FPR; - } - } + FPR = currenths->FPR; if (currenths->distance != -1) distance = currenths->distance; @@ -1581,7 +1552,7 @@ void printosscanoutput(Target *currenths) { } log_write(LOG_PLAIN, "\n"); } - if (osscanSys == 2 && !reason) { + if (!reason) { log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,"No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ).\nTCP/IP fingerprint:\n%s\n", mergeFPs(FPR->FPs, FPR->numFPs, true, currenths->v4hostip(), distance, currenths->MACAddress(), @@ -1593,8 +1564,8 @@ void printosscanoutput(Target *currenths) { log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,"No exact OS matches for host (test conditions non-ideal)."); if (o.verbose > 1 || o.debugging) log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT, - "\nTCP/IP fingerprint by osscan system #%d:\n%s", - osscanSys, mergeFPs(FPR->FPs, FPR->numFPs, false, + "\nTCP/IP fingerprint:\n%s", + mergeFPs(FPR->FPs, FPR->numFPs, false, currenths->v4hostip(), distance, currenths->MACAddress(), FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport, false)); @@ -1616,7 +1587,7 @@ void printosscanoutput(Target *currenths) { const char *reason = FPR->OmitSubmissionFP(); if ((o.verbose > 1 || o.debugging) && reason) log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,"OS fingerprint not ideal because: %s\n", reason); - if (osscanSys == 2 && !reason) { + if (!reason) { log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,"No OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ).\nTCP/IP fingerprint:\n%s\n", mergeFPs(FPR->FPs, FPR->numFPs, true, currenths->v4hostip(), distance, currenths->MACAddress(), @@ -1625,8 +1596,8 @@ void printosscanoutput(Target *currenths) { } else { log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,"No OS matches for host\n"); if (o.verbose > 1) - log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT, "\nTCP/IP fingerprint by osscan system #%d:\n%s", - osscanSys, mergeFPs(FPR->FPs, FPR->numFPs, false, + log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT, "\nTCP/IP fingerprint:\n%s", + mergeFPs(FPR->FPs, FPR->numFPs, false, currenths->v4hostip(), distance, currenths->MACAddress(), FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport, false)); @@ -1634,8 +1605,8 @@ void printosscanoutput(Target *currenths) { } else if (FPR->overall_results == OSSCAN_TOOMANYMATCHES || (FPR->num_perfect_matches > 8 && !o.debugging)) { log_write(LOG_PLAIN,"Too many fingerprints match this host to give specific OS details\n"); if (o.debugging || o.verbose > 1) { - log_write(LOG_PLAIN,"TCP/IP fingerprint by osscan system #%d:\n%s", - osscanSys, mergeFPs(FPR->FPs, FPR->numFPs, false, + log_write(LOG_PLAIN,"TCP/IP fingerprint:\n%s", + mergeFPs(FPR->FPs, FPR->numFPs, false, currenths->v4hostip(), distance, currenths->MACAddress(), FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport, false)); @@ -1679,12 +1650,8 @@ void printosscanoutput(Target *currenths) { } log_write(LOG_XML, "\n", (long) currenths->seq.index, seqclass2ascii(currenths->seq.seqclass), seqidx2difficultystr(currenths->seq.index), numlst); - if (o.verbose) { - if (osscanSys == 1) - log_write(LOG_PLAIN,"%s", seqreport1(&(currenths->seq))); - else if(osscanSys == 2) - log_write(LOG_PLAIN,"%s", seqreport(&(currenths->seq))); - } + if (o.verbose) + log_write(LOG_PLAIN,"%s", seqreport(&(currenths->seq))); log_write(LOG_MACHINE,"\tSeq Index: %d", currenths->seq.index); }