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

373 Commits

Author SHA1 Message Date
henri
b7b3b4bd3e Default port is set to -1 (and not zero) when not specified in proxy specification string. 2013-04-22 19:32:44 +00:00
henri
c9d237f26b Added a new NSE_STATUS_PROXYERROR status type to report proxy-related errors
back to caller.
2013-04-22 19:32:29 +00:00
henri
da1559b237 Replaced a couple macros by corresponding static inline functions.
Removed unused PROXY_CTX_NODES() macro.
2013-04-22 19:32:20 +00:00
henri
6c0d537efb Removed unused http_proxy_info structure. 2013-04-22 19:32:11 +00:00
henri
152490e630 Removed per-node information structures as well as data encoding/decoding
interface.

These were unused and I think won't be required by any proxy type (HTTP and
SOCKS).
2013-04-22 19:32:04 +00:00
henri
173adc678b Implemented a more robust URI parser. Code largely adapted from ncat/http.c. 2013-04-22 19:31:56 +00:00
henri
26f918e310 Use an intermediate proxy_chain pointer for readability. 2013-04-22 19:31:47 +00:00
henri
ba27c10458 Removed the proxy-specific tcp_connect hook.
This simplifies the interface that proxies export to the library but also relies
upon the assumption that a proxy chain starts with a TCP connection from the
scanner to the next hop proxy. That will be enough ATM.
2013-04-22 19:31:40 +00:00
henri
4d5bb41361 Added skeletton for having px_info list in each Nsock IOD.
When establishing the tunnel through proxy chain, we need to track status of
each proxy (storing R/W buffers, stats, retries...).

This patch lets proxies store and manage whatever structure they want to have
for this in a Nsock IOD. Since types can differ between proxy types, the
proxy_info are stored as a list of void *, ordered like the proxy nodes.
2013-04-22 19:31:30 +00:00
henri
21327ee56c Return 1 on success to (try to) improve consistency. 2013-04-22 19:31:21 +00:00
henri
af65c7448f Removed 'data_' prefixes to encoding/decoding functions to avoid confusion with functions that deal with proxy internal data structures. 2013-04-22 19:31:14 +00:00
henri
5168ff9113 Moved prototypes to nsock_proxy.h 2013-04-22 19:31:06 +00:00
henri
4b9ff7f562 Removed unused macros. 2013-04-22 19:30:57 +00:00
henri
f1a04abd6b Removed the global ProxyOps list.
Each proxy node now provides a pointer to its operations struct.
2013-04-22 19:30:49 +00:00
henri
3451220630 Refactored proxy code to use a "strategy" design pattern.
Proxy backends are selected at runtime. Each proxy exports a list of operations
to the rest of the library. This is similar to the way IO engines are
implemented within nsock.
2013-04-22 19:30:40 +00:00
henri
08c44fe775 Added nsock_proxy.h to the DEPS list. 2013-04-22 19:30:30 +00:00
henri
48354754a8 Renamed proxy actions into proxy op, which seems to be rather more meaningful. 2013-04-22 19:30:23 +00:00
henri
e1030f2fe7 Cosmetic fixes. 2013-04-22 19:30:14 +00:00
henri
f5e437cdbf Removed undesired debugging printf() call. 2013-04-22 19:30:07 +00:00
henri
2b3a3ca5df Fixed ProxyAction extern declaration. 2013-04-22 19:29:58 +00:00
henri
91af533ca2 Added missing initializer. 2013-04-22 19:29:43 +00:00
henri
641d63efb4 Reduced scope of the top level proxy event handler.
There is no need anymore for exporting this function to the rest of the library.
It's called by the proxy hooks when registering new events.
2013-04-22 19:29:35 +00:00
henri
9084805bbf Added destructor for proxy_chain_context. 2013-04-22 19:29:26 +00:00
henri
28604b63e3 Design improvements.
Externally:
  The calling application can build a proxychain object and assign it to one (or
  more) NSP. Once a NSP get assigned a proxychain it's not possible to remove
  it so that consistency is (should be...) ensured.

Internally:
  An IOD comes with a proxychain context structure storing the whole tunnel
  state. Also each proxy type now has a table of associated functions to use
  as hooks for TCP connects(), read() and write() requests. As a result, adding
  support of new proxy type should be easier. Code also gains readability in
  comparison to large switch/cases that redirect the execution flow according to
  the given proxy type.
