mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 20:51:30 +00:00
Remove some dead gen-1 OS code.
This commit is contained in:
@@ -122,7 +122,6 @@ void Target::Initialize() {
|
|||||||
targetname = NULL;
|
targetname = NULL;
|
||||||
memset(&seq, 0, sizeof(seq));
|
memset(&seq, 0, sizeof(seq));
|
||||||
distance = -1;
|
distance = -1;
|
||||||
FPR1 = NULL;
|
|
||||||
FPR = NULL;
|
FPR = NULL;
|
||||||
osscan_flag = OS_NOTPERF;
|
osscan_flag = OS_NOTPERF;
|
||||||
wierd_responses = flags = 0;
|
wierd_responses = flags = 0;
|
||||||
@@ -178,7 +177,6 @@ void Target::FreeInternal() {
|
|||||||
nameIPBuf = NULL;
|
nameIPBuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FPR1) delete FPR1;
|
|
||||||
if (FPR) delete FPR;
|
if (FPR) delete FPR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
Target.h
3
Target.h
@@ -246,8 +246,7 @@ class Target {
|
|||||||
|
|
||||||
struct seq_info seq;
|
struct seq_info seq;
|
||||||
int distance;
|
int distance;
|
||||||
FingerPrintResults *FPR1; /* FP results get by the old OS scan system. */
|
FingerPrintResults *FPR; /* FP results get by the OS scan system. */
|
||||||
FingerPrintResults *FPR; /* FP results get by the new OS scan system. */
|
|
||||||
PortList ports;
|
PortList ports;
|
||||||
|
|
||||||
// unsigned int up;
|
// unsigned int up;
|
||||||
|
|||||||
13
nmap.cc
13
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");
|
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) {
|
char *seqreport(struct seq_info *seq) {
|
||||||
static char report[512];
|
static char report[512];
|
||||||
|
|
||||||
|
|||||||
@@ -233,15 +233,8 @@ void set_hostinfo(lua_State* l, Target *currenths) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FingerPrintResults *FPR = NULL;
|
FingerPrintResults *FPR = NULL;
|
||||||
int osscanSys;
|
|
||||||
|
|
||||||
if (currenths->FPR != NULL && currenths->FPR1 == NULL) {
|
FPR = currenths->FPR;
|
||||||
osscanSys = 2;
|
|
||||||
FPR = currenths->FPR;
|
|
||||||
} else if(currenths->FPR == NULL && currenths->FPR1 != NULL) {
|
|
||||||
osscanSys = 1;
|
|
||||||
FPR = currenths->FPR1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if there has been an os scan which returned a pretty certain
|
/* if there has been an os scan which returned a pretty certain
|
||||||
* result, we will use it in the scripts
|
* result, we will use it in the scripts
|
||||||
|
|||||||
57
output.cc
57
output.cc
@@ -1452,44 +1452,15 @@ void printosscanoutput(Target *currenths) {
|
|||||||
char numlst[512]; /* For creating lists of numbers */
|
char numlst[512]; /* For creating lists of numbers */
|
||||||
char *p; /* Used in manipulating numlst above */
|
char *p; /* Used in manipulating numlst above */
|
||||||
FingerPrintResults *FPR;
|
FingerPrintResults *FPR;
|
||||||
int osscanSys = 0;
|
|
||||||
int distance = -1;
|
int distance = -1;
|
||||||
int osscan_flag;
|
int osscan_flag;
|
||||||
|
|
||||||
if (!(osscan_flag = currenths->osscanPerformed()))
|
if (!(osscan_flag = currenths->osscanPerformed()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (currenths->FPR == NULL && currenths->FPR1 == NULL) {
|
if (currenths->FPR == NULL)
|
||||||
return;
|
return;
|
||||||
} else if (currenths->FPR != NULL && currenths->FPR1 == NULL) {
|
FPR = currenths->FPR;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currenths->distance != -1)
|
if (currenths->distance != -1)
|
||||||
distance = currenths->distance;
|
distance = currenths->distance;
|
||||||
@@ -1581,7 +1552,7 @@ void printosscanoutput(Target *currenths) {
|
|||||||
}
|
}
|
||||||
log_write(LOG_PLAIN, "\n");
|
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",
|
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,
|
mergeFPs(FPR->FPs, FPR->numFPs, true,
|
||||||
currenths->v4hostip(), distance, currenths->MACAddress(),
|
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).");
|
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)
|
if (o.verbose > 1 || o.debugging)
|
||||||
log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,
|
log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,
|
||||||
"\nTCP/IP fingerprint by osscan system #%d:\n%s",
|
"\nTCP/IP fingerprint:\n%s",
|
||||||
osscanSys, mergeFPs(FPR->FPs, FPR->numFPs, false,
|
mergeFPs(FPR->FPs, FPR->numFPs, false,
|
||||||
currenths->v4hostip(), distance, currenths->MACAddress(),
|
currenths->v4hostip(), distance, currenths->MACAddress(),
|
||||||
FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport,
|
FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport,
|
||||||
false));
|
false));
|
||||||
@@ -1616,7 +1587,7 @@ void printosscanoutput(Target *currenths) {
|
|||||||
const char *reason = FPR->OmitSubmissionFP();
|
const char *reason = FPR->OmitSubmissionFP();
|
||||||
if ((o.verbose > 1 || o.debugging) && reason)
|
if ((o.verbose > 1 || o.debugging) && reason)
|
||||||
log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,"OS fingerprint not ideal because: %s\n", 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",
|
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,
|
mergeFPs(FPR->FPs, FPR->numFPs, true,
|
||||||
currenths->v4hostip(), distance, currenths->MACAddress(),
|
currenths->v4hostip(), distance, currenths->MACAddress(),
|
||||||
@@ -1625,8 +1596,8 @@ void printosscanoutput(Target *currenths) {
|
|||||||
} else {
|
} else {
|
||||||
log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,"No OS matches for host\n");
|
log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT,"No OS matches for host\n");
|
||||||
if (o.verbose > 1)
|
if (o.verbose > 1)
|
||||||
log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT, "\nTCP/IP fingerprint by osscan system #%d:\n%s",
|
log_write(LOG_NORMAL|LOG_SKID_NOXLT|LOG_STDOUT, "\nTCP/IP fingerprint:\n%s",
|
||||||
osscanSys, mergeFPs(FPR->FPs, FPR->numFPs, false,
|
mergeFPs(FPR->FPs, FPR->numFPs, false,
|
||||||
currenths->v4hostip(), distance, currenths->MACAddress(),
|
currenths->v4hostip(), distance, currenths->MACAddress(),
|
||||||
FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport,
|
FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport,
|
||||||
false));
|
false));
|
||||||
@@ -1634,8 +1605,8 @@ void printosscanoutput(Target *currenths) {
|
|||||||
} else if (FPR->overall_results == OSSCAN_TOOMANYMATCHES || (FPR->num_perfect_matches > 8 && !o.debugging)) {
|
} 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");
|
log_write(LOG_PLAIN,"Too many fingerprints match this host to give specific OS details\n");
|
||||||
if (o.debugging || o.verbose > 1) {
|
if (o.debugging || o.verbose > 1) {
|
||||||
log_write(LOG_PLAIN,"TCP/IP fingerprint by osscan system #%d:\n%s",
|
log_write(LOG_PLAIN,"TCP/IP fingerprint:\n%s",
|
||||||
osscanSys, mergeFPs(FPR->FPs, FPR->numFPs, false,
|
mergeFPs(FPR->FPs, FPR->numFPs, false,
|
||||||
currenths->v4hostip(), distance, currenths->MACAddress(),
|
currenths->v4hostip(), distance, currenths->MACAddress(),
|
||||||
FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport,
|
FPR->osscan_opentcpport, FPR->osscan_closedtcpport, FPR->osscan_closedudpport,
|
||||||
false));
|
false));
|
||||||
@@ -1679,12 +1650,8 @@ void printosscanoutput(Target *currenths) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_write(LOG_XML, "<tcpsequence index=\"%li\" class=\"%s\" difficulty=\"%s\" values=\"%s\" />\n", (long) currenths->seq.index, seqclass2ascii(currenths->seq.seqclass), seqidx2difficultystr(currenths->seq.index), numlst);
|
log_write(LOG_XML, "<tcpsequence index=\"%li\" class=\"%s\" difficulty=\"%s\" values=\"%s\" />\n", (long) currenths->seq.index, seqclass2ascii(currenths->seq.seqclass), seqidx2difficultystr(currenths->seq.index), numlst);
|
||||||
if (o.verbose) {
|
if (o.verbose)
|
||||||
if (osscanSys == 1)
|
log_write(LOG_PLAIN,"%s", seqreport(&(currenths->seq)));
|
||||||
log_write(LOG_PLAIN,"%s", seqreport1(&(currenths->seq)));
|
|
||||||
else if(osscanSys == 2)
|
|
||||||
log_write(LOG_PLAIN,"%s", seqreport(&(currenths->seq)));
|
|
||||||
}
|
|
||||||
|
|
||||||
log_write(LOG_MACHINE,"\tSeq Index: %d", currenths->seq.index);
|
log_write(LOG_MACHINE,"\tSeq Index: %d", currenths->seq.index);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user