Nmap Development mailing list archives

ndiff syntax error


From: craig bowser <reswob10 () gmail com>
Date: Fri, 11 Sep 2009 12:02:15 -0400

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.

Craig

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


Current thread: