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

314 Commits

Author SHA1 Message Date
david
a4f6dc6b6e Merge from /nmap-exp/david/nmap-os.
This brings in four discrete changes:

1. The widening of ranges for T test expressions in nmap-os-db. Any expressions
   that were not already ranges were expanded to cover plus and minus five of
   their original values.
2. The normalization of TG expressions in nmap-os-db. Nmap is only capable of
   outputting 0x20, 0x40, 0x80, and 0xFF for a TG value, but many fingerprints
   had values other than these. They have all been rounded to their nearest
   likely value.
3. The elimination of the U1.TOS and IE.TOSI tests (both having to do with type
   of service). This was effected by setting their MatchPoints to 0.
4. A cleanup and refactoring of OS fingerprint output code. This should not
   have any impact on output, except in one case: when debugging is non-zero or
   verbosity is greater than one, and at least one perfect match was found,
   Nmap used to print "OS Fingerprint:" before the fingerprint. Now it prints
   "TCP/IP fingerprint:" in this case like in all the others.
2008-10-31 22:46:07 +00:00
david
0d372367c0 Remove "\r\r" in script output. If you print "\r\n", the Windows C library will
transform it to "\r\r\n". So we just print "\n" with no special case for
Windows.
2008-09-12 21:33:14 +00:00
david
20853ec49f Make xml_convert escape any character > 0x7F, and use xml_convert to escape the
value of the "args" attribute.

On Windows, I created a user account with the name "Kurt Gödel". When I ran a
scan in Zenmap, Nmap created a temporary XML file that started like

<?xml version="1.0" ?>
<?xml-stylesheet href="nmap.xsl" type="text/xsl"?>
<!-- Nmap 4.75 scan initiated Wed Sep 10 11:16:58 2008 as: nmap -T4 -F -oX c:\docume~1\kurtgö~1\locals~1\temp\zenmap-bcbuy6.xml 192.168.0.1 -->
<nmaprun scanner="nmap" args="nmap -T4 -F -oX c:\docume~1\kurtgö~1\locals~1\temp\zenmap-bcbuy6.xml 192.168.0.1" start="1221067018" startstr="Wed Sep 10 11:16:58 2008" version="4.75" xmloutputversion="1.02">

Notice the ö characters in the file names. They were not in UTF-8 but probably
whatever the filesystem encoding is. Because Nmap's XML does not declare an
encoding, it defaults to UTF-8, meaning this particular file was not even
well-formed. In Zenmap it caused a crash like

CRASH REPORTED:
SYS.PLATFORM: win32
OS.NAME: nt
Zenmap Version: 4.75
TRACEBACK:
Traceback (most recent call last):
  File "C:\cygwin\home\david\nmap\zenmap\zenmapGUI\ScanNotebook.py", line 387, in verify_execution
    self.load_from_command(scan)
  File "C:\cygwin\home\david\nmap\zenmap\zenmapGUI\ScanNotebook.py", line 400, in load_from_command
    parsed = self._parse(command.get_xml_output_filename())
  File "C:\cygwin\home\david\nmap\zenmap\zenmapGUI\ScanNotebook.py", line 444, in _parse
    parsed.parse_file(file_to_parse)
  File "C:\cygwin\home\david\nmap\zenmap\zenmapCore\NmapParser.py", line 749, in parse_file
    self.parse(f)
  File "C:\cygwin\home\david\nmap\zenmap\zenmapCore\NmapParser.py", line 743, in parse
    self.parser.parse(f)
  File "c:\Python25\lib\xml\sax\expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "c:\Python25\lib\xml\sax\xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "c:\Python25\lib\xml\sax\expatreader.py", line 211, in feed
    self._err_handler.fatalError(exc)
  File "c:\Python25\lib\xml\sax\handler.py", line 38, in fatalError
    raise exception
SAXParseException: c:\docume~1\kurtgö~1\locals~1\temp\zenmap-bcbuy6.xml:3:92: not well-formed (invalid token)

Plus Internet Explorer wouldn't even open it.

This change escapes the XML so it looks like