2013-04-22 19:29:18 +00:00
henri
06219414a6 Initial version with a _very_ raw support for HTTP proxy chains (using the
CONNECT method). This is mostly intended to validate the concepts, data models
and programming approach.
2013-04-22 19:28:53 +00:00
henri
6d9a68ecb9 Code cleanup.
Removed unused nse.time_created field.
Use bitfields instead of integers for nse.eof and nse.event_done
Indentation fixes.
2013-04-19 23:21:40 +00:00
david
87bab78479 Move CHECKED_FD_SET and CHECKED_FD_CLR to Nbase. 2013-02-22 00:45:57 +00:00
david
6e674f5cf5 Use an fprintf and abort instead of Nsock's fatal.
In preparation for move to Nbase.
2013-02-22 00:45:56 +00:00
david
d50afbca7d Fix some format string mismatches (int versus long int). 2013-02-22 00:45:55 +00:00
david
129d804d15 Add some missing noreturn and format attributes. 2013-02-22 00:45:55 +00:00
david
658b8648c6 Remove declartion of nonexistent myerror. 2013-02-22 00:45:54 +00:00
david
ce51d8c4da Use the default value of MultiThreadedDLL where possible. 2013-02-09 20:30:01 +00:00
david
6b095f42d2 Use MultiThreadedDebugDLL (/MDd) in place of MultiThreadedDebug (/MTd).
This is to match r8507, which did the analogous thing for the Release
configuration.
http://seclists.org/nmap-dev/2013/q1/120
2013-02-09 20:29:55 +00:00
henri
b4400d0a44 Added static inline wrappers to simplify calls to I/O engine functions. 2013-01-23 22:06:40 +00:00
henri
a7f2788b26 Removed another forgotten vestige of nsock_trace. 2013-01-23 22:06:35 +00:00
henri
0e5e939c00 Added a special NSOCK_LOG_NONE value, to disable all messages. 2013-01-23 21:25:01 +00:00
david
eb98386809 Remove vestiges of nsp_settrace.
Now you call nsock_set_log_function then nsock_set_loglevel.
http://seclists.org/nmap-dev/2013/q1/72
2013-01-22 23:40:16 +00:00
henri
0d58167dcf fixed format string! 2013-01-10 19:19:15 +00:00
henri
d878062cc7 Added format attribute to __nsock_log_internal.
This allows log format strings to be checked at compile time.
2013-01-10 19:19:09 +00:00
henri
fb90c4ff33 Replaced the LOWER_MAX_FD macro by a static inline function. 2013-01-07 21:54:07 +00:00
henri
941b73ac8a Minor style fixes. 2012-12-29 15:59:59 +00:00
henri
b6765c03fa Fixed SUN_LEN definition in nsock.h.
Added missing parenthesis to nsock's SUN_LEN for platforms
where the macro isn't defined.

Report and patch by Conor McCarthy
2012-12-24 23:29:18 +00:00
henri
2774c8cce6 Filespace code cleanup.
- Removed dead code.
- Fixed style, improved consistency.
- Replaced FILESPACE_LENGTH and FILESPACE_STR macros by identical
  static inline functions.
- Made fs_cat() a regular function. There's no actual benefit of
  having it inlined.
2012-12-22 21:59:38 +00:00
henri
f2757be055 Proper error reporting during socket creation and initialization. 2012-12-20 18:10:54 +00:00
henri
b0fe74e355 More log message cleanup. Use __func__ when referring to the current function's name. 2012-12-15 18:21:09 +00:00
henri
3206c48aab Normalized log messages. No idea why I initially put underscores instead of spaces there. 2012-12-15 18:16:59 +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
ab802a6f21 Update some more headers. 2012-12-06 02:25:46 +00:00
fyodor
6a42ef47c0 Update the Nmap and Nsock source code headers to note new Nmap dev mailing list email address and a better URL for Nmap license. 2012-12-06 01:21:42 +00:00
david
2bfeace798 Make it an error in nsock_make_socket if AF_UNIX can't bind.
http://seclists.org/nmap-dev/2012/q4/345
2012-11-29 03:31:50 +00:00