From 9f646914277158eb77c85830945c55aee9f2398d Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 3 Jun 2008 18:05:45 +0000 Subject: [PATCH] On windows, the --iflist option was not reporting correct windevice values and not displaying all ethernet devices if the user had interface aliases set up. Now all Windevice values and interface device ID's will be properly linked together. --- CHANGELOG | 6 +++++- output.cc | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 30b1f0bc5..02f026600 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ # Nmap Changelog ($Id$); -*-text-*- -Nmap 4.65 [2008-6-1] +Nmap 4.65 [2008-6-3] +o Nmap now returns correct values for --iflist in windows even + if interface aliases have been set. Previously it would misreport + the windevices and not list all interfaces. [Michael] + o Nmap no longer crashes with an 'assert' error when its told to access a disabled wifi NIC on some laptops. [Michael] diff --git a/output.cc b/output.cc index 82d4a3fde..ee3cd68c7 100644 --- a/output.cc +++ b/output.cc @@ -341,13 +341,21 @@ int print_iflist(void) { Tbl->addItem(0, 0, false, "DEV"); Tbl->addItem(0, 1, false, "WINDEVICE"); i = numifs; - - for(p_iface_iter = p_ifaces; p_iface_iter != NULL && i >= 1; i--) { - Tbl->addItem(i, 0, false, iflist[i-1].devname); - Tbl->addItem(i, 1, false, p_iface_iter->name); - p_iface_iter = p_iface_iter->next; - } - + { + //the previous interface that we printed to screen + char * lastface=""; + //Now print off all the interfaces, we check to make sure we dont print any duplicate interfaces. + //In the case of an interface alias, iflist will have a double entry but p_iface_iter + //will only have one. So we check to make sure we only print out one copy of each hardware interface. + for(p_iface_iter = p_ifaces; p_iface_iter != NULL && i >= 1; i--) { + if(strcmp(lastface,iflist[i-1].devname)!=0){ + Tbl->addItem(i, 0, false, iflist[i-1].devname); + Tbl->addItem(i, 1, false, p_iface_iter->name); + p_iface_iter = p_iface_iter->next; + lastface = iflist[i-1].devname; + } + } + } log_write(LOG_PLAIN, "%s\n", Tbl->printableTable(NULL)); log_flush_all(); delete Tbl;