<?xml version="1.0" ?>
<?xml-stylesheet href="nmap.xsl" type="text/xsl"?>
<!-- Nmap 4.75 scan initiated Wed Sep 10 11:52:19 2008 as: nmap -PE -PA21,23,80,3389 -A -v -T4 -oX c:\docume~1\kurtg&#xF6;~1\locals~1\temp\zenmap-zih7f5.xml 192.168.0.1 -->
<nmaprun scanner="nmap" args="nmap -PE -PA21,23,80,3389 -A -v -T4 -oX c:\docume~1\kurtg&#xF6;~1\locals~1\temp\zenmap-zih7f5.xml 192.168.0.1" start="1221069139" startstr="Wed Sep 10 11:52:19 2008" version="4.75" xmloutputversion="1.02">
2008-09-10 18:32:35 +00:00
david
0a64626a4c Change the output label "Uptime" to "Uptime guess" and print it only in verbose
mode.
2008-08-26 17:40:19 +00:00
michael
931285f765 Updated DTD, XML version, and anded scanflags attribute to scaninfo element. 2008-08-13 00:59:22 +00:00
david
c5d4075db5 Oops, move the definition of the now-static function formatScriptOutput to
above where it's used.
2008-08-05 19:58:21 +00:00
david
9621ab338a Make some change to make --without-liblua work again. 2008-08-05 19:28:51 +00:00
michael
4a7022bf04 Updated as per Davids request. I misinterpreted what David said and made a change, when he really meant for me to suggest the change in the mailing list rather then just committing it. 2008-08-02 20:42:11 +00:00
michael
64219d7e41 Change suggested by Fyodor 2008-08-02 20:05:38 +00:00
michael
aaf2a60970 Fixed typo from previous patch 2008-08-02 19:45:04 +00:00
michael
a4542861a8 Nmaps XML output will now report that an idle scan has occurred in the 'scaninfo' element when applicable. 2008-08-02 19:28:30 +00:00
fyodor
7f9dff09c3 report scan time to hundredths of a second, not thousandths 2008-07-11 07:29:09 +00:00
batrick
13452505a5 Added ScriptResult class change in order to avoid managing string memory
created via strdup(). Script output and id (strings) are now C++ std::string.
2008-07-07 17:37:08 +00:00
kris
d0a2ec9d50 Adding support for NSE + Ping Scan (-sP) for executing host scripts. So "-sPC", "-sP --script all" and "-sP --script ripeQuery" all work correctly 2008-07-03 04:11:42 +00:00
fyodor
f810762936 Increase write buffer length for Nmap output on Windows. This should
prevent error messages like: "log_vwrite: vnsprintf failed.  Even after
increasing bufferlen to 819200, Vsnprintf returned -1 (logt == 1)."
Thanks to prozente0 for the report.
2008-06-28 21:23:39 +00:00
michael
30d60b97ed setServiceXMLBuf now uses the string class exclusively instead of the old c-string & string class combination. So it is no longer necessary to calculate the length of the XML service element before writing it to its buffer. 2008-06-21 05:45:11 +00:00
michael
f0cbbe45f8 Fixed a segfault in printportoutput() and setServiceXMLBuf() in output.cc.
Thanks for pointing this out Brandon.
2008-06-20 22:00:40 +00:00
michael
4863010770 Service fingerprints are no longer truncated in XML logs. 2008-06-20 03:25:53 +00:00
david
902d3dcf0f Break the libdnet->libpcap mapping output into its own function. 2008-06-12 16:58:16 +00:00
david
07515db1d5 Int the DEV/WINDEVICE output, additionally show the "leftover" libpcap devices,
those that don't have a libdnet name that maps to them. This should be a help
in debugging, as it now shows all the libdnet names, all the libpcap names, and
how they all relate to each other.
2008-06-12 16:42:03 +00:00
david
d8ad54907c Protect the WINDEVICE output code with #ifdef WIN32. 2008-06-12 01:45:06 +00:00
david
0101e9e0ab Change the DEV/WINDEVICE output (the part that shows the mapping from
dnet names to WinPcap names) to use the no-nonsense approach of simply
calling DnetName2PcapName for every interface returned by getinterfaces.
DnetName2PcapName calls intf_get_pcap_devname, which is same function
called by eth_open on Windows, so now the output really reflects Nmap's
view of the world.

