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

314 Commits

Author SHA1 Message Date
david
7db7da0007 Merge again from /nmap-exp/david/nmap-mem; this fixes a couple of bugs. 2009-12-20 03:22:19 +00:00
david
1c6030709b Revert r16307:16309, the merge from nmap-mem. I just found a
segmentation fault which I am investigating.
2009-12-19 22:49:16 +00:00
david
b838242e01 Merge from /nmap-exp/david/nmap-mem. This brings in two memory-reducing
changes. The first is that Port objects don't allocate memory for
service and RPC results unless that information is set. This reduces the
size of a bare Port from 92 to 40 bytes on my machine. The second change
is that PortList now has the notion of a "default port state," which is
the state of any ports that didn't receive a response. These ports don't
need an allocated Port object, which saves a lot of memory in scans
where most ports didn't get a response.
2009-12-19 21:26:14 +00:00
fyodor
b8d10b7154 Reduce the first level of NSE indention to 2 spaces rather than
three. This corresponds to the 2 spaces now used in Ron's
stdnse.format_output function for further levels of indentation.  The
first level is still special in that it contains "| " or "|_" rather
than just spaces. Here is example output from before this change:

2049/tcp open  rpcbind
8080/tcp open  http        Apache httpd 2.2.13 ((Fedora))
|_ http-favicon: Unknown favicon MD5: 5A49412557709B4EDF6BBA9A1710B418
|_ html-title: Insecure.Org - Nmap Free Security Scanner, Tools & Hacking res...
|_ http-open-proxy: Proxy might be redirecting requests
8081/tcp open  http        Apache httpd 2.2.13 ((Fedora))
|  html-title: 302 Found
|_ Did not follow redirect to http://seclists.org/
8082/tcp open  http        Apache httpd 2.2.13 ((Fedora))
|_ html-title: Nmap - Free Security Scanner For Network Exploration & Securit...
|_ http-favicon: Apache Web Server (seen on SuSE, Linux Tux favicon)
Device type: general purpose
[...]
ost script results:
|  smb-os-discovery:  
|    OS: Unix (Samba 3.4.2-0.42.fc11)
|    Name: Unknown\Unknown
|_   System time: 2009-11-24 17:18:49 UTC-8
|_ smbv2-enabled: Server doesn't support SMBv2 protocol

And after the change:

2049/tcp open  rpcbind
8080/tcp open  http        Apache httpd 2.2.13 ((Fedora))
|_html-title: Insecure.Org - Nmap Free Security Scanner, Tools & Hacking res...
|_http-favicon: Unknown favicon MD5: 5A49412557709B4EDF6BBA9A1710B418
8081/tcp open  http        Apache httpd 2.2.13 ((Fedora))
| html-title: 302 Found
|_Did not follow redirect to http://seclists.org/
8082/tcp open  http        Apache httpd 2.2.13 ((Fedora))
|_http-favicon: Apache Web Server (seen on SuSE, Linux Tux favicon)
|_html-title: Nmap - Free Security Scanner For Network Exploration & Securit...
Device type: general purpose
...
Host script results:
| smb-os-discovery:  
|   OS: Unix (Samba 3.4.2-0.42.fc11)
|   Name: Unknown\Unknown
|_  System time: 2009-11-24 17:19:21 UTC-8
|_smbv2-enabled: Server doesn't support SMBv2 protocol
2009-11-25 01:23:34 +00:00
david
a06b900f00 Merge from /nmap-exp/david/nmap-mem. This reduces the memory usage of OS
scan by about 95%. (66832396 bytes to 2815061 bytes according to
Massif.)
2009-11-23 21:22:07 +00:00
david
e2315ae075 Remove the unused Port::owner member. 2009-11-20 20:17:33 +00:00
david
682b8cbc53 Include the reason why a host is down with --reason. It looks like this:
Nmap scan report for 1.2.3.4 [host down, received time-exceeded]
Nmap scan report for 1.2.3.5 [host down, received no-response]
2009-11-16 19:38:37 +00:00
david
300e038aa6 Print host timing information ("Final times for host" and the times
element in XML) even when doing only a ping scan. Don't print the
information if it was never set; i.e., we never measured an RTT to the
target.
2009-11-16 08:36:58 +00:00
david
ecb9aa0565 Print output for down hosts, even when doing scanning past a ping scan.
This always goes to XML and grepable output. It goes to normal in
interactive output in verbose mode. The format for printing a down host
is changed slightly:
Nmap scan report for 1.1.1.1 [host down]
2009-11-16 07:37:01 +00:00
david
2ccb1144da Remove a conditional that printed the "Host is down" line to either
LOG_PLAIN or LOG_STDOUT depending on whether o.resolve_all was set, and
just always print to LOG_PLAIN like we do all the other output. This was
the cause of a discrepancy between interactive and normal output
reported at http://seclists.org/nmap-dev/2009/q4/230.
2009-11-16 04:08:58 +00:00
david
1445ab46a9 Always print out the "Host is up" line with latency, even without
verbosity.
2009-10-27 22:57:50 +00:00
david
779b6cec2e Don't print out a "Host not scanned" line when doing list scan. 2009-10-27 22:49:23 +00:00
david
3889091495 Add a cast to silence a compiler warning. 2009-10-27 19:42:19 +00:00
david
398e53b3de Keep trace of the list of addresses a name resolved to, and print out
how many there were if there were more than one.
2009-10-27 06:08:04 +00:00
david
030411ffd8 Don't repeat the host name and IP address in "Host is up/down" messages.
Don't print the "Nmap scan report" header if there's nothing to put
under it.
2009-10-27 05:26:40 +00:00
david
d837d751bc Don't print an rDNS record if it is blank. 2009-10-26 21:17:13 +00:00
david
01f70c5432 Write an "Nmap scan report" heading before scan results. It includes the
reverse DNS if it differs from the forward hostname.
2009-10-26 19:09:56 +00:00
david
719d9c9442 Add the user's specified host name to XML output, if available. It looks
like this:

<hostnames>
<hostname name="openbsd.org" type="user"/>
<hostname name="cvs.openbsd.org" type="PTR"/>
</hostnames>
2009-10-24 01:01:08 +00:00
david
f037a4828c Remove some dead code. 2009-10-23 23:48:14 +00:00
david
c66cf4f568 Fix some output I missed cleaning up after indent. 2009-10-23 23:45:55 +00:00
david
6ac2ec8a77 Reindent output.cc. 2009-10-23 23:44:17 +00:00
david
d0a1bd3001 Print the proto attribute ("tcp", "udp", etc.) along with the port
number in the XML output for traceroute.
2009-09-28 20:12:46 +00:00
david
45b783c573 Print "--" for the RTT of traceroute hops if the RTT is unknown. This
can only happen in the case of a directly connected target with no ping
or port scan responses, like
nmap -PN -sP --send-ip --traceroute <target>
2009-09-17 15:11:20 +00:00
david
577a1be0e7 Merge from svn://svn.insecure.org/nmap-exp/david/nmap-traceroute. This
brings in a new, faster, parallel version of traceroute.
2009-09-17 00:03:46 +00:00
david
b40356ed3f Fixed an integer overflow that could occur when a target with a low
TCP timestamp clock frequency uses large timestamp values, such that
a naive uptime calculation shows a boot time before the epoch. Also
fixed a printf format specifier mismatch that was revealed by the
overflow. Toby Simmons reported the problem and helped with the fix.
2009-09-10 18:03:18 +00:00
david
6bd9760f3b In xml_convert, handle the case when repl is the empty string on the
first iteration. This can't happen with the current data definitions,
but if it did it would result in memcpy being passed a null pointer.
(memcpy would be asked to do a zero-byte copy, so it would probably be
okay anyway, but it's better to be safe.)
2009-08-24 18:10:12 +00:00
david
4c6bafb3fa o There is a new OS detection pseudo-test, SCAN.DC, which records how
the network distance in SCAN.DS was calculated. Its value can be "L"
  for localhost, "D" for a direct connection, "I" for an ICMP TTL
  calculation, and "T" for a traceroute hop count. This is mainly for
  the benefit of OS integration, when it is sometimes important to
  distinguish between DS=1%DC=I (probably the result of forged TTLs)
  and DS=1%DC=D (a true one-hop connection.) [David]
2009-08-23 23:58:28 +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
fyodor
1736dde56c Applied patch:
o Fixed a log_write call and a pfatal call to use a syntax which is
  safer from format strings bugs.  This allows Nmap to build with the
  gcc -Wformat -Werror=format-security options. [Guillaume Rousse]
2009-07-19 07:23:32 +00:00
fyodor
e033940fa1 when the normal 8192-byte write buffer for log_write isn't big enough, we previously jumped it to 1,228,800 bytes. It turns out even that isn't enough in some cases, like the guy who just wrote me that was using '-p1-65535 -d6 -vvv -oA remotehost'. Sheesh. I had another person report the same sort of thing recently. So I'm upping it to 4MB. That ought to be enough for anybody :). On UNIX, vsnprintf is nice enough to tell us how much space we will need and so we don't have to worry about this. I also updated the error message to ask people to report it to nmap-dev rather than to me specifically 2009-07-18 09:53:08 +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
ithilgore
5016893ab8 Fixed another typo in a comment. 2009-06-28 17:44:07 +00:00
ithilgore
aca370f88d Fixed typos with vsnprintf (was vnsprintf). 2009-06-28 17:33:35 +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
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
b4243e23f2 Fix all the compiler warnings when building with Visual C++ 2008. 2009-04-29 17:56:30 +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
fyodor
b9d845b9ab Change 10 to 10.0 in pow() calls to make it clear that it is a double 2009-03-31 22:29:03 +00:00
david
16121b372c Add a round trip time estimate to host status lines. It looks like
Host scanme.nmap.org (64.13.134.52) is up (0.071s latency).
2009-03-31 21:21:36 +00:00
david
d1a77bb85e Simplify and combine the write_host_status code for ping scan and port
scans. This is the code that prints
	Host ... appears to be up.
	Host ... appears to be down.
	Host ... appears to be up ... good.
	Host ... appears to be down, skipping it
Except that now these messages are uniform and are
	Host ... is up.
	Host ... is down.
In addition, the host state --reason information is printed for port
scans just as for ping scans, which appears to have been an oversight
before.
2009-03-31 19:57:25 +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
david
5ed0e17ea0 Treat a service named "unknown" as if it were not named in nmap-services for
purposes of output. What this means is that the port name will not be
"unknown?" or "ssl/unknown?" if version detection failed to find a match, but
simply "unknown" or "ssl/unknown".
2009-03-03 18:56:21 +00:00
david
6a6d18df6f Fix a bug in the printing of OS fingerprints. When a perfect match was found,
the value of the SEQ.G test (print suitable for submission) was the opposite of
what it should have been. This doesn't matter much because in the case of a
perfect match the submission URL isn't shown and the print itself is not
normally displayed. We want perfect matches with the new SEQ.CI test and the
online submitter will reject them if G=N.
2009-02-25 17:44:37 +00:00
david
aaaed61c52 Improve the efficiency of xml_convert. The old version was wasteful of space;
it started by allocating six times the size of the input string because in the
worst case each byte can take up to six bytes when escaped (&#xXX;). It was
wasteful of time because it built the string up with strncat, which pads the
entire destination buffer with null bytes every time it was called. This led to
quadratic time complexity, not linear as expected.

The new version uses the usual strategy of doubling the size of the buffer
whenever it runs out of space. It builds up the string using memcpy, checking
each time that there is space for the new copy.
2009-02-08 05:28:38 +00:00
fyodor
a8ff6858b4 o The conditions for printing OS fingerprints to XML output are now
the same as are used to decide whether to print them in the other
  formats. So they will be printed if submission is desirable,
  otherwise they are only printed if debuging is enabled or verbosity
  is 2 or higher. [Tom Sellers]
2009-02-01 21:08:39 +00:00
kris
20ec1c416e o An "elapsed" attribute has been added to the XML output, representing
the total scan time in seconds (floating point).
2009-01-05 05:57:35 +00:00
david
c561222685 Fix spelling in some identifiers. wierd_responses -> weird_responses,
printStatsIfNeccessary -> printStatsIfNecessary.
2008-12-04 17:04:48 +00:00
david
4ff30d9b99 Show a warning whenever raw socket sending is attempted on Windows--not just
when using --send-ip.
2008-11-24 17:52:25 +00:00
david
47c268568d Use the math function floor instead of casting to an int to truncate OS scan
match percentages. Casting to an int rounds (0.98 * 100) to 97 on some
architectures.
2008-11-20 17:03:11 +00:00