mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 06:01:28 +00:00
Added a --nsock-engine option to nmap, nping and ncat to enforce use of a
given nsock IO engine. [Henri]
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
# Nmap Changelog ($Id$); -*-text-*-
|
# Nmap Changelog ($Id$); -*-text-*-
|
||||||
|
|
||||||
|
o Added a --nsock-engine option to nmap, nping and ncat to enforce use of a
|
||||||
|
given nsock IO engine. [Henri]
|
||||||
|
|
||||||
o [NSE] Added support to broadcast-listener for extracting address, native vlan
|
o [NSE] Added support to broadcast-listener for extracting address, native vlan
|
||||||
and management IP address from CDP packets. [Tom]
|
and management IP address from CDP packets. [Tom]
|
||||||
|
|
||||||
|
|||||||
@@ -2860,6 +2860,23 @@ worth the extra time.</para>
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--nsock-engine
|
||||||
|
epoll|select</option>
|
||||||
|
<indexterm><primary><option>--nsock-engine</option></primary></indexterm>
|
||||||
|
<indexterm><primary>Nsock IO engine</primary></indexterm>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
|
||||||
|
<para>Enforce use of a given nsock IO multiplexing engine. Only the
|
||||||
|
<literal>select(2)</literal>-based fallback engine is guaranteed to be
|
||||||
|
available on your system. Engines are named after the name of the IO
|
||||||
|
management facility they leverage. Engines currenty implemented are
|
||||||
|
<literal>epoll</literal> and <literal>select</literal>.</para>
|
||||||
|
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<option>-T
|
<option>-T
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ int main(int argc, char *argv[])
|
|||||||
{"proxy", required_argument, NULL, 0},
|
{"proxy", required_argument, NULL, 0},
|
||||||
{"proxy-type", required_argument, NULL, 0},
|
{"proxy-type", required_argument, NULL, 0},
|
||||||
{"proxy-auth", required_argument, NULL, 0},
|
{"proxy-auth", required_argument, NULL, 0},
|
||||||
|
{"nsock-engine", required_argument, NULL, 0},
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
{"ssl", no_argument, &o.ssl, 1},
|
{"ssl", no_argument, &o.ssl, 1},
|
||||||
{"ssl-cert", required_argument, NULL, 0},
|
{"ssl-cert", required_argument, NULL, 0},
|
||||||
@@ -412,6 +413,10 @@ int main(int argc, char *argv[])
|
|||||||
bye("You can't specify more than one --proxy-auth.");
|
bye("You can't specify more than one --proxy-auth.");
|
||||||
o.proxy_auth = Strdup(optarg);
|
o.proxy_auth = Strdup(optarg);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(long_options[option_index].name, "nsock-engine") == 0)
|
||||||
|
{
|
||||||
|
nsock_set_default_engine(optarg);
|
||||||
|
}
|
||||||
else if (strcmp(long_options[option_index].name, "broker") == 0)
|
else if (strcmp(long_options[option_index].name, "broker") == 0)
|
||||||
{
|
{
|
||||||
o.broker = 1;
|
o.broker = 1;
|
||||||
|
|||||||
5
nmap.cc
5
nmap.cc
@@ -573,6 +573,8 @@ void parse_options(int argc, char **argv) {
|
|||||||
{"source-port", required_argument, 0, 'g'},
|
{"source-port", required_argument, 0, 'g'},
|
||||||
{"randomize_hosts", no_argument, 0, 0},
|
{"randomize_hosts", no_argument, 0, 0},
|
||||||
{"randomize-hosts", no_argument, 0, 0},
|
{"randomize-hosts", no_argument, 0, 0},
|
||||||
|
{"nsock_engine", required_argument, 0, 0},
|
||||||
|
{"nsock-engine", required_argument, 0, 0},
|
||||||
{"osscan_limit", no_argument, 0, 0}, /* skip OSScan if no open ports */
|
{"osscan_limit", no_argument, 0, 0}, /* skip OSScan if no open ports */
|
||||||
{"osscan-limit", no_argument, 0, 0}, /* skip OSScan if no open ports */
|
{"osscan-limit", no_argument, 0, 0}, /* skip OSScan if no open ports */
|
||||||
{"osscan_guess", no_argument, 0, 0}, /* More guessing flexability */
|
{"osscan_guess", no_argument, 0, 0}, /* More guessing flexability */
|
||||||
@@ -793,6 +795,8 @@ void parse_options(int argc, char **argv) {
|
|||||||
|| strcmp(long_options[option_index].name, "rH") == 0) {
|
|| strcmp(long_options[option_index].name, "rH") == 0) {
|
||||||
o.randomize_hosts = 1;
|
o.randomize_hosts = 1;
|
||||||
o.ping_group_sz = PING_GROUP_SZ * 4;
|
o.ping_group_sz = PING_GROUP_SZ * 4;
|
||||||
|
} else if (optcmp(long_options[option_index].name, "nsock-engine") == 0) {
|
||||||
|
nsock_set_default_engine(optarg);
|
||||||
} else if (optcmp(long_options[option_index].name, "osscan-limit") == 0) {
|
} else if (optcmp(long_options[option_index].name, "osscan-limit") == 0) {
|
||||||
o.osscan_limit = 1;
|
o.osscan_limit = 1;
|
||||||
} else if (optcmp(long_options[option_index].name, "osscan-guess") == 0
|
} else if (optcmp(long_options[option_index].name, "osscan-guess") == 0
|
||||||
@@ -2111,6 +2115,7 @@ void nmap_free_mem() {
|
|||||||
free_services();
|
free_services();
|
||||||
AllProbes::service_scan_free();
|
AllProbes::service_scan_free();
|
||||||
traceroute_hop_cache_clear();
|
traceroute_hop_cache_clear();
|
||||||
|
nsock_set_default_engine(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reads in a (normal or machine format) Nmap log file and gathers enough
|
/* Reads in a (normal or machine format) Nmap log file and gathers enough
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ char errstr[256];
|
|||||||
{"send-ip", no_argument, 0, 0},
|
{"send-ip", no_argument, 0, 0},
|
||||||
{"bpf-filter", required_argument, 0, 0},
|
{"bpf-filter", required_argument, 0, 0},
|
||||||
{"filter", required_argument, 0, 0},
|
{"filter", required_argument, 0, 0},
|
||||||
|
{"nsock-engine", required_argument, 0, 0},
|
||||||
{"no-capture", no_argument, 0, 'N'},
|
{"no-capture", no_argument, 0, 'N'},
|
||||||
{"hide-sent", no_argument, 0, 'H'},
|
{"hide-sent", no_argument, 0, 'H'},
|
||||||
|
|
||||||
@@ -954,7 +955,9 @@ char errstr[256];
|
|||||||
o.setBPFFilterSpec( optarg );
|
o.setBPFFilterSpec( optarg );
|
||||||
if( o.issetDisablePacketCapture() && o.disablePacketCapture()==true )
|
if( o.issetDisablePacketCapture() && o.disablePacketCapture()==true )
|
||||||
outError(QT_2, "Warning: There is no point on specifying a BPF filter if you disable packet capture. BPF filter will be ignored.");
|
outError(QT_2, "Warning: There is no point on specifying a BPF filter if you disable packet capture. BPF filter will be ignored.");
|
||||||
|
} else if (optcmp(long_options[option_index].name, "nsock-engine") == 0){
|
||||||
|
nsock_set_default_engine(optarg);
|
||||||
|
|
||||||
/* Output Options */
|
/* Output Options */
|
||||||
} else if (optcmp(long_options[option_index].name, "quiet") == 0 ){
|
} else if (optcmp(long_options[option_index].name, "quiet") == 0 ){
|
||||||
o.setVerbosity(-4);
|
o.setVerbosity(-4);
|
||||||
|
|||||||
@@ -193,6 +193,14 @@ nsock_ssl_ctx nsp_ssl_init(nsock_pool ms_pool);
|
|||||||
* verification is done. Returns the SSL_CTX so you can set your own options. */
|
* verification is done. Returns the SSL_CTX so you can set your own options. */
|
||||||
nsock_ssl_ctx nsp_ssl_init_max_speed(nsock_pool ms_pool);
|
nsock_ssl_ctx nsp_ssl_init_max_speed(nsock_pool ms_pool);
|
||||||
|
|
||||||
|
/* Enforce use of a given IO engine.
|
||||||
|
* The engine parameter is a zero-terminated string that will be
|
||||||
|
* strup()'ed by the library. No validity check is performed by this function,
|
||||||
|
* beware nsp_new() will fatal() if an invalid/unavailable engine name was
|
||||||
|
* supplied before.
|
||||||
|
* Pass NULL to reset to default (use most efficient engine available). */
|
||||||
|
void nsock_set_default_engine(char *engine);
|
||||||
|
|
||||||
/* And here is how you create an nsock_pool. This allocates, initializes, and
|
/* And here is how you create an nsock_pool. This allocates, initializes, and
|
||||||
* returns an nsock_pool event aggregator. In the case of error, NULL will be
|
* returns an nsock_pool event aggregator. In the case of error, NULL will be
|
||||||
* returned. If you do not wish to immediately associate any userdata, pass in
|
* returned. If you do not wish to immediately associate any userdata, pass in
|
||||||
|
|||||||
@@ -83,8 +83,10 @@ static struct io_engine *available_engines[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char *engine_hint;
|
||||||
|
|
||||||
struct io_engine *get_io_engine(const char *engine_hint) {
|
|
||||||
|
struct io_engine *get_io_engine(void) {
|
||||||
struct io_engine *engine = NULL;
|
struct io_engine *engine = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -105,3 +107,13 @@ struct io_engine *get_io_engine(const char *engine_hint) {
|
|||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsock_set_default_engine(char *engine) {
|
||||||
|
if (engine_hint)
|
||||||
|
free(engine_hint);
|
||||||
|
|
||||||
|
if (engine)
|
||||||
|
engine_hint = strdup(engine);
|
||||||
|
else
|
||||||
|
engine_hint = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ static int nsocklib_initialized = 0;
|
|||||||
|
|
||||||
|
|
||||||
/* defined in nsock_engines.h */
|
/* defined in nsock_engines.h */
|
||||||
struct io_engine *get_io_engine(const char *engine_hint);
|
struct io_engine *get_io_engine(void);
|
||||||
|
|
||||||
/* ---- INTERNAL FUNCTIONS PROTOTYPES ---- */
|
/* ---- INTERNAL FUNCTIONS PROTOTYPES ---- */
|
||||||
static void nsock_library_initialize(void);
|
static void nsock_library_initialize(void);
|
||||||
@@ -170,7 +170,7 @@ nsock_pool nsp_new(void *userdata) {
|
|||||||
|
|
||||||
nsp->userdata = userdata;
|
nsp->userdata = userdata;
|
||||||
|
|
||||||
nsp->engine = get_io_engine(NULL);
|
nsp->engine = get_io_engine();
|
||||||
nsp->engine->init(nsp);
|
nsp->engine->init(nsp);
|
||||||
|
|
||||||
/* initialize IO events lists */
|
/* initialize IO events lists */
|
||||||
|
|||||||
Reference in New Issue
Block a user