1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-08 05:31:31 +00:00
Commit Graph

320 Commits

Author SHA1 Message Date
david
ab09f1974f Adjust indentation and expand tabs in option parsing code. 2009-08-19 17:47:49 +00:00
fyodor
0df6272cf9 Signal handling fixes: fixed nbase configure to actually set HAVE_SIGNAL
properly so our signal handing code actually activates.  But our signal
handling code was a bit questionable in many respects, so I removed most
of it under the theory that it hasn't been working for years and nobody
seemed to notice/care, so we presumably don't really need it.  And if we
do decide to add it again, we basically will need to do it over because
we now want to do it safely from a reentrancy perspective.  In particular,
I removed sigdie() and reaper().  We still have a few signal() calls.  In
particular, we ignore SIGPIPE and we set SIGINT, SIGTERM, SIGHUP, and
SIGSEGV to the defaults (SIG_DFL) explicitly.  Thanks to Ithilgore, Luis,
and Solar Designer in particular for fidning or commenting on the issue.
2009-08-13 21:54:55 +00:00
josh
df71e36084 Updated uses of the ctype function to support explict casting of the arguments
to (int)(unsigned char).
2009-08-06 15:10:00 +00:00
kris
8b13026ef9 update ip_is_reserved(): 175/8 and 182/8 allocated this month 2009-08-03 19:35:16 +00:00
david
d6c9e19a2c Add -Pn and -sn synonyms for -PN and -sP respectively. 2009-07-19 05:13:07 +00:00
batrick
59b2c83234 If neither --script nor -sV is present, then do not load NSE. Before, NSE
would load despite script scanning not being activated. See [1] for
preliminary patch from Solar Designer and motivation.

[1] http://seclists.org/nmap-dev/2009/q3/0207.html
2009-07-18 14:56:07 +00:00
david
5c33e639ae Using --scan-delay always implies a parallelism of 1. Change the fatal
error

You can't use --max-parallelism with --scan-delay.
QUITTING!

to a warning

