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

103 Commits

Author SHA1 Message Date
batrick
e30122ef0a Make the catch function yieldable. 2012-11-23 03:50:17 +00:00
david
3b55096ab4 Index nmap.list_intefaces return value from 1, not 0. 2012-09-01 03:19:00 +00:00
kroosec
e7e34112db Updated nse nmap lib to reflect old rpc grind removal. 2012-08-17 18:34:59 +00:00
batrick
036d28c898 Remove nmap.sleep as we just want to have stdnse.sleep. 2012-08-07 17:25:49 +00:00
david
21ba9f7b4a Undocument nmap.sleep and undeprecate stdnse.sleep.
There are various functions in the internal nmap.socket and nmap.dnet
libraries that are there for technical reasons:
	http://seclists.org/nmap-dev/2012/q1/318
The sleep function is exposed through the stdnse namespace because it
fits that library better.

Some code comments said that names such as nmap.new_socket were
deprecated in favor of e.g. nmap.socket.new, but the old names were
never formally deprecated, so I removed those comments.
2012-08-03 02:08:44 +00:00
batrick
000f6dc4d9 Lua 5.2 upgrade [1] for NSE.
[1] http://seclists.org/nmap-dev/2012/q2/34
2012-05-27 08:53:32 +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
patrik
9b9aceac92 Fix to allow cpe port table entry to be nil when calling set_port_version 2012-03-27 21:55:32 +00:00
david
b5a9bca6dc Change the structure of host.os tables.
Previously they were a flat list intermixing human-readable names and
CPE strings. Now they reflect the structure that we use to represent
them. In brief:

host.os = {
  {
    name = "Microsoft Windows XP",
    classes = {
      {
        vendor = "Microsoft",
        osfamily = "Windows",
        osgen = "XP",
        type = "general purpose",
        cpe = {
          "cpe:/o:microsoft:windows_xp"
        }
      },
      ... more classes ...
    },
  },
  ... more OS matches ...
}
2012-03-09 02:32:30 +00:00
batrick
4e7756e4de Change hostname parameter to const char *. 2012-03-04 07:26:16 +00:00
patrik
72af4637b0 o [NSE] Added host based registry, which allows scripts to share data between
scripts scanning a specific host. [Patrik]
2012-02-22 20:03:15 +00:00
henri
487c08ff63 Make gathered CPE codes available to NSE.
CPEs are available at host.os (for the ones from OS fingerprinting) and
port.version.cpe (for the version detection ones).

This patch also fix a memory leak that David noticed in
PortList::setServiceProbeResults().
2012-01-13 10:24:19 +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
gorjan
59b7ac706a Removed unnecesary variable from l_list_interfaces() in nse_nmaplib.cc 2011-07-11 22:16:05 +00:00
gorjan
abf2a20866 Adding the NSE nmap.list_interfaces() function that lists all interfaces available to Nmap. 2011-07-05 00:01:35 +00:00
david
b4cdf40769 Make host.bin_ip and host.bin_ip_src work with IPv6 addresses. 2011-06-25 00:51:52 +00:00
gorjan
fc2f88e2ed Added the nmap.get_ttl() which returns the TTL (time to live) specified with the --ttl option;
Added the nmap.get_payload_length() function which returns the value specified with the --data-length option
2011-06-24 01:03:23 +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
batrick
a26f606ecd Just use srand on NSE startup in nse_main.cc. This removes the need
for a binding which will probably not be useful for script writers
when they have OpenSSL's PRNG already available.
2011-05-24 02:48:39 +00:00
batrick
3b83666a9c use a random number from /dev/urandom (nbase.get_random_uint wrapper) 2011-05-24 00:09:42 +00:00
djalal
e91c3505be o [NSE] Removed the nmap.get_interface_link function, which was
deprecated by the new nmap.get_interface_info function.
2011-04-22 22:47:28 +00:00
david
c36cf833e6 Add the nmap.get_interface and nmap.get_interface_info functions by
Djalal Harouni.
2011-04-05 06:11:58 +00:00
david
a362d4c48f Fix condvar("signal") when there is nothing waiting on the condvar. The
logic was
  while (unsigned >= 0)
which is an infinite loop.
2011-03-05 21:16:09 +00:00
david
bf99fb231b Check that the argument to freeaddrinfo is not NULL. The behavior may be
unspecified and causes a segmentation fault on Android Bionic libc.
Vlatko fixed the bug in his Android binaries and it was first reported
by @alexismm2.
2011-02-15 08:19:58 +00:00
batrick
8c898d3938 Simplified some code. 2010-09-23 20:13:47 +00:00
batrick
de4ba536de Merge from /nmap-exp/patrick/nse-nsock-maintenance.
This is a maintenance fix for the NSE Nsock library binding. The patch focuses
on code correctness and simplicity. The patch also brings some initial updates
with an eye towards the upcoming Lua 5.2 release. See [1] for a post concerning
this branch.

