1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 12:41:29 +00:00
Commit Graph

24 Commits

Author SHA1 Message Date
dmiller
36425f55a6 Fix make ndiff_check spurious failure
The code involving imp is equivalent to "from ndiff import *", and ndiff
imports StringIO.StringIO as StringIO, which meant that while ndifftest
intended the name to be the module, it was really the class. Just moved
the import later to be sure the name was the one we intend.
2014-05-22 02:25:47 +00:00
dmiller
2f23d996bd Prevent PyXML from importing, causing crashes
http://seclists.org/nmap-dev/2014/q2/318

Essentially, we import the xml name, then override its search path,
stripping out the _xmlplus paths that PyXML uses. This leaves only the
Python 2 standard library path, which is what Zenmap was written for.
2014-05-21 03:53:58 +00:00
dmiller
da0c947004 Enforce PEP 8 style on Ndiff
Issues fixed:

1       E111 indentation is not a multiple of four
1       E201 whitespace after '['
14      E251 no spaces around keyword / parameter equals
7       E301 expected 1 blank line, found 0
55      E302 expected 2 blank lines, found 1
69      E501 line too long (80 characters)
3       W291 trailing whitespace
4       W601 .has_key() is deprecated, use 'in'
2014-01-10 20:43:32 +00:00
dmiller
1e6db2b22c Make Ndiff install as a Python module as well as script
Discussion: http://seclists.org/nmap-dev/2013/q4/19
2013-10-17 19:20:49 +00:00
david
77fbcc8bc5 Get rid of ndiff.py symlink.
This existed only to allow importing the ndiff program as a module for
the ndifftest.py program. I found another way to do that.
2012-08-02 18:35:36 +00:00
david
5be27e7aad Do output as a byproduct of calculating the diff.
This doesn't require keeping the whole diff in memory until the end.
2011-12-21 06:59:46 +00:00
david
79ae90e80f Add nmaprun information to Ndiff output.
Patch by Daniel Miller.
2011-04-29 03:56:03 +00:00
david
9a65f4e010 Fix Ndiff unit test failure code found by Daniel Miller.
I guess this means the test was passing.
2011-04-28 22:14:54 +00:00
david
05e5348b57 Normalize the Ndiff exit codes.
0 if the scans are equal,
	1 if they differ, and
	2 for runtime errors.
Add tests and man page documentation.
2009-07-30 14:40:46 +00:00
david
3a4a181f2d Remove extraports state inference from Ndiff. This was a feature that,
if there was only one extraports state, would create a Port object for
each scanned port that was not listed explictly. So for example, if a
scan of 100 ports had 5 open ports and an extraports of "filtered",
Ndiff would create 95 port records in the "filtered" state in addition
to the 5 "open". If there was more than one extraports state this was
not possible.

This turned out to be a slow operation, out of all proportion to its
utility. Here are times for a diff of random-1.xml and random-2.xml,
before and after:

real    0m11.912s
user    0m10.970s
sys     0m0.249s

real    0m0.773s
user    0m0.726s
sys     0m0.046s

In most cases extraports are not shown in the output, so this was wasted
effort. I know of only one place where it affected the output, when an
extraports in the A scan because a non-extraports in a different state
in the B scan. Then the previous state would be included in the <a>
port, where now it will just be listed without a state.
2009-07-17 19:46:41 +00:00
david
b9f994e71d Add script output to Ndiff XML output. 2009-07-13 05:34:13 +00:00
david
a660b37026 Parse script results. 2009-07-10 23:55:29 +00:00
david
72949e27e8 Remove the test for the sort order of addresses. The idea behind that
was that if a host had multiple addresses of the same type, they should
be sorted numerically, not alphabetically. So 20.0.0.1 should come
before 100.0.0.1. But the way Nmap works, I don't think a host can have
more than one address of the same type, and it's not worth the code it
would take to make them sort properly if it did.
2009-07-10 23:30:32 +00:00
david
3d3e3b8515 Regnerate test scan files, add script scanning, version detection, and
OS detection to complex.xml.
2009-07-10 23:28:28 +00:00
david
98af0bba24 Add an append_raw method to the Table class to add an unformatted string
to a table. This is going to be for script output.
2009-07-10 01:25:39 +00:00
david
c701b9559b Merge from /nmap-exp/david/ndiff-mkii and
/nmap-exp/david/zenmap-ndiff-alt. This is the new Ndiff output format
described in http://seclists.org/nmap-dev/2009/q1/0825.html and
http://seclists.org/nmap-dev/2009/q2/0127.html.
2009-04-10 19:07:39 +00:00
david
72e9a1fd93 Adjust capitalization of "ndiff" to "Ndiff" in a couple of comments. 2009-03-26 01:57:57 +00:00
david
ccd55623c7 Record OS information in Ndiff. 2009-03-18 00:09:14 +00:00
david
fd41fcd0f7 Include service detection information in Ndiff output. Change the output format
from

	21/tcp is open, was filtered.
	23/tcp is open, was filtered.
	80/tcp is open, was filtered.
	8701/tcp is filtered, was open.

to

	-21/tcp filtered  
	+21/tcp open ftp Netgear broadband router ftpd 1.0
	-23/tcp filtered  
	+23/tcp open telnet Netgear broadband router admin telnetd
	-80/tcp filtered  
	+80/tcp open http Embedded Allegro RomPager webserver 4.07 UPnP/1.0 (ZyXEL ZyWALL 2)
	-8701/tcp open unknown 
	+8701/tcp filtered
2009-03-16 19:53:34 +00:00
david
91956287c2 Make each possible diff hunk its own class, rather than having them all be in
the DiffHunk class with a type tag. Now output is handled with polymorphism
rather than dispatching with if/else. It also better shows what members each
hunk type has.
2009-03-13 00:17:48 +00:00
david
c4b27a31b4 Don't ignore host state changes when the change is to the state "unknown". This
happens when a host was scanned in the A scan but wasn't scanned in the B scan.
I previously had it ignore such changes using the logic that the diff should be
like scan aggregation: no new information means no state change. But I think
it's more useful to see those changes in which hosts were scanned.

This is analogous to r10263, which did the same thing for port state changes.
2009-01-20 21:02:15 +00:00
david
efac5dd813 Add some missing words to a comment in ndifftest.py. 2008-11-21 17:40:36 +00:00
david
989117eb54 Update a unit test to match my new thinking about port state changes. 2008-09-19 00:42:53 +00:00
david
903e91a48b Move /nmap-exp/david/ndiff to /nmap/ndiff. 2008-09-18 23:31:19 +00:00