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
kroosec
ba9c6ea5e1 Second commit from rpc-grind branch. Removing old implementation from output and portlist. 2012-08-17 18:31:50 +00:00
dmiller
6e57ab9606 Fix fatal on 0-length print to XML 2012-08-15 22:09:47 +00:00
david
0c3e0fcc4d Structured script output.
Scripts may now return a key–value table, or such a table in addition to
a string. The table will be automatically formatted for normal output
and will appear as a hierarchy of elements in XML output.

Some history and discussion of this development can be found at
https://secwiki.org/w/Nmap/Structured_Script_Output.

This is a merge of r29484:29569 from /nmap-exp/david/xml-output.
2012-08-14 16:36:25 +00:00
david
3f415ef38a Factor out XML script result writing. 2012-08-02 06:21:01 +00:00
dmiller
5b5ca64126 Add reason_ttl attribute for host/status output 2012-07-20 21:44:57 +00:00
dmiller
fadfc6b71c Fix assertion failure when logtype==LOG_SKID_NOXLT 2012-07-03 17:22:47 +00:00
henri
1e422f344c Added support for log type bitmasks in log_vwrite(). Also replaced a fatal()
statement by an assert(0) to get rid of a possible infinite call loop when
passed an invalid log type. [Henri Doreau]
2012-07-03 11:44:24 +00:00
david
3e50107f23 Use less memory for ip_addr in port_reason.
This was a sockaddr_storage, which is 128 bytes. This is a lot for a
structure that is part of Port. It is now a union of sockaddr_in and
sockaddr_in6, which is 28 bytes. A new set_ip_addr method sets the union
from a sockaddr_storage, where plain assignment was used before.

The sockaddr_storage was introduced in r23778, the first big IPv6 merge.
2012-06-26 03:23:14 +00:00
sean
bfeecd1895 Output for script results is now sortedi alphabetically. 2012-06-23 04:17:24 +00:00
david
6eb37db01b Simplify output_rangelist_given_ports. 2012-06-20 23:08:33 +00:00
david
dc485a4bff Comment typos(?).
It's sad to see "ugly hat" go.
2012-06-07 05:15:31 +00:00
david
1599aa6fe8 Make osclass XML elements children of the osmatch element they belong to.
Add the --deprecated-xml-osclass to restore the old output.
2012-05-05 18:02:33 +00:00
david
20b56cb6a2 Factor out XML osmatch and osclass logging. 2012-05-05 18:02:30 +00:00
david
f813b50a4d Include service information in -oX and -oM even without -sV.
This is by Daniel Miller.
http://seclists.org/nmap-dev/2012/q1/731
2012-04-03 01:28:32 +00:00
david
3741b5a4fa Show the "service" XML element whenever a tunnel is detected.
Previously this would be omitted if the service was not otherwise
discovered, and the port it was on was not in nmap-services. (There was
not problem if the port was present in nmap-services with a name of
"unknown".)
2012-03-31 03:21:27 +00:00
david
e1576d1d14 Change alloc_sprintf to return a length. 2012-03-08 23:56:26 +00:00
david
23133dccf2 Use alloc_vsprintf in log_vwrite.
This avoids a failure when writing long strings on Windows. Previously
we tried only one reallocation of the write buffer, and panicked if that
failed.

http://seclists.org/nmap-dev/2012/q1/514
2012-03-08 23:56:22 +00:00
fyodor
684f42c4ad One more adjustment to the license text. Notes that Zenmap, Ncat, and Nping use this license. Note that contributions made directly in the src repository are treated the same as those in the mailing list. 2012-03-01 06:53:35 +00:00
fyodor
e96a7b7b24 Update the headers for each code file. This updates code copyright dates to 2012, notes the awesome NSE in the list of technology, and slightly rewords the derivative works clarification 2012-03-01 06:32:23 +00:00
david
9bf2ec3884 Merge from /nmap-exp/luis/nmap-os6.
svn merge --ignore-ancestry svn://svn.insecure.org/nmap@26621 svn://svn.insecure.org/nmap-exp/luis/nmap-os6

This is the IPv6 OS detection branch. "nmap -6 -O" works now, though at
this point it only prints fingerprints and not OS guesses, because we
need to collect more submissions.
2011-09-19 18:31:46 +00:00
david
04069e6166 Merge r26341:26417 from /nmap-exp/david/nmap-cpe.
This adds CPE output support.
2011-09-09 23:24:14 +00:00
david
4937b2e063 Use strcasecmp, not strcasestr, in hostcmp.
hostcmp is documented to determine whether "a and b are considered the
same hostnames." But what it's really doing is testing whether a
contains b. This isn't even symmetric, so I think it's wrong.
2011-09-07 21:10:47 +00:00
david
17a57e186b Actually honor the append parameter to log_open.
It was looking at o.append_output instead. It didn't matter, because it
was always called with o.append_output in that place anyway.
2011-06-14 02:29:40 +00:00
david
87d9c4ba69 Remove some unused function parameters. 2011-06-14 02:29:39 +00:00
david
4aa4a154f9 Merge from /nmap-exp/david/nmap-ipv6.
This is raw IPv6 packet support for most port and ping scans, Neighbor
Discovery, and traceroute.
2011-06-08 01:24:48 +00:00
david
a2e58b4875 Use sockaddr_storage_equal in place of sockaddr_storage_cmp where
appropriate.
2011-05-07 00:50:54 +00:00
david
7453ec34d0 Change o.TimeSinceStartMS returning milliseconds to o.TimeSinceStart
returning floating-point seconds. Everywhere o.TimeSinceStartMS was
called, the return value was being divided by 1000.0, which had the same
effect but would overflow when the difference exceeded about 25 days
(2^31 milliseconds). This patch is by Daniel Miller.
2011-03-28 20:34:32 +00:00
david
523c4f7104 Remove -sR o.rpcscan handling; make -sR an alias for -sV. 2011-03-12 18:20:09 +00:00
fyodor
86e59a8c4e Update copyright statements from 2010 to 2011 2011-01-21 00:04:16 +00:00
fyodor
e9697cb936 Remove an excess space in output 2010-12-08 08:02:22 +00:00
david
1f333be278 Fix compilation with --without-liblua. This was reported by Nuno
Gonçalves and Henri Doreau.
2010-11-24 23:37:42 +00:00
david
cec33e3aad o The command line in XML output (/nmaprun/@args attribute) now does
quoting of whitespace using double quotes and backslashes. This
  allows recovering the original command line array even when
  arguments contain whitespace. [David]
2010-11-14 02:09:58 +00:00
david
69e1295384 Change the way ScriptResult::get_id and ScriptResult::get_output work to avoid
referencing deallocated memory.

The class was defined basically as follows:

class ScriptResult
{
private:
	std::string output;
public:
	std::string get_output() const
	{
		return this->output;
	}
};

The problem was when it was used like this, as in our script output
routines:

const char *s = sr.get_output().c_str();
printf("%s\n", s);

The reason is that the temporary std::string returned by get_output goes
out of scope after the line containing it, which invalidates the memory
pointed to by c_str(). By the time of the printf, s may be pointing to
deallocated memory.

This could have been fixed by returning a const reference that would
remain valid as long as the ScriptResult's output member is valid:

	const std::string& get_output() const
	{
		return this->output;
	}

However I noticed that get_output() was always immediately followed by a
c_str(), so I just had get_output return that instead, which has the
same period of validity.

