Nmap Development mailing list archives
Re: Error readling file containing IP address
From: Brandon Enright <bmenrigh () ucsd edu>
Date: Wed, 15 Sep 2010 20:05:16 +0000
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 14 Sep 2010 22:42:41 +0200 Pat Aud <secsys33 () gmail com> wrote:
Hello, I tested under Linux and Windows and discovered something strange in nmap 5.35-DC1 using a file containing a list of IP address. Example of file : ipliste.txt 192.168.1.1 192.168.1.5 Command line : nmap -iL ipliste.txt Error message : Invalid character in host specification. Note in particular that square brackets [] are no longer allowed. They were redundant and can simply be removed. QUITTING! Workaround : Under Linux, the ipliste.txt file is UTF-8 encoded with BOM (Byte Order Mark). If I remove BOM, I don't have anymore the message. I used Geany editor to remove BOM. Under Windows, if I use an UTF-8 or UCS-2 LE file, I have the same message. If I converted the file in ANSI, I don't have anymore the problem. Any idea ? Is it a bug ? Is it possible to known the limitations regarding address, hostnames files. Thanks for your help, SecSys33{at}gmai{dot}com
Pat, I'm hesitant to call this a bug or a feature but rather just a "limitation" in the implementation. -iL is handled via a routine called read_host_from_file() in netutil.cc. It just does reads bytes in via getc() which are just bytes. This means the only acceptable encoding is ASCII. If you used a UTF8 file without the BOM, Nmap would still fail if it hit any Unicode (non-ASCII) characters. The same goes for UCS-2/UTF-16. The '\0' chars would trip the parsing up. Regards, Brandon -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEARECAAYFAkyRJwIACgkQqaGPzAsl94JlagCfQ9ehTMCWPUnjBgwJhqamk7x6 BMEAoIgANDkN2MrAivZ6WLtIiu8vctyn =tWhr -----END PGP SIGNATURE----- _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Error readling file containing IP address Pat Aud (Sep 14)
- Re: Error readling file containing IP address Brandon Enright (Sep 15)