1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-06 22:49:02 +00:00
Commit Graph

12499 Commits

Author SHA1 Message Date
dmiller
a0b2d3d80e Check return value of eth_send in case of errors 2022-01-13 22:30:20 +00:00
dmiller
044295b0c8 Script tracing for dnet raw sends 2022-01-13 22:30:19 +00:00
dmiller
e8df904e7e Handle unknown/unexpected tokens in login. See #1554 2022-01-04 20:36:43 +00:00
dmiller
f78be32513 Handle pcap sockets just like other nsock sockets.
Pcap nsock sockets in NSE were cached so that multiple threads opening
the "same" pcap descriptor (same device, bpf, promisc, snaplen) would
get the same socket object. This is a leftover from a very old design
that would multiplex captured packets to each thread, but for a long
time that meant that each thread would just get whatever packets were
available and miss any that another thread received. This almost never
happened because scripts don't use identical pcap descriptors generally.
But it did complicate garbage collection, resulting in segfaults and
assertion failures in certain scenarios such as double-closing a socket.
2022-01-04 18:10:45 +00:00
dmiller
026cd801d7 NSE nsock event handling improvements
If an event is canceled, report it to the waiting thread as an error.
Previous behavior left a waiting thread waiting forever, so NSE never
stopped.

If the event is killed, that means Nsock is being shut down, so this is
coming from the garbage collection handler and we don't want to restore
anything. Just return instead.
2022-01-04 18:10:44 +00:00
dmiller
08d50ed318 NSE: quit if all remaining threads are abandoned workers 2022-01-04 18:10:43 +00:00
dmiller
279be9917d Simplify NSE timeout debug print 2022-01-04 18:10:43 +00:00
dmiller
c3d54f1fac Change how ms-sql NSE scripts run
MS SQL NSE scripts run on database instances, which can be TCP or named
pipes. With this change, all TCP instances on scanned ports will have
script output attached under the port as a portrule script. Named pipe
instances and TCP instances on unscanned ports will be displayed in the
hostrule script output at the end of the host's output. Utility function
mssql.Helper.InitScript makes it easy to write scripts that just work on
a per-instance basis, without bothering where to put the output.
Discovery will be done once per host, regardless of how many scripts are
run, and can be guaranteed to be done before the script's action takes
place.
2022-01-03 21:08:52 +00:00
dmiller
33405fcfb5 Remove an unused include [ci skip] 2022-01-03 21:08:51 +00:00
dmiller
4124025d62 Clarify that args are strings [ci skip] 2022-01-03 21:08:50 +00:00
dmiller
88c7e9d1e8 Use less space for pcap dev name; simplify ifdef 2021-12-16 23:29:17 +00:00
dmiller
541d89cb1a Check for arg problems earlier in connect and pcap_open 2021-12-16 23:29:16 +00:00
dmiller
3fe254abcc Suggest a reason why '-' cannot be resolved 2021-12-16 23:29:15 +00:00
dmiller
3cf836c9b5 Register mssql instances found in port scan. See #927 2021-12-15 23:44:43 +00:00
dmiller
6a2260aea0 Fix mssql's SetVersionNumber to consider subbuild (not used currently) 2021-12-15 23:44:42 +00:00
dmiller
02c0354744 Avoid TOCTOU by checking discovery state in mssql.Discover
A script might check WasDiscoveryPerformed and get a negative response,
then call Discover, during which time another script already called
Discover. Instead, check the condition *after* acquiring the mutex.
2021-12-15 23:44:41 +00:00
dmiller
0b7dc80349 Fix TDS7 password encoding. Fixes #2388. 2021-12-14 22:35:57 +00:00
dmiller
3e08021083 Don't rely on -1 return value from SSL_read, just check SSL_get_error() directly 2021-12-14 18:36:55 +00:00
dmiller
0467fa7866 Check the correct var for 413 error (was masked as 400) 2021-12-14 18:36:54 +00:00
dmiller
a292d37997 Remove function prototype that has since moved to libnetutil 2021-12-14 01:56:24 +00:00
dmiller
77fcbeca27 NSIS: disable Npcap install if installed version is newer or same. 2021-12-13 20:51:08 +00:00
dmiller
8d4c078394 Update deprecated IIS CPEs. Fixes #2401. Closes #2402 2021-12-13 20:27:39 +00:00
dmiller
9b71516919 Better socket error handling in rdp-vuln-ms12-020
Try to receive enough bytes for the next unpack. If any socket operation
fails, or if it doesn't receive enough for the unpack, a Lua error is
thrown. The pcall in the action function will catch that and interpret
it as not-vuln.

Fixes #2355
2021-12-13 20:14:07 +00:00
dmiller
85c1fd9b18 Parsing improvements for udp payloads
Save some memory and effort when parsing UDP payloads by reusing the
rather large buffer inside each token when possible, and only using
std::string::append() when necessary. For the current file, this avoids
*all* reallocations.
2021-12-12 23:42:39 +00:00
dmiller
2cbc7712da Avoid duplicating udp payloads in memory
Storing a pointer instead of the whole struct payload enables us to
reuse the same struct for as many ports as the payload defines, saving
memory as well as the time to copy the struct and its std::string
member. This commit also avoids several copy constructions and deletions
of the payload vector for each port defined in the file.
2021-12-12 23:42:38 +00:00
dmiller
2cea59aca0 Allow cleanup of netutil's interfaces cache 2021-12-12 23:42:38 +00:00
dmiller
e20093b16d Don't init payloads for non-udp scans 2021-12-12 23:42:37 +00:00
dmiller
ccf0f3af78 Make 'Starting' and 'Finished' debug prints balanced for worker threads 2021-12-12 23:42:36 +00:00
dmiller
b281598a4e Add a bit to nsedoc for nmap.list_interfaces 2021-12-12 23:42:35 +00:00
dmiller
bc1091d387 Improve TFTP detection. See #2406 2021-12-12 23:42:35 +00:00
dmiller
87fe985f32 Move a reused function out to file scope 2021-12-07 19:50:47 +00:00
dmiller
8a85cdd06b Minor perf boost: use locals, not class members, for string funcs in stdnse 2021-12-07 19:50:46 +00:00
dmiller
fa029ca531 Add BSON handlers for most data types. Fixes #2393 2021-12-07 19:33:40 +00:00
dmiller
d34d14416d Performance improvement for stdnse.tohex 2021-12-07 19:33:39 +00:00
nnposter
b869cfac51 Fix a port range typo. Closes #2390 2021-12-01 01:44:30 +00:00
fyodor
158c2e493c Change Insecure.Com LLC to Nmap Software LLC 2021-11-23 19:01:05 +00:00
fyodor
3aec3f3a07 Update to latest copyright templates. Main change is that Insecure.Com LLC is now Nmap Software LLC 2021-11-23 16:04:37 +00:00
fyodor
2fbde180da Update ndiff copyright header to remove dead link - see nmap#2389 2021-11-23 15:07:14 +00:00
fyodor
7f49e4ac56 Update ndiff copyright header to remove dead link - see nmap#2389 2021-11-23 15:05:14 +00:00
fyodor
647b06add8 Another small update to Ndiff LICENSE file 2021-11-23 15:02:27 +00:00
fyodor
063e4e6f61 Update nmap-payloads header comments as suggested in nmap#2389 2021-11-23 14:58:10 +00:00
dmiller
07811b8006 Avoid crashing script if bson can't be parsed. See #2393 2021-11-11 16:26:27 +00:00
dmiller
f062c59843 fix a typo in json test 2021-11-11 16:26:27 +00:00
nnposter
972ed6bac0 Add SOCKS5 support for SOCKS5_ATYP_NAME bind address. Closes #2365 2021-10-10 01:12:57 +00:00
dmiller
e2f58045df Fix Ncat's hostname/cert comparisons to handle non-null-term strings 2021-09-21 17:59:06 +00:00
dmiller
ac4484e258 Expand OS match. Fixes #2370 2021-09-16 16:18:40 +00:00
ron
210d3c29f4 Add new fingerprint to http-fingerprints.lua (/api/ and /api-docs/) 2021-09-10 17:13:24 +00:00
ron
b0bd2776a7 Add new fingerprint to http-fingerprints.lua (/error.html) 2021-09-09 18:13:32 +00:00
dmiller
5759df058b Revert local changes to zconf.h. Fixes #2359 2021-08-25 21:36:57 +00:00
dmiller
fda782cafe Catch most likely editor munges of hyphens in options. See #2335 2021-08-16 21:02:46 +00:00