This problem became visiable when compiling with Visual C++ 2010. The
first four bytes of script output in normal output would be garbage
(probably some kind of free list pointer). It didn't happen in XML
output, because the get_output-returned string happened to remain in
scope during that.
2010-11-09 19:47:18 +00:00
david
6f370e012d Whitespace. 2010-11-09 18:48:49 +00:00
david
d4e49f1075 Rearrange some headers to make sure that out nbase errno defines are seen early,
avoiding warning about symbol redefinitions. This is mostly moving "nmap.h" to
the top of the list.
2010-11-04 22:43:00 +00:00
david
7653cf7d4a Move COPYING.OpenSSL to OpenSSL.txt, update copyright notices to match. 2010-10-30 03:01:50 +00:00
david
f9c55c71b6 Fix an error I added in formatScriptOutput. It caused a segmentation
fault when a script produced an empty string as a result.
2010-10-16 02:21:44 +00:00
david
fe55182068 Remove the stripping of newlines from the beginning of script output. 2010-09-30 05:03:03 +00:00
david
9d57567b62 Format script output without using sctring replacement. This fixes the case when the last legitimate occurrence of "| " in the output would get replaced with "|_". 2010-09-29 23:14:12 +00:00
kris
57664a51cf Committing MTU-related changes:
* Adding path-mtu.nse for Path MTU Discovery
* Nmap now stores the MTU for interfaces (from SIOCGIFMTU or libdnet)
* Scripts can access the MTU for host.interface via host.interface_mtu
* Nmap prints the MTU for interfaces in --iflist
2010-08-24 01:47:12 +00:00
djalal
f0c5e154c3 Merge r18689:r19511 from /nmap-exp/djalal/nse-rules.
o Add two new Script scan phases:
  Script Pre-scanning phase: before any Nmap scan operation, activated by the new "prerule".
  Script Post-scanning phase: after all Nmap scan operations, activated by the new "postrule".
o New environment variables:
  SCRIPT_PATH
  SCRIPT_NAME
  SCRIPT_TYPE: the type of the rule that activated the script.
2010-08-06 16:40:03 +00:00
david
02e612c596 Make data_file_record::operator< const. The lack of this might have been
causing a compile error reported by Nuno Gonçalves:

error: passing 'const data_file_record' as 'this' argument of 'bool data_file_record::operator<(const data_file_record&)' discards qualifiers
make[4]: *** [output.o] Error 1
2010-08-04 21:05:02 +00:00
david
45468ba2a0 Fix compiler warnings seen on OpenBSD. 2010-08-02 20:30:29 +00:00
luis
da126c8b78 Merged nmap-dedup branch from nmap-exp/luis/nmap-dedup. This completes the Nmap/Nping code de-duplication phase. 2010-06-22 17:24:34 +00:00
david
57238b7df5 Print the addresses that were resolved but not scanned in each scan
report. It looks like this.

$ ./nmap google.com -sn

Starting Nmap 5.30BETA1 ( http://nmap.org ) at 2010-05-10 23:57 MDT
Nmap scan report for google.com (66.102.7.99)
Host is up (0.073s latency).
Other addresses for google.com (not scanned): 66.102.7.104
rDNS record for 66.102.7.99: lax04s01-in-f99.1e100.net

This replaces the line

Hostname google.com resolves to 2 IPs. Only scanned 66.102.7.99
2010-05-11 05:59:09 +00:00
fyodor
1aecac420f Update copyright year from 2009 to 2010 2010-05-03 21:20:25 +00:00
david
859ef5ecaf Merge r17202:17298 from /nmap-exp/david/nmap-xml. This brings in
structured XML output, automatic closing of XML elements on error, and
inclusion of error messages in XML output.
2010-04-14 01:05:51 +00:00
david
d375aa25e9 Print a "TRACEROUTE" header for directly connected hosts, even though it
lacks a probe specification like "(using proto 1/icmp)".
2010-03-23 23:38:34 +00:00
david
e976c2c3b9 Don't call htonl on a netmask before displaying it in --iflist; it's
already in network byte order. This bug made any mask that wasn't /32
appear as /0.
2010-03-11 17:46:27 +00:00
david
48654df805 Switch to -sn and -Pn as the new preferred synonyms for -sP and -P0.
This establishes a more regular syntax for some options that disable
phases of a scan:
	-n  no reverse DNS
	-Pn no host discovery
	-sn no port scan
Also, the -sP was possibly misleading because the 'P' suggests "ping
scan," when you can now do more than just pinging when you disable port
scanning. For example, -sC -sn and -sn -Pn --traceroute make sense.
2010-03-11 01:16:06 +00:00