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

118 Commits

Author SHA1 Message Date
d33tah
e3d1c178e3 Add newlines at the EOF in conformance to Daniel's coding standards
proposal. This only affects Nmap's root directory. We might also need to
modify the code which autogenerates Nmap's source code files such as IPv6
fingerprinting code.
2014-06-18 10:18:58 +00:00
dmiller
c9714990c7 Remove trailing whitespace from C/C++ files
https://secwiki.org/w/Nmap/Code_Standards
2014-02-12 20:25:51 +00:00
d33tah
4816358475 Replace all tab characters at the beginnings of lines with 8 spaces.
Mixed indentation annoyed my vim.
2014-01-05 19:14:26 +00:00
henri
694a8fe825 Nsock-pcap cleanup
Make the API follow the general nsock style. Report errors properly using the
nsock logging facilities.
2013-07-31 19:11:16 +00:00
henri
4685d44ff8 Removed a superfluous nsock_set_proxychain() statement.
This call got duplicated during the merge and provoked
non-fatal nsock errors like:

NSOCK ERROR [0.0310s] nsp_set_proxychain(): Invalid call. Existing proxychain on this nsock_pool
2013-04-30 07:12:03 +00:00
henri
1b45bfef14 Made NSE use proxychains too. 2013-04-22 19:35:42 +00:00
henri
18cf677548 Let NSE use nsock proxy chains. 2013-04-22 19:33:15 +00:00
henri
99258673ad Added handling of the new NSE_STATUS_PROXYERROR case. 2013-04-22 19:32:36 +00:00
david
40dc37e30b Comment typo. 2013-02-26 05:28:33 +00:00
henri
809f1eda68 Merged nsock-logging from nmap-exp/henri/nsock-logging/
Reworked the logging infrastructure to make it more flexible
and consistent.

Updated nmap, nping and ncat accordingly.  Nsock log level can
now be adjusted at runtime by pressing d/D in nmap.
2012-12-15 10:59:30 +00:00
david
26816736b5 Revert part of r29016.
nsock_check_udata needs this parameter indicating whether to set up an
unconnected UDP socket or not. r29016 wrongly made this setup
unconditional and moved the check for connectedness into the calling
function. What went wrong is that the unconnected UDP socket could be
set up prematurely--before calling bind, for example. This broke scripts
using unconnected UDP sockets.

This was reported by Dhiru Kholia.
http://seclists.org/nmap-dev/2012/q4/422
2012-12-15 07:55:31 +00:00
batrick
9754682420 Cancel the sleep event if the thread is destroyed by NSE. This
solves an assertion failure when the thread was garbage collected
by Lua before the sleep callback occurred.

Reported by Henri Doreau [1].

[1] http://seclists.org/nmap-dev/2012/q4/43
2012-11-23 03:47:43 +00:00
david
bfaed0ce34 Use the name "nspp" for a variable of type "pointer to nsock_pool." 2012-10-22 05:17:00 +00:00
david
5c8272b3c9 Chack for a NULL pointer return in get_pool. 2012-10-22 05:16:59 +00:00
david
d27e378879 Comment typo. 2012-10-17 18:48:32 +00:00
david
422b43be22 Call nsp_setdevice after nsp_new in our Nsock pools.
The exceptions are the calls in ncat/ncat_connect.c and
nping/EchoServer.cc. Ncat doesn't have an option for the interface, and
I think Nping's -e option is only meant to apply to probes, not to the
echo server listener.
2012-10-03 15:43:18 +00:00
david
a41633cd85 Close an NSE socket before making a second attempt to connect.
Without this, we were leaking socket descriptors. See
http://seclists.org/nmap-dev/2012/q3/971.
2012-09-21 21:13:28 +00:00
henri
b56c25a972 Fixed memory leak. 2012-08-04 16:05:24 +00:00
dmiller
92008abcfa Fix assertion error on pcap nsock_iod reuse
Discussion: http://seclists.org/nmap-dev/2012/q3/458
2012-07-31 16:20:43 +00:00
david
2404fc7d64 Return nil and an error message when a socket is not connected.
Daniel Miller noticed that the behavior of socket functions didn't match
the documentation when a socket was not connected. The code would raise
a Lua error (ending the script) instead of returning a false status code
as documented.