This doesn't remove interface aliases, so if you have any aliases
enabled, you will see what look like duplicated lines. I have chosen to
leave them in for now to assist with debugging if any alias-related
problems come up in the future. They could be taken out easily if this
is not desired.

This brings what may be a startling change: the lo0 loopback interface
no longer maps to /Device/NPF_GenericDialupAdapter, but to no adapter at
all (signified by "<none>"). I believe the old behavior was wrong,
merely an artifact of the way the code happened to line up two lists of
interfaces. /Device/NFP_GenericDialupAdapter is for dialup and VPN
capture, and the loopback interface isn't supported by WinPcap (or
Windows for that matter) at all. See
http://www.winpcap.org/misc/faq.htm#Q-5
http://www.winpcap.org/misc/faq.htm#Q-13
2008-06-12 00:57:49 +00:00
michael
9f64691427 On windows, the --iflist option was not reporting correct windevice values and not displaying all ethernet devices if the user had interface aliases set up. Now all Windevice values and interface device ID's will be properly linked together. 2008-06-03 18:05:45 +00:00
david
d3263f0f1a Fix grepable output "Ignored State" reporting. Only one ignored state (the one
with the highest numbers of ports) is output.
2008-05-29 20:05:02 +00:00
fyodor
779b96a197 trivial copyright text tweak: filename nmap-os-fingerprints has changed to nmap-os-db 2008-05-22 20:45:32 +00:00
fyodor
e843583ef3 o Nmap now reports scan start and end times for individual hosts
within a larger scan. The information is added to the XML host
  element like so: [host starttime="1198292349" endtime="1198292370"]
  (but of couse with angle brackets rather than square ones).  It is
  also printed in normal output if -d or "-v -v" are
  specified. [Brandon, Kris, Fyodor]
2008-05-09 05:21:44 +00:00
bmenrigh
9b9d2bd85e Updated all the stray calls to rand() to use nbase_rnd instead. The
only code left in Nmap that still uses rand() is in the Lua math 
library.  Perhaps at some point we'll need to expose high-quality random 
numbers to Lua via our custom nmap library.
2008-05-06 01:05:51 +00:00
fyodor
10b54b773b minor license template updates from Kris--fix gnu.org link to GPLv2 (moved) and openssl license filename (COPYING.OpenSSL) 2008-05-05 04:10:00 +00:00
david
1ea0135dc8 Fix printStatusMessage to show the correct elapsed time after 24
minutes. Part of what printStatusMessage does is display the total
elapsed time. The code looked like this:

  log_write(LOG_STDOUT, 
	    "Stats: %d:%02d:%02d elapsed; %d hosts completed (%d up), %d undergoing %s\n", 
	    time/60/24, time/60 % 24, time % 60, o.numhosts_scanned - o.numhosts_scanning, 
	    o.numhosts_up, o.numhosts_scanning, scantype2str(o.current_scantype));

where time is the number of seconds since the program started. However,
this code acts as though each hour has only 24 minutes. That is, after
0:23:59 it would become 1:00:00. This commit changes the 24s to 60s to
make it work right.
2008-04-23 22:42:41 +00:00
david
c0490af2fd Remove mentions of the TCP sequence class in XML output. 2008-04-11 18:57:32 +00:00
david
c7017806cc Remove some dead gen-1 OS code. 2008-04-11 03:54:44 +00:00
fyodor
5551c5a311 o Fixed a bunch of code to avoid compilation warning messages (at
least on some Linux machines) [Andrew J. Bennieston]
2008-04-09 02:11:20 +00:00
fyodor
1accc12fb2 fix typo in legal header found by Leigh Zhao (missing word: of) 2008-02-28 18:52:06 +00:00
doug
0012bd6192 Let XML output include "good" (G=N) fingerprints. 2008-01-20 23:52:23 +00:00
fyodor
29c912f394 URL change from http://insecure.org/nmap/* to http://nmap.org/* 2008-01-17 07:22:03 +00:00
fyodor
b686bc1964 We now escape newlines, carriage returns, and tabs (\n\r\t) in XML
output.  While those are allowed in XML attributes, they get
  normalized which can make formatting the output difficult for
  applications which parse Nmap XML. [Joao Medeiros, David, Fyodor]
