Nmap Development mailing list archives

Re: nmap --iflist bug on Windows


From: Daniel Miller <bonsaiviking () gmail com>
Date: Tue, 10 May 2016 09:11:10 -0500

Niels,

Thanks for bringing this up. Here's the code in question that is causing
this behavior (libdnet-stripped/src/intf-win32.c):

  for (addr = a->FirstUnicastAddress; addr != NULL; addr = addr->Next) {
    IP_ADAPTER_PREFIX *prefix;
    unsigned short bits;

    /* Find the netmask length. This is stored in a parallel list.
       We just take the first one with a matching address family,
       but that may not be right. Windows Vista and later has an
       OnLinkPrefixLength member that is stored right with the
       unicast address. */
    bits = 0;
    for (prefix = a->FirstPrefix; prefix != NULL; prefix = prefix->Next) {
      if (prefix->Address.lpSockaddr->sa_family ==
addr->Address.lpSockaddr->sa_family) {
        bits = (unsigned short) prefix->PrefixLength;
        break;
      }
    }

So it sounds like there's an easy fix for Vista and later, but we're
tentatively still supporting Windows XP at this point. I think that what we
would need to do is to actually compare each prefix to the address in
question and only accept the prefix length if they match. I'll be putting
this into our issues tracker on Github, and hope to have it solved by the
next release.

Dan

2016-05-09 9:59 GMT-05:00 Niels Bohr <niels.bohr () spielbank-sh de>:

Hi,



I’m writing a GUI, script collection for nmap and came across following
problem:



Running nmap 7.12 on a Windows 7 x64 PC the –iflist outputs the wrong
netmask if you have multiple ip’s on 1 interface with different netmasks.

If you configure a 192.168.0.1/24 and 10.0.0.1/8 as ip on the same
network card, nmap outputs either:

192.168.0.1/24

10.0.0.1/24



Or



10.0.0.1/8

192.168.0.1/8



The netmask is correct for the first ip found on the device on then used
for the second.



I tested the same on debian linux with nmap 6.47, the output is correct.



Kind regards

Niels






_________________________________________________________________________________________________

Diese E-Mail und ihre etwaig vorhandenen Anhänge sind ausschließlich für
den beabsichtigten Empfänger bestimmt und können vertrauliche Informationen
enthalten. Jegliche vom Absender nicht ausdrücklich oder durch eindeutiges
schlüssiges Verhalten (welches nicht mit der Übersendung der E-Mail
begründet wird) beabsichtigte Veröffentlichung, Vervielfältigung,
Weiterleitung oder anderweitige Verwertung ist untersagt und kann straf-
oder zivilrechtlich verfolgt werden. Falls Sie diese E-Mail irrtümlich
erhalten haben, bitten wir Sie um kurze Nachricht per Telefon oder Fax.
Bitte löschen Sie die E-Mail und alle eventuell vorhandenen Kopien
unverzüglich von Ihrem Computer-System und veranlassen Sie die Löschung
etwaig vorhandener Backups auf anderen Datenträgern, wenn Sie nicht der
beabsichtigte Empfänger sein sollten.

This e-mail, its content and any files transmitted with it are
confidential and may be legally privileged. If you receive it in error or
if you are not the intended recipient you must not copy, distribute or take
any action in reliance upon it. Please notify us immediately by telephone
or fax and delete the e-mail, its attachments and any existing backups.

*Spielbank SH GmbH *• Eggerstedtstr.1 • 24103 Kiel
Tel.: +49 (431) 981 55 - 0 • Fax: +49 (431) 981 55 - 20  •
www.spielbank-sh.de
Registergericht AG Kiel HRB 4371 · Steuernummer 19 297 297 92 · UID
(VAT)-Nº. DE812971534
Geschäftsführer:  Jürgen Kiehne






_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: