From 39ac78e0bf711754e760041b34b6d0267859a6db Mon Sep 17 00:00:00 2001 From: fyodor Date: Mon, 3 Sep 2007 19:48:44 +0000 Subject: [PATCH] fixed a bug which prevented the 1st aggressive OS guess (i.e. when there are no exact matches) from being printed to XML output. Bug found by Martyn Tovey --- output.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/output.cc b/output.cc index 67f30ba44..cf295f71c 100644 --- a/output.cc +++ b/output.cc @@ -1475,11 +1475,19 @@ void printosscanoutput(Target *currenths) { 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 ((o.osscan_guess || reason) && FPR->num_matches > 0) { + char *p; /* Print the best guesses available */ log_write(LOG_PLAIN,"Aggressive OS guesses: %s (%d%%)", FPR->prints[0]->OS_name, (int) (FPR->accuracy[0] * 100)); + log_write(LOG_XML, "\n", + p = xml_convert(FPR->prints[0]->OS_name), + (int) (FPR->accuracy[0] * 100), + FPR->prints[0]->line); + free(p); + for(i=1; i < 10 && FPR->num_matches > i && FPR->accuracy[i] > FPR->accuracy[0] - 0.10; i++) { - char *p; + log_write(LOG_PLAIN,", %s (%d%%)", FPR->prints[i]->OS_name, (int) (FPR->accuracy[i] * 100)); log_write(LOG_XML, "\n", p = xml_convert(FPR->prints[i]->OS_name),