[1] http://seclists.org/nmap-dev/2010/q3/710
2010-09-18 20:35:09 +00:00
kris
10d23e924f trivial: move a statement back closer to its context 2010-09-17 20:30:27 +00:00
djalal
c9a756bc12 Clean debug messages and make debug level 3 the default debug level for the 'adding new targets' code. 2010-09-03 17:53:34 +00:00
djalal
c7c502b227 Merge r19520:r20039 from nmap-exp/djalal/nmap-add-targets. This will let NSE scripts to add new discovered targets to future Nmap scans. 2010-09-01 01:50:34 +00:00
david
b2350aa947 o [NSE] Host tables now have a host.traceroute member when --traceroute
is used. This array contains the IP address, reverse DNS name, and RTT
  for each traceroute hop. [Henri Doreau]
2010-08-28 15:50:10 +00:00
kris
8729f667fe Some new NSE functions:
o [NSE] Added the nmap.resolve() function which takes a host name and
  optionally an address family (such as "inet") and returns a table
  containing all of its matching addresses.  If no address family is
  specified, then all of the addresses are returned for the name. [Kris]

o [NSE] Added the nmap.address_family() function which returns the address
  family Nmap is using as a string (e.g., "inet6" is returned if Nmap is
  called with the -6 option). [Kris]
2010-08-27 04:17:51 +00:00
david
11e70075fa Revert r19975, wrong external. 2010-08-26 19:51:22 +00:00
david
611cc22676 Fix a copy-paste error. 2010-08-26 19:50:45 +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
kris
412fcbcca0 o [NSE] Added a "times" table to the host table passed to scripts.
This table contains Nmap's timing data (srtt, the smoothed round
  trip time; rttvar, the rtt variance; and timeout), all represented
  as floating-point seconds.  The ipidseq and qscan scripts were
  updated to utilize the host's timeout value instead of the very
  conservative guess of 3 seconds for read timeouts. [Kris]
2010-08-05 01:55:05 +00:00
kris
cc33a59ca4 Add nmap.clock() for providing scripts with the current time in floating
point seconds since the epoch, and add clock_ms() and clock_us() to stdnse
for convenience (millisecond and microsecond).

qscan.nse now provides microsecond resolution.
2010-07-23 19:49:42 +00:00
batrick
b70fe49adf Compact/share some code. 2010-07-19 12:25:24 +00:00
batrick
204c2ba4b0 Clean up code. Fix port.version.service_fp not getting set properly.
Added field service_dtype (which was replacing service_fp) to version table.
2010-07-17 11:59:04 +00:00
batrick
305faeff21 Remove old #include. 2010-07-17 10:55:38 +00:00
djalal
72a06a3b5c Merge r18160:18278 from nmap-exp/djalal/nmap-nse/ to fix NSE not honoring the exclude directive bug. 2010-06-29 21:56:59 +00:00
kris
a42ea72a97 Merge through r16884 from /nmap-exp/kris/nse-rawip plus the following changelog
entries:

o [NSE] Raw packet sending at the IP layer is now supported, in addition to
  the Ethernet sending functionality.  Packets to send start with an IPv4
  header and can be sent to arbitrary hosts. [Kris]

o [NSE] Added the ipidseq script to classify a host's IP ID sequence numbers
  in the same way Nmap does.  This can be used to test hosts' suitability for
  Nmap's Idle Scan (-sI), i.e. check if a host is an idle zombie.  This is
  the first script to use the new raw IP sending functionality in NSE. [Kris]

o [NSE] Added the function nmap.is_privileged() to tell a script if, as far
  as Nmap's concerned, it can do privileged operations.  For instance, this
  can be used to see if a script should be able to open a raw socket or
  Ethernet interface. [Kris]

o [NSE] Added the function nmap.get_ports() to allow a script to iterate
  over a host's port tables matching a certain protocol and state. [Kris,
  Patrick]
2010-02-26 20:42:10 +00:00
david
3a11dafeaa o Added a mac_addr_next_hop member to the host tables used in NSE.
[Michael Pattrick, kx].
2010-02-13 01:48:59 +00:00
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
david
e2315ae075 Remove the unused Port::owner member. 2009-11-20 20:17:33 +00:00
batrick
2b3df5882f [NSE] Patch to add worker threads to NSE for scripts to use. Right
now a script is limited in parallelism to working on one socket at any
time. A script can now create a worker thread that will be capable of
doing work on sockets in parallel with the parent script. See [1] for
more information.

This patch also comes with condition variables that are similar to
POSIX condition variables. They are used in the same fashion as
NSE's mutexes (nmap.mutex).

[1] http://seclists.org/nmap-dev/2009/q4/294
2009-11-12 01:33:52 +00:00
batrick
68a9147b69 [NSE] Fixed some bugs in the vhosts patch applied in 15342:
o Stack indices for the 'ip' and 'targetname' strings were wrong.
  o Moved the lightuserdatum check right before done so a nil can't slip
    through.
2009-08-29 20:21:58 +00:00
batrick
3c14c0d7b1 [NSE] Added
nse_gettarget (lua_State *L, int index);
to replace the current_hosts static variable shared between nse_main.cc
and nse_nmaplib.cc. This improves locality and offers a clearer interface.
2009-08-29 01:24:29 +00:00