1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00
Commit Graph

142 Commits

Author SHA1 Message Date
dmiller
6d72dbb9df Add more assertions and checks for cross-thread socket use. See #1233 2018-07-07 21:13:46 +00:00
dmiller
0ff217dc53 Re-add some needed includes on Windows 2017-04-20 17:24:33 +00:00
dmiller
86edcb0e5b Remove some unused includes 2017-04-19 19:06:47 +00:00
dmiller
49eefce439 Sergey's GSOC 2016 brute.lua improvements. Closes #518 2016-12-09 15:05:51 +00:00
dmiller
18d7a9195d Mark a variable unused, since it is a byproduct of a different function and only used when OpenSSL is configured. 2016-10-18 02:24:40 +00:00
vincent
f704b6e830 Split declaration and setting of variable nsp to avoid warning
Actually this is not a problem. I've just split the variable 
declaration and assignment to fix the following compiler warning:
Compiler warning avoided: "variable nsp unused" - in case nmap has
been compiled without openssl.
Thus, this is more to bypass the warning than to fix anything at 
all.
2016-10-17 11:19:25 +00:00
dmiller
8b46e5e3c3 Be more clear about where errors come from in NSE bind 2016-08-30 18:59:55 +00:00
dmiller
610bb63f49 Port numbers are integers; bugs happen when we use floats. 2016-08-30 18:59:54 +00:00
batrick
71e3c76f95 use dynamic upval count to allow easy changes 2016-08-03 01:28:10 +00:00
dmiller
98d5fd7625 Fix a segfault due to Nsock event leak in NSE. 2016-07-21 21:36:40 +00:00
dmiller
dbc26606ca Fix crashes when assigning timeouts as floats. New NSE utility function nseU_checkinteger 2016-07-17 04:56:29 +00:00
batrick
7f5ec526fe Merge branch 'nse-lua53'
Lua 5.3 adds several awesome features of particular interest to nmap including
bitwise operators and integers, a utf8 library, and standard binary pack/unpack
functions.

In addition to adding Lua 5.3, this branch changes:

o Complete removal of the NSE bit library (in C), It has been replaced with
  a new Lua library wrapping Lua 5.3's bit-wise operators.

o Complete removal of the NSE bin library (in C). It has been replaced with a
  new Lua library wrapping Lua 5.3's string.pack|unpack functions.

o The bin.pack "B" format specifier (which has never worked correctly) is
  unimplemented.  All scripts/libraries which use it have been updated. Most
  usage of this option was to allow string based bit-wise operations which are no
  longer necessary now that Lua 5.3 provides integers and bit-wise operators.

o The base32/base64 libraries have been reimplemented using Lua 5.3's new
  bitwise operators. (This library was the main user of the bin.pack "B" format
  specifier.)

o A new "bits" library has been added for common bit hacks. Currently only has
  a reverse function.

Thanks to David Fifield, Daniel Miller, Jacek Wielemborek, and  Paulino
Calderon for testing this branch.
2016-07-02 17:02:27 +00:00
dmiller
3749c04310 Sanity check in pcap_recieve to avoid crash. Fixes #313 2016-03-07 16:44:52 +00:00
dmiller
0577e3bb1e Avoid crashing when Nsock connect calls the callback immediately due to parameter errors 2016-03-04 23:04:01 +00:00
henri
b55ff2d68f Don't associate nsock logging info to a nspool.
Make current loglevel and current log callback global
to the library. Attaching them to the nsock pool doesn't
bring any benefit and prevents from logging activity in
code sections that don't have access to a pool (such as
proxy chain specification parsing).

Updated external calls and nsock tests accordingly.
2015-06-27 08:21:53 +00:00
henri
b75233ce98 Consistently renamed nsi_XXX calls into nsock_iod_XXX
This is part of the effort to make nsock expose only
nsock_ prefixed symbols and simplify the API.
2015-06-27 08:21:33 +00:00
henri
fd40b8df08 Simplify Nsock SSL init API
Replaced nsock_pool_ssl_init_max_speed() by a NSOCK_SSL_MAX_SPEED
flag to be passed to nsock_pool_ssl_init(). Default (flag=0) means
secure.
2015-06-27 08:21:22 +00:00
henri
0348359f60 Enforce nsock naming scheme.
convert nsp_* calls into nsock_pool_*. Separate words with underscores
where appropriate.
2015-06-27 08:21:16 +00:00
dmiller
84d0e45641 Remove some unneeded includes of utils.h 2015-06-23 15:52:55 +00:00
dmiller
6a8f12e165 Prevent NSE from connecting to the wrong AF: http://seclists.org/nmap-dev/2012/q3/871 2015-05-15 19:35:18 +00:00
dmiller
2f02fa2935 Fix build when building without OpenSSL (since r33781) 2015-01-01 21:09:02 +00:00
dmiller
2871ba3e6c New function, sslcert.parse_ssl_certificate
For reasons, the function is exported from nse_ssl_cert.cc into
nmap.socket, then included and documented in sslcert.lua because it fits
better there.
2014-11-05 05:55:52 +00:00
dmiller
3ecd0452d5 Fix a memory leak in NSE's bind function 2014-09-15 22:49:17 +00:00
d33tah
421176fc00 Get rid of double newline at the EOF I accidentally introduced in the
last commit.
2014-06-18 11:30:02 +00:00
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