Nmap Development mailing list archives

Re: ndiff syntax error


From: David Fifield <david () bamsoftware com>
Date: Fri, 11 Sep 2009 12:42:17 -0600

On Fri, Sep 11, 2009 at 12:02:15PM -0400, craig bowser wrote:
Hi all, been trying out nmap5 on XP and I've run into a problem for which I
hope someone can either help or point me to a more appropriate place to get
help.

I ran several scans using the following syntax:

nmap -v -sV -sC -O -iL <filename.txt> -oN nmap#.txt

I realized that to run ndiff I needed Python so I installed Python 3.1.1.
But I get errors when I try to run ndiff.

First, out of the box so to speak, I got the following:

C:\pstools\nmap5>ndiff nmap3.xml nmap4.xml
  File "C:\pstools\nmap5\ndiff.py", line 26
SyntaxError: Non-UTF-8 code starting with '\x92' in file
C:\pstools\nmap5\ndiff.
py on line 26, but no encoding declared; see
http://python.org/dev/peps/pep-0263
/ for details

Line 26 is:

NDIFF_XML_VERSION = uā€™1ā€™

I'm not much of a programmer, but I have been trying to read "Learning
Python" 3rd Ed, by Mark Lutz published by O'Reilly and according to that
book, the syntax is correct.  I tried changing it to NDIFF_XML_VERSION =
u"1" as the book implied that the type of quote marks didn't matter, but I
got the same error.  I then tried commenting out that line.

# NDIFF_XML_VERSION = uā€™1ā€™

Oddly enough, I got the same error as before.  I then changed the line to:

NDIFF_XML_VERSION = u1.encode('utf-8')

ran ndiff again and I got:

C:\pstools\nmap5>ndiff nmap3.xml nmap4.xml
  File "C:\pstools\nmap5\ndiff.py", line 82
    address_s = u", ".join(a.s for a in sorted(self.addresses))
                    ^
SyntaxError: invalid syntax

Changing that line from:

address_s = u", ".join(a.s for a in sorted(self.addresses))

to:

address_s = u.join(a.s for a in sorted(self.addresses))

only gets me the following result:

C:\pstools\nmap5>ndiff nmap3.xml nmap4.xml
  File "C:\pstools\nmap5\ndiff.py", line 87
    return u"%s (%s)" % (hostname_s, address_s)
                    ^
SyntaxError: invalid syntax

At this point, I'm thinking I must be doing something wrong from the
beginning....  any ideas?

Thanks for writing. Ndiff requires Python 2.4, 2.5, or 2.6. Python 3 is
not compatible with these versions. Ndiff could perhaps be made
compatible with Python 3, but it hasn't been done yet. Try running it
with the most recent version of Python 2.6.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: