1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-16 11:29:02 +00:00
Commit Graph

13108 Commits

Author SHA1 Message Date
dmiller
38823b5cd1 Handle SSL_read()/SSL_write() returning 0 when not EOF.
OpenSSL docs say, "Old documentation indicated a difference between 0
and -1, and that -1 was retryable. You should instead call
SSL_get_error() to find out if it's retryable."
2024-11-21 20:11:38 +00:00
dmiller
ff1df7a80c Zero IOD in nsock_iod_new2. Was reusing old peer info 2024-11-18 23:02:48 +00:00
dmiller
4efe456e0b Nsock iocp: pass immediate errors on to process_event() 2024-11-18 21:19:46 +00:00
dmiller
4aa83a7fc1 Fix a warning about printf parameter width 2024-11-18 20:26:29 +00:00
dmiller
b1f6f9b088 Track EOF at IOD level also 2024-11-18 20:26:28 +00:00
dmiller
1f6e8d9fe3 Handle EWOULDBLOCK as well as EAGAIN 2024-11-18 20:26:27 +00:00
dmiller
f72c0df772 Docs for -q option. Fixes #2422 2024-11-18 18:13:17 +00:00
dmiller
498e92539f Use usleep in ncat-test.pl. Use 3-arg open 2024-11-18 17:11:43 +00:00
dmiller
1db532209e Add -q option to Ncat 2024-11-16 17:55:50 +00:00
dmiller
6e3d70ff3f dicom.lua: use length-prefixed string packing 2024-11-13 19:15:13 +00:00
dmiller
274ecc0248 simplify a loop 2024-11-13 19:15:13 +00:00
dmiller
d21a4ee4ce Correctly pack TCP payload size for dns.lua 2024-11-13 19:15:12 +00:00
dmiller
cffc94e845 Consolidate event list management to nevent_unref()
Removes duplicate logic for PCAP_BSD_SELECT_HACK. May address accounting
problems that led to issues like #187 (macOS) and #2912 (Windows).
2024-11-13 19:15:12 +00:00
dmiller
222add87a6 Paranoid gh_list check: node is in list before removal 2024-11-13 19:15:11 +00:00
dmiller
3f64103cf0 Move some prototypes to nsock_internal.h 2024-11-13 19:15:10 +00:00
dmiller
82586d6327 Remove unused functions from snmp.lua 2024-11-12 20:05:58 +00:00
dmiller
fdf5a2d7e9 Configurable retries for snmp.lua 2024-11-12 20:05:57 +00:00
dmiller
10321be656 snmp.lua: add configurable timeout 2024-11-12 20:05:57 +00:00
dmiller
379b56b582 Include timeout info in debug output for all nsock reads/connects 2024-11-12 20:05:56 +00:00
dmiller
2d43280b16 NSE libssh2 bindings: allow exec without pty 2024-11-11 21:07:01 +00:00
dmiller
e2ccdb8074 Fix a typo in ssh-run 2024-11-11 21:07:01 +00:00
dmiller
33bfd251b4 Macro for common idiom in nse_libssh2 2024-11-11 21:07:00 +00:00
dmiller
5d14851aaa Fix error in ldap-brute: 'no string output' 2024-11-11 21:06:59 +00:00
dmiller
bfba1352e4 Fix UDP listen on Windows: recvfrom behaves differently. 2024-11-07 23:43:26 +00:00
dmiller
1e8c1ab3cd Let all nsock engines use STDIN on Windows! 2024-11-06 16:48:29 +00:00
dmiller
1c3fc17d2f Ncat: handle overlapped stdin socket from nbase's fselect 2024-11-06 16:47:25 +00:00
dmiller
6b2df74ef2 Nbase: use a static SOCKET for STDIN 2024-11-06 16:46:32 +00:00
dmiller
635cc50011 Nsock iocp: fix IPv6 connect 2024-11-06 16:06:32 +00:00
dmiller
f9b9434044 nbase: win32 build fix 2024-11-06 16:05:03 +00:00
dmiller
411b186576 Simplify nevent_delete for PCAP_BSD_SELECT_HACK mode 2024-11-01 18:40:09 +00:00
dmiller
2ca95ad6b4 Nsock select engine: don't process if sd is -1 (nonselectable) 2024-11-01 18:40:08 +00:00
dmiller
0e3a51c992 Set timeouts for Windows connect scan. Fixes #2113 2024-10-30 19:02:09 +00:00
dmiller
f1559fbc22 Use a socket, not pipe, for STDIN emulation in fselect
Using a TCP connected socket allows us to use a single select call instead of
interrupting it every 125ms to poll the stdin-pipe.
2024-10-30 18:55:39 +00:00
dmiller
fef9f592b0 POSIX usleep() returns an int. 2024-10-28 23:17:05 +00:00
dmiller
f0c022b25f Avoid infinite loop on systems where select doesn't update timeout 2024-10-28 23:11:53 +00:00
dmiller
191aadf142 Record current time for connect probes, not an old time 2024-10-28 23:11:52 +00:00
dmiller
cf718f2071 Avoid a few extra gettimeofday calls 2024-10-28 23:11:52 +00:00
dmiller
df1604ab19 Simplify pcap_select, remove timeval form 2024-10-28 23:11:51 +00:00
dmiller
931c13cd21 Fixes for IOCP engine build 2024-10-15 20:37:11 +00:00
dmiller
7703b045e5 Nsock poll engine: efficient use of pollfds array
Using socket descriptor as an index works okay for UNIX, though it
wastes the first several indices which are assigned to STDIN/STDOUT,
files, etc. However, for Windows it is really bad, since descriptors are
large, nonconsecutive numbers. Using a little overhead to track each
iod's index and the next empty space is worth it.
2024-10-11 20:59:35 +00:00
dmiller
14142ce874 Use nbase's usleep, not select, for delay timer in Ncat 2024-10-11 20:59:34 +00:00
dmiller
b94ae785ba Fix handling of non-select()-able pcap handles
1. pcap_get_selectable_fd() may return -1 for some devices, even if the
   platform as a whole supports select() on these handles. Check for
   this condition throughout.
2. The various backend system calls (kevent, poll, epoll, etc.) do not
   sleep for the timeout period if no valid handles are registered,
   unlike select on UNIX. This leads to busy wait, looping continuously.
   Instead, we call usleep() in those cases.
2024-10-11 20:59:34 +00:00
dmiller
6186767cd1 Move a useful function to nsock_core.c 2024-10-11 20:59:33 +00:00
dmiller
532938f49c Do a non-blocking check for events when pcap data is available
For platforms without selectable pcap handles (e.g. Windows), the
arrival of data for a pcap read would previously skip checking for any
triggered non-pcap events in that loop iteration. This is not usually a
problem because the next loop will be triggered immediately, picking up
the non-pcap events before any further pcap data arrives. However,
excessive pcap data on a handle in immediate mode might prevent the
engine loop from checking for non-pcap events for long enough to result
in timeouts. Instead, do a non-blocking check for triggered events in
this case and handle those in the same loop iteration.
2024-10-09 17:40:10 +00:00
dmiller
167fafe65c Correctly handle all cases for canceling IO in iocp engine 2024-10-08 21:14:43 +00:00
dmiller
f765af4070 IOCP engine: further checks against duplicating eovs 2024-10-08 21:14:42 +00:00
dmiller
30bc184e0f Fix iocp engine when calling nsock_read on unconnected socket
When the IOD isn't connected, iod->peerlen is 0, which means WSARecvFrom
returns WSAEFAULT because the lpFrom parameter is not NULL, and 0 bytes
is not enough space to fit any sockaddr.
2024-10-08 21:14:42 +00:00
dmiller
d42dd7eed9 Additional tests and checks for gh_heap validity 2024-10-08 21:14:41 +00:00
dmiller
f8d4531b1f Make some broadcast scripts 'safe' category 2024-10-08 21:14:40 +00:00
dmiller
0bae611494 Don't use 1ms timeout for writes. Actual time can be >100ms because of NSE overhead 2024-10-08 21:14:40 +00:00