http://seclists.org/nmap-dev/2011/q3/840
http://seclists.org/nmap-dev/2012/q2/505
2012-06-21 03:11:17 +00:00
david
091d848838 Prevent a null pointer dereference in nse_nsock_get_ssl.
This could be provoked by a script calling nmap.get_ssl_certificate on
an unconnected socket.
2012-05-28 17:44:10 +00:00
david
fc49819007 Remove condition with no effect. 2012-05-28 17:08:18 +00:00
david
8175095717 Typo. 2012-05-28 17:08:17 +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
henri
97402a0d95 Removed variables "status" to get rid of GCC (4.6.1) warnings concerning set but
never used variables.
2011-12-14 15:01:14 +00:00
djalal
6562877ed6 Fixed a bug: use sockaddr_storage instead of sockaddr. 2011-06-09 17:38:04 +00:00
batrick
9d2463b9cd comment clarifying -1 case 2011-04-05 19:34:34 +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
david
47030f71db o [NSE] Made it a controlled Lua stack trace instead of a fatal error
when an NSE script sets a negative socket timeout. Vlatko Kosturjak
  reported the bug. [David]
2011-02-01 21:20:29 +00:00
david
18157ed081 Merge from /nmap-exp/david/nmap-unconnected. This adds unconnected
socket support to NSE, with updates in scripts and libraries.

o [NSE] Added the ability to send and receive on unconnected sockets.
  This can be used, for example, to receive UDP broadcasts without
  using pcap. A number of scripts have been changed so that they can
  work as prerule scripts to discover services by UDP broadcasting,
  optionally add the discovered targets to the scanning queue:
    - ms-sql-info
    - upnp-info
    - dns-service-discovery
  The nmap.new_socket function can now optionally take a default
  protocol and address family, which will be used if the socket is not
  connected. There is a new nmap.sendto function to be used with
  unconnected UDP sockets. [David, Patrik]
2010-10-16 00:48:44 +00:00
david
85d81f76ce Add another parameter to nsp_settrace that allows setting the FILE
stream to write to. It defaults to stdout like before if NULL is
provided. Ncat uses this to write to stderr instead.
2010-10-01 18:12:22 +00:00
david
1723949c05 Revert r20455; I meant to do this in a branch. 2010-10-01 06:29:17 +00:00
david
87ee8343f3 Provide a new nsock_setup_udp function to create a UDP socket without connecting it. Provide an NSE interface to the function. Add broadcast.nse, a script that receives UDP broadcasts with an unconnected socket. 2010-10-01 06:26:22 +00:00
djalal
85030874ea Fix a bug that prevents Nmap to compile on systems that lacks OpenSSL. This patch was contributed by Patrik Karlsson. 2010-09-26 10:43:32 +00:00
batrick
31fbab7eba Moved receive_buf function (not in use yet, until Lua 5.2) next to other
receive functions.
2010-09-21 20:01:16 +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
david
745a49d24a Upgrade the included Windows OpenSSL to version 1.0.0a. 2010-09-16 03:49:43 +00:00
david
1e80229708 Change "ncap" to "pcap" in some function names so the C names match the
Lua names.
2010-08-24 17:49:39 +00:00
david
bfffa53616 When nmap.connect gets a port table, let port.protocol be the default
protocol (instead of always "tcp"). You can still override it by
providing an explicit protocol after the table.
2010-08-16 18:09:04 +00:00
david
0e3c861ea0 Let nmap.connect take a host table and port table in place of a string
and an integer. This is going to be used to easily support Server Name
Indication for SSL connections.
2010-08-16 17:35:20 +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
kris
ee3c89afe4 o [NSE] When receiving raw packets from Pcap, the packet capture time
is now available to scripts as an additional return value from
  pcap_receive().  It is returned as the floating point number of
  seconds since the epoch.  The qscan.nse script was updated to use
  this more accurate data instead of using the clock_ms() function
  (which returns the current time). [Kris]
2010-07-23 10:43:04 +00:00
batrick
885bc6e034 SCRIPT_ENGINE is defined in nse_main.h. 2010-07-07 15:01:19 +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
djalal
24807128d2 Merge r17640:18062 from /nmap-exp/djalal/nmap, this is a port of the LuaFileSystem directory iterator in order to use Lua code to list scripts. 2010-06-12 21:41:09 +00:00
batrick
9ead4dec87 Removed an old false comment. 2010-04-30 19:56:16 +00:00
david
5e8f88194d Use socket_errno() instead of errno in NSE raw socket code, to get
Windows errors.
2010-03-02 18:29:22 +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
f21a07cfde Revert r16464. 2010-01-15 03:55:23 +00:00
david
c73b250615 Factor out a function that reports the failure to open an Ethernet
device and exits. On Windows, print a hint about "net start npf" to
start the NPF service.
2010-01-15 00:37:39 +00:00