2008-01-13 22:13:53 +00:00
fyodor
8220c8a42f update copyright line at the top of files from 1996-2006 to 1996-2008 2007-12-22 06:32:03 +00:00
david
b131ed23fa Fix the message printed when a host is skipped, for example on Windows when
attempting to scan localhost. It used to look like
  All 0 scanned ports on 127.0.0.1 are 
("Are what?") Now it looks like
  0 ports scanned on 127.0.0.1
2007-12-14 09:53:42 +00:00
david
48dec0f9d9 Escape OS fingerprints when writing them to an XML log. OS fingerprint don't
currently contain any characters that need escaping, but this makes them
future-proof. This was noticed by João Medeiros.
2007-12-14 07:31:17 +00:00
kris
9ae985ef59 okay, a change to r6530: the current %R and %T are being removed as colons are invalid chracters in Windows and Mac OS X filenames (thanks to jah for pointing out the problem on Windows). What was %r and %t are now the new %R and %T. All this means is that %r and %t are gone, and %R/%T are the same as with strftime() but without colons 2007-12-14 04:04:22 +00:00
kris
2425765f4e Adding my strftime()-like conversion extensions to the logging functions (-oA, -oX, etc). This contains a CHANGELOG entry and refguide changes which (hopefully) sum it up pretty well. 2007-12-13 21:22:57 +00:00
kris
1b1fcc753b Adding a new ping type: IPProto Ping. It's used with '-PO'. I've changed references to -P0 (zero) to -PN throughout the source code and refguide.xml 2007-10-28 00:05:03 +00:00
fyodor
ad74d5a4b0 change IPID to IP ID in Nmap output as I think the latter is more proper, though if anyone thinks IPID is better, I'm happy to hear your reasons. 2007-09-08 21:43:51 +00:00
fyodor
4dda435692 make text line up better 2007-09-07 00:14:19 +00:00
fyodor
39ac78e0bf fixed a bug which prevented the 1st aggressive OS guess (i.e. when there are no exact matches) from being printed to XML output. Bug found by Martyn Tovey 2007-09-03 19:48:44 +00:00
fyodor
6d405bebaf change wording slightly when Nmap finishes. Say 'Nmap done' rather than 'Nmap run completed' or 'Nmap finished'. Its shorter. 2007-08-27 09:28:16 +00:00
kris
d073a19105 Change reason.cc/h to portreasons.cc/h. This is because of a reason.h on Windows which causes compilation problems. A workaround was employed, but this is incase it pops up again. I also changed the recent CHANGELOG entry mentioning reason.h so there's no confusion 2007-08-15 19:26:26 +00:00
kris
0b50c16b38 Adding Snprintf() and Vsnprintf() to nbase/nbase_str.c. This is because of Windows' stupid implementation where it doesn't write a NULL byte at the end of the buffer if the result is truncated. I would've just #defined snprintf and vsnprintf to some wrapper function for Windows, but this doesn't work as libdnet and libpcap (and libpcap includes under mswin32) define snprintf to _snprintf and vsnprintf to _vsnprintf like we do, and through the many defines they end up being available in the Nmap sources. Vsnprintf() uses vsnprintf() (and writes a NULL byte at the end if truncated), and Snprintf uses Vsnprintf(). 2007-08-14 06:46:54 +00:00
fyodor
23e9e0b1d2 merge soc07 r5225 - fix for systems which return -1 when vsnprintf doesn't have enough space rather than returning the amount of space needed. 2007-08-11 05:56:10 +00:00
fyodor
622995be62 merge soc07 r5209 - --iflist bug. The parameters to NmapOutputTable were in the wrong order but due to the number of interfaces on my computer it still worked 2007-08-11 05:54:20 +00:00