Warning: --min-parallelism and --max-parallelism are ignored with --scan-delay.
2009-07-17 20:06:05 +00:00
david
d8925b3c11 Rename the o.pingscan variable to o.noportscan to reflect its true
purpose. Make o.listscan imply o.noportscan to simplify some conditions.
2009-07-17 01:02:57 +00:00
david
e9d8897cde Use strtol, not strtoll, for Windows compatibility. 2009-07-08 21:46:11 +00:00
luis
98aedb8d1c Fixed a bug in --data-length parsing. User input was not being checked and in some cases that resulted in useless buffer allocations and unpredictable payload lengths. Check http://seclists.org/nmap-dev/2009/q2/0763.html for a complete description of the problem. 2009-07-04 21:15:13 +00:00
fyodor
2a5750baef Apply 1-line fix from Jah which now properly counts traceroute ping scan IPs (previously it would say things like 'WARNING: No targets were specified, so 0 hosts scanned.' and 'Nmap done: 0 IP addresses (1 host up) scanned' 2009-06-10 01:56:46 +00:00
josh
0b078f4af6 Rewrote the port list merge code in validate_scan_lists to be moremaintainable. 2009-06-06 04:33:35 +00:00
josh
8e9c6a0e1f Fixed a bug with in validate_scan_lists where realloc was not called with
sufficient size.
2009-06-06 02:18:18 +00:00
josh
07011cbb99 Made a change to validate_scan_lists to combine port lists when -PA and -PS are
called together when nmap is running as nonroot or using IPv6.
2009-06-06 00:04:31 +00:00
daniel
50830f7488 o Added initial SCTP port scanning support to Nmap. SCTP is
a layer 4 protocol used mostly for telephony related applications.
  This brings the following new features:
  o SCTP INIT chunk port scan (-sY): open ports return an INIT-ACK
    chunk, closed ones an ABORT chunk.  This is the SCTP equivalent
    of a TCP SYN stealth scan.
  o SCTP COOKIE-ECHO chunk port scan (-sZ): open ports are silent,
    closed ports return an ABORT chunk.
  o SCTP INIT chunk ping probes (-PY): host discovery using SCTP
    INIT chunk packets.
  o SCTP-specific IP protocol scan (-sO -p sctp).
  o SCTP-specific traceroute support (--traceroute).
  o The ability to use the deprecated Adler32 algorithm as specified
    in RFC 2960 instead of CRC32C from RFC 4960 (--adler32).
  o 42 well-known SCTP ports were added to the nmap-services file.
  Part of the work on SCTP support was kindly sponsored by
  Compass Security AG, Switzerland.  [Daniel Roethlisberger]
2009-06-03 23:15:45 +00:00
jah
99c4008c03 Disable traceroute when -6 is requested. Before this, it was possible to reach
traceroute() with IPv6 targets if a ping scan was requested.
2009-06-03 21:39:53 +00:00
david
1538e21724 There is a new default ping probe set: -PE -PS443 -PA80 -PP. In
exhaustive testing of 90 different probes, this one emerged as the
best four-probe combination, finding 14% more Internet hosts than
the previous default, -PE -PA80. The default for nonroot users is
-PS80,443, replacing the previous default of -PS80. In addition,
ping probes are now sent in order of effectiveness (-PE first) so
that less likely probes may not have to be sent.
2009-05-27 18:21:28 +00:00
david
d4eafba473 Fix a compiler warning. 2009-05-04 23:25:46 +00:00
david
5c222c6965 Also increment o.numhosts_scanned during ping and list scan. 2009-05-04 23:23:50 +00:00
david
fac82a011b Only increment o.numhosts_scanned when we have truly finished scanning a
host, which means that it is either found down or else all
port/script/traceroute/etc. scanning is finished. In r12798 I made it be
updated as soon as DNS resolution happened, to make the status display
"X undergoing Ping Scan" accurate. However the main loop also uses this
variable to count how many addresses have been generated so it knows
when to stop scanning random addresses. If -iR was used, only the first
hostgroup out of all the random addresses would be fully scanned and
then the scan would end. This change fixes that and also makes the
output more like it was pre-r12798; for example, if you had done name
resolution on 1024 hosts with --max-hostgroup 8, and had found the 8th
up host at the 280th one pinged, the output was
Stats: 0:00:29 elapsed; 1016 hosts completed (8 up), 8 undergoing Connect Scan
and is now
Stats: 0:00:29 elapsed; 272 hosts completed (8 up), 8 undergoing Connect Scan
2009-05-04 22:59:35 +00:00
david
7a84920e63 Put some conditions like o.idlescan and o.bouncescan outside of the
loops that iterate over targets, not inside them. That prevents having
to iterate over every target doing nothing in the common case when those
scan types aren't used.
2009-05-01 20:51:52 +00:00
kris
318688acd5 updating ip_is_reserved(): 180/8 and 183/8 allocated 2009-04-29 19:20:42 +00:00
david
edde5c5686 Add a missing newline to the "Fetchfile" message. 2009-04-18 16:36:59 +00:00
fyodor
d0e21e1d03 Suggest that people send patches to nmap-dev rather than to me directly 2009-04-15 00:37:03 +00:00
bmenrigh
b38b5f6270 Changed a few error() calls to log_write(). Removed the (redundant)
"\n" from a few error() calls.  Changed a few f?printf() calls to
error() or log_write().

Most notably, I didn't change any of the --interactive printf()s or
the usage printf() call.

I think we should draw up some internal notes on when to use
LOG_STDOUT versus LOG_PLAIN versus all the other LOG_* options.
2009-04-07 23:10:51 +00:00
batrick
37bbb40520 Merge of nse-lua (nse-lua-merge) minus most enchancements that were
not directly related to the change from C++ to Lua for the NSE main
procedures.

The changes are discussed in the nse-lua thread here:
http://seclists.org/nmap-dev/2009/q1/0047.html
2009-04-05 06:01:27 +00:00
david
7872aafa5d Update the global o.numhosts_scanning variable within ultra_scan, so
that it is set properly for ping scan. Previously status reports during
ping scan always looked like

Stats: 25:34:33 elapsed; 991232 hosts completed (72530 up), 0 undergoing Ping Scan

Note the "0 undergoing". Now that number will be set to 4096 or whatever
the current ping scan group size happens to be.
2009-03-31 18:29:52 +00:00
fyodor
eccc235d5a Increase copyright year to 2009, simplify/reword some derivative works text, and remove a confusing clause about selling proprietary front-ends to Nmap 2009-03-31 04:16:12 +00:00
fyodor
7fca42a74c Add link to the man page to the usage text. Windows users generally don't have the man command and often don't even know what a man page is. 2009-03-27 19:18:46 +00:00
kris
56d83f74a2 Don't call the meaningless gettoppts if we're doing a ping or list scan. This
keeps the following debugging line from being printed in these modes:

	PORTS: Using top 1000 ports found open (TCP:0, UDP:0)

This also speeds these up because it doesn't necessarily have to read and parse
nmap-services.  Going from 0.25s to 0.04s for listing a /24 sounds good to me :)
2009-03-05 22:13:11 +00:00
david
486ff13e3a Add the --stats-every option. See http://seclists.org/nmap-dev/2009/q1/0404.html. 2009-02-24 00:23:54 +00:00
david
fb0f1cdd93 Remove an unnecessary call to keyWasPressed right before service_scan;
service_scan does that itself.
2009-02-14 16:25:46 +00:00
kris
3348faca3a update ip_is_reserved(): 109/8 and 178/8 allocated 2009-02-02 18:02:41 +00:00
kris
8eb6313aa2 updating ip_is_reserved(): 108/8 and 184/8 allocated 2008-12-22 18:17:34 +00:00
david
c561222685 Fix spelling in some identifiers. wierd_responses -> weird_responses,
printStatsIfNeccessary -> printStatsIfNecessary.
2008-12-04 17:04:48 +00:00
fyodor
263e62a3d4 comment out unused variable 2008-12-01 21:38:18 +00:00
fyodor
b9c6596a78 oops, missed removal of 204.152.64.0/23 in last checkin 2008-11-30 20:48:32 +00:00
fyodor
e9db35af38 Remove *.255.255.255 block from ip_is_reserved(), allowing these addresses to be selected in Random scans. Also removed the 204.152.64.0/23 block, as the reason for having it may no longer apply. Plus these are very small blocks to worry about in the grand scheme of things. Jack Grahl suggested the *.255.255.255 removal 2008-11-30 20:45:48 +00:00
david
3dd89201dc Initialize one global Lua state for running script scans, and reuse it in calls
to script_scan. This makes the NSE registry persist though all host groups.
2008-11-19 01:44:09 +00:00
kris
60338f216f updating ip_is_reserved(): 110/8 and 111/8 allocated to APNIC 2008-11-11 16:56:45 +00:00
kris
8c18093110 update ip_is_reserved(): 197/8 allocated 2008-10-27 21:28:57 +00:00
fyodor
ddb5829dcf minor syntax updates to the help screen text 2008-10-24 19:07:39 +00:00
david
7c32907cac Make Nmap quit when it gets a "backwards" port range like -p 20-10. 2008-10-20 01:58:58 +00:00
fyodor
1508da5acc fix an error message--specifying timeout values in days is not actually supported 2008-10-13 05:07:13 +00:00
david
466a760e67 Remove a few remaining references to NMAPLIBEXECDIR, where compiled NSE modules
used to be installed.
2008-09-23 23:25:40 +00:00
fyodor
d231a35e21 move --traceroute and --reason in nmap -h output 2008-09-21 09:40:14 +00:00
david
85a8d61536 Increase xmloutputversion to 1.03 for Zenmap unification changes. 2008-09-19 23:55:47 +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
fyodor
30e26e481e we generally don't update the xmlversion just for a new attribute. Doing so may cause more trouble than its worth, though I'm open to convincing 2008-08-13 01:30:42 +00:00
michael
931285f765 Updated DTD, XML version, and anded scanflags attribute to scaninfo element. 2008-08-13 00:59:22 +00:00