mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Use bool not int for boolean options
This commit is contained in:
50
NmapOps.cc
50
NmapOps.cc
@@ -297,15 +297,15 @@ void NmapOps::Initialize() {
|
|||||||
min_packet_send_rate = 0.0; /* Unset. */
|
min_packet_send_rate = 0.0; /* Unset. */
|
||||||
max_packet_send_rate = 0.0; /* Unset. */
|
max_packet_send_rate = 0.0; /* Unset. */
|
||||||
stats_interval = 0.0; /* Unset. */
|
stats_interval = 0.0; /* Unset. */
|
||||||
randomize_hosts = 0;
|
randomize_hosts = false;
|
||||||
randomize_ports = 1;
|
randomize_ports = true;
|
||||||
sendpref = PACKET_SEND_NOPREF;
|
sendpref = PACKET_SEND_NOPREF;
|
||||||
spoofsource = 0;
|
spoofsource = false;
|
||||||
fastscan = 0;
|
fastscan = false;
|
||||||
device[0] = '\0';
|
device[0] = '\0';
|
||||||
ping_group_sz = PING_GROUP_SZ;
|
ping_group_sz = PING_GROUP_SZ;
|
||||||
nogcc = 0;
|
nogcc = false;
|
||||||
generate_random_ips = 0;
|
generate_random_ips = false;
|
||||||
reference_FPs = NULL;
|
reference_FPs = NULL;
|
||||||
magic_port = 33000 + (get_random_uint() % 31000);
|
magic_port = 33000 + (get_random_uint() % 31000);
|
||||||
magic_port_set = false;
|
magic_port_set = false;
|
||||||
@@ -328,28 +328,28 @@ void NmapOps::Initialize() {
|
|||||||
scan_delay = 0;
|
scan_delay = 0;
|
||||||
open_only = false;
|
open_only = false;
|
||||||
scanflags = -1;
|
scanflags = -1;
|
||||||
defeat_rst_ratelimit = 0;
|
defeat_rst_ratelimit = false;
|
||||||
defeat_icmp_ratelimit = 0;
|
defeat_icmp_ratelimit = false;
|
||||||
resume_ip.s_addr = 0;
|
resume_ip.s_addr = 0;
|
||||||
osscan_limit = 0;
|
osscan_limit = false;
|
||||||
osscan_guess = 0;
|
osscan_guess = false;
|
||||||
numdecoys = 0;
|
numdecoys = 0;
|
||||||
decoyturn = -1;
|
decoyturn = -1;
|
||||||
osscan = 0;
|
osscan = false;
|
||||||
servicescan = 0;
|
servicescan = false;
|
||||||
override_excludeports = 0;
|
override_excludeports = false;
|
||||||
version_intensity = 7;
|
version_intensity = 7;
|
||||||
pingtype = PINGTYPE_UNKNOWN;
|
pingtype = PINGTYPE_UNKNOWN;
|
||||||
listscan = allowall = ackscan = bouncescan = connectscan = 0;
|
listscan = ackscan = bouncescan = connectscan = 0;
|
||||||
nullscan = xmasscan = fragscan = synscan = windowscan = 0;
|
nullscan = xmasscan = fragscan = synscan = windowscan = 0;
|
||||||
maimonscan = idlescan = finscan = udpscan = ipprotscan = 0;
|
maimonscan = idlescan = finscan = udpscan = ipprotscan = 0;
|
||||||
noportscan = noresolve = 0;
|
noportscan = noresolve = false;
|
||||||
sctpinitscan = 0;
|
sctpinitscan = 0;
|
||||||
sctpcookieechoscan = 0;
|
sctpcookieechoscan = 0;
|
||||||
append_output = 0;
|
append_output = false;
|
||||||
memset(logfd, 0, sizeof(FILE *) * LOG_NUM_FILES);
|
memset(logfd, 0, sizeof(FILE *) * LOG_NUM_FILES);
|
||||||
ttl = -1;
|
ttl = -1;
|
||||||
badsum = 0;
|
badsum = false;
|
||||||
nmap_stdout = stdout;
|
nmap_stdout = stdout;
|
||||||
gettimeofday(&start_time, NULL);
|
gettimeofday(&start_time, NULL);
|
||||||
pTrace = vTrace = false;
|
pTrace = vTrace = false;
|
||||||
@@ -379,11 +379,11 @@ void NmapOps::Initialize() {
|
|||||||
release_memory = false;
|
release_memory = false;
|
||||||
topportlevel = -1;
|
topportlevel = -1;
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
script = 0;
|
script = false;
|
||||||
scriptargs = NULL;
|
scriptargs = NULL;
|
||||||
scriptversion = 0;
|
scriptversion = false;
|
||||||
scripttrace = 0;
|
scripttrace = false;
|
||||||
scriptupdatedb = 0;
|
scriptupdatedb = false;
|
||||||
scripthelp = false;
|
scripthelp = false;
|
||||||
scripttimeout = 0;
|
scripttimeout = 0;
|
||||||
chosenScripts.clear();
|
chosenScripts.clear();
|
||||||
@@ -546,16 +546,16 @@ administrator privileges.";
|
|||||||
|
|
||||||
if (osscan && ipprotscan) {
|
if (osscan && ipprotscan) {
|
||||||
error("WARNING: Disabling OS Scan (-O) as it is incompatible with the IPProto Scan (-sO)");
|
error("WARNING: Disabling OS Scan (-O) as it is incompatible with the IPProto Scan (-sO)");
|
||||||
osscan = 0;
|
osscan = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (servicescan && ipprotscan) {
|
if (servicescan && ipprotscan) {
|
||||||
error("WARNING: Disabling Service Scan (-sV) as it is incompatible with the IPProto Scan (-sO)");
|
error("WARNING: Disabling Service Scan (-sV) as it is incompatible with the IPProto Scan (-sO)");
|
||||||
servicescan = 0;
|
servicescan = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (servicescan && noportscan)
|
if (servicescan && noportscan)
|
||||||
servicescan = 0;
|
servicescan = false;
|
||||||
|
|
||||||
if (defeat_rst_ratelimit && !synscan && !openOnly()) {
|
if (defeat_rst_ratelimit && !synscan && !openOnly()) {
|
||||||
fatal("Option --defeat-rst-ratelimit works only with a SYN scan (-sS)");
|
fatal("Option --defeat-rst-ratelimit works only with a SYN scan (-sS)");
|
||||||
@@ -580,7 +580,7 @@ administrator privileges.";
|
|||||||
fatal("--min-rate=%g must be less than or equal to --max-rate=%g", min_packet_send_rate, max_packet_send_rate);
|
fatal("--min-rate=%g must be less than or equal to --max-rate=%g", min_packet_send_rate, max_packet_send_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (af() == AF_INET6 && (generate_random_ips|bouncescan|fragscan)) {
|
if (af() == AF_INET6 && (generate_random_ips||bouncescan||fragscan)) {
|
||||||
fatal("Random targets, FTP bounce scan, and fragmentation are not supported with IPv6.");
|
fatal("Random targets, FTP bounce scan, and fragmentation are not supported with IPv6.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
43
NmapOps.h
43
NmapOps.h
@@ -228,14 +228,14 @@ class NmapOps {
|
|||||||
float max_packet_send_rate;
|
float max_packet_send_rate;
|
||||||
/* The requested auto stats printing interval, or 0.0 if unset. */
|
/* The requested auto stats printing interval, or 0.0 if unset. */
|
||||||
float stats_interval;
|
float stats_interval;
|
||||||
int randomize_hosts;
|
bool randomize_hosts;
|
||||||
int randomize_ports;
|
bool randomize_ports;
|
||||||
int spoofsource; /* -S used */
|
bool spoofsource; /* -S used */
|
||||||
int fastscan;
|
bool fastscan;
|
||||||
char device[64];
|
char device[64];
|
||||||
int ping_group_sz;
|
int ping_group_sz;
|
||||||
int nogcc; /* Turn off group congestion control with --nogcc */
|
bool nogcc; /* Turn off group congestion control with --nogcc */
|
||||||
int generate_random_ips; /* -iR option */
|
bool generate_random_ips; /* -iR option */
|
||||||
FingerPrintDB *reference_FPs; /* Used in the new OS scan system. */
|
FingerPrintDB *reference_FPs; /* Used in the new OS scan system. */
|
||||||
std::vector<FingerMatch> os_labels_ipv6;
|
std::vector<FingerMatch> os_labels_ipv6;
|
||||||
u16 magic_port; /* The source port set by -g or --source-port. */
|
u16 magic_port; /* The source port set by -g or --source-port. */
|
||||||
@@ -308,11 +308,11 @@ class NmapOps {
|
|||||||
FIN scan into a PSH scan. Sort of a hack, but can
|
FIN scan into a PSH scan. Sort of a hack, but can
|
||||||
be very useful sometimes. */
|
be very useful sometimes. */
|
||||||
|
|
||||||
int defeat_rst_ratelimit; /* Solaris 9 rate-limits RSTs so scanning is very
|
bool defeat_rst_ratelimit; /* Solaris 9 rate-limits RSTs so scanning is very
|
||||||
slow against it. If we don't distinguish between closed and filtered ports,
|
slow against it. If we don't distinguish between closed and filtered ports,
|
||||||
we can get the list of open ports very fast */
|
we can get the list of open ports very fast */
|
||||||
|
|
||||||
int defeat_icmp_ratelimit; /* If a host rate-limits ICMP responses, then scanning
|
bool defeat_icmp_ratelimit; /* If a host rate-limits ICMP responses, then scanning
|
||||||
is very slow against it. This option prevents Nmap to adjust timing
|
is very slow against it. This option prevents Nmap to adjust timing
|
||||||
when it changes the port's state because of ICMP response, as the latter
|
when it changes the port's state because of ICMP response, as the latter
|
||||||
might be rate-limited. Doing so we can get scan results faster. */
|
might be rate-limited. Doing so we can get scan results faster. */
|
||||||
@@ -324,19 +324,18 @@ class NmapOps {
|
|||||||
to 0. */
|
to 0. */
|
||||||
|
|
||||||
// Version Detection Options
|
// Version Detection Options
|
||||||
int override_excludeports;
|
bool override_excludeports;
|
||||||
int version_intensity;
|
int version_intensity;
|
||||||
|
|
||||||
struct sockaddr_storage decoys[MAX_DECOYS];
|
struct sockaddr_storage decoys[MAX_DECOYS];
|
||||||
int osscan_limit; /* Skip OS Scan if no open or no closed TCP ports */
|
bool osscan_limit; /* Skip OS Scan if no open or no closed TCP ports */
|
||||||
int osscan_guess; /* Be more aggressive in guessing OS type */
|
bool osscan_guess; /* Be more aggressive in guessing OS type */
|
||||||
int numdecoys;
|
int numdecoys;
|
||||||
int decoyturn;
|
int decoyturn;
|
||||||
int osscan;
|
bool osscan;
|
||||||
int servicescan;
|
bool servicescan;
|
||||||
int pingtype;
|
int pingtype;
|
||||||
int listscan;
|
int listscan;
|
||||||
int allowall;
|
|
||||||
int fragscan; /* 0 or MTU (without IPv4 header size) */
|
int fragscan; /* 0 or MTU (without IPv4 header size) */
|
||||||
int ackscan;
|
int ackscan;
|
||||||
int bouncescan;
|
int bouncescan;
|
||||||
@@ -353,13 +352,13 @@ class NmapOps {
|
|||||||
int sctpcookieechoscan;
|
int sctpcookieechoscan;
|
||||||
int windowscan;
|
int windowscan;
|
||||||
int xmasscan;
|
int xmasscan;
|
||||||
int noresolve;
|
bool noresolve;
|
||||||
int noportscan;
|
bool noportscan;
|
||||||
int append_output; /* Append to any output files rather than overwrite */
|
bool append_output; /* Append to any output files rather than overwrite */
|
||||||
FILE *logfd[LOG_NUM_FILES];
|
FILE *logfd[LOG_NUM_FILES];
|
||||||
FILE *nmap_stdout; /* Nmap standard output */
|
FILE *nmap_stdout; /* Nmap standard output */
|
||||||
int ttl; // Time to live
|
int ttl; // Time to live
|
||||||
int badsum;
|
bool badsum;
|
||||||
char *datadir;
|
char *datadir;
|
||||||
/* A map from abstract data file names like "nmap-services" and "nmap-os-db"
|
/* A map from abstract data file names like "nmap-services" and "nmap-os-db"
|
||||||
to paths which have been requested by the user. nmap_fetchfile will return
|
to paths which have been requested by the user. nmap_fetchfile will return
|
||||||
@@ -398,12 +397,12 @@ class NmapOps {
|
|||||||
nsock_proxychain proxy_chain;
|
nsock_proxychain proxy_chain;
|
||||||
|
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
int script;
|
bool script;
|
||||||
char *scriptargs;
|
char *scriptargs;
|
||||||
char *scriptargsfile;
|
char *scriptargsfile;
|
||||||
int scriptversion;
|
bool scriptversion;
|
||||||
int scripttrace;
|
bool scripttrace;
|
||||||
int scriptupdatedb;
|
bool scriptupdatedb;
|
||||||
bool scripthelp;
|
bool scripthelp;
|
||||||
double scripttimeout;
|
double scripttimeout;
|
||||||
void chooseScripts(char* argument);
|
void chooseScripts(char* argument);
|
||||||
|
|||||||
62
nmap.cc
62
nmap.cc
@@ -735,16 +735,16 @@ void parse_options(int argc, char **argv) {
|
|||||||
case 0:
|
case 0:
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
if (strcmp(long_options[option_index].name, "script") == 0) {
|
if (strcmp(long_options[option_index].name, "script") == 0) {
|
||||||
o.script = 1;
|
o.script = true;
|
||||||
o.chooseScripts(optarg);
|
o.chooseScripts(optarg);
|
||||||
} else if (optcmp(long_options[option_index].name, "script-args") == 0) {
|
} else if (optcmp(long_options[option_index].name, "script-args") == 0) {
|
||||||
o.scriptargs = strdup(optarg);
|
o.scriptargs = strdup(optarg);
|
||||||
} else if (optcmp(long_options[option_index].name, "script-args-file") == 0) {
|
} else if (optcmp(long_options[option_index].name, "script-args-file") == 0) {
|
||||||
o.scriptargsfile = strdup(optarg);
|
o.scriptargsfile = strdup(optarg);
|
||||||
} else if (optcmp(long_options[option_index].name, "script-trace") == 0) {
|
} else if (optcmp(long_options[option_index].name, "script-trace") == 0) {
|
||||||
o.scripttrace = 1;
|
o.scripttrace = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "script-updatedb") == 0) {
|
} else if (optcmp(long_options[option_index].name, "script-updatedb") == 0) {
|
||||||
o.scriptupdatedb = 1;
|
o.scriptupdatedb = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "script-help") == 0) {
|
} else if (optcmp(long_options[option_index].name, "script-help") == 0) {
|
||||||
o.scripthelp = true;
|
o.scripthelp = true;
|
||||||
o.chooseScripts(optarg);
|
o.chooseScripts(optarg);
|
||||||
@@ -796,7 +796,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
} else if (strcmp(long_options[option_index].name, "open") == 0) {
|
} else if (strcmp(long_options[option_index].name, "open") == 0) {
|
||||||
o.setOpenOnly(true);
|
o.setOpenOnly(true);
|
||||||
// If they only want open, don't spend extra time (potentially) distinguishing closed from filtered.
|
// If they only want open, don't spend extra time (potentially) distinguishing closed from filtered.
|
||||||
o.defeat_rst_ratelimit = 1;
|
o.defeat_rst_ratelimit = true;
|
||||||
} else if (strcmp(long_options[option_index].name, "scanflags") == 0) {
|
} else if (strcmp(long_options[option_index].name, "scanflags") == 0) {
|
||||||
o.scanflags = parse_scanflags(optarg);
|
o.scanflags = parse_scanflags(optarg);
|
||||||
if (o.scanflags < 0) {
|
if (o.scanflags < 0) {
|
||||||
@@ -805,7 +805,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
} else if (strcmp(long_options[option_index].name, "iflist") == 0) {
|
} else if (strcmp(long_options[option_index].name, "iflist") == 0) {
|
||||||
delayed_options.iflist = true;
|
delayed_options.iflist = true;
|
||||||
} else if (strcmp(long_options[option_index].name, "nogcc") == 0) {
|
} else if (strcmp(long_options[option_index].name, "nogcc") == 0) {
|
||||||
o.nogcc = 1;
|
o.nogcc = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "release-memory") == 0) {
|
} else if (optcmp(long_options[option_index].name, "release-memory") == 0) {
|
||||||
o.release_memory = true;
|
o.release_memory = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "min-parallelism") == 0) {
|
} else if (optcmp(long_options[option_index].name, "min-parallelism") == 0) {
|
||||||
@@ -831,11 +831,11 @@ void parse_options(int argc, char **argv) {
|
|||||||
o.datadir = strdup(optarg);
|
o.datadir = strdup(optarg);
|
||||||
} else if (strcmp(long_options[option_index].name, "servicedb") == 0) {
|
} else if (strcmp(long_options[option_index].name, "servicedb") == 0) {
|
||||||
o.requested_data_files["nmap-services"] = optarg;
|
o.requested_data_files["nmap-services"] = optarg;
|
||||||
o.fastscan++;
|
o.fastscan = true;
|
||||||
} else if (strcmp(long_options[option_index].name, "versiondb") == 0) {
|
} else if (strcmp(long_options[option_index].name, "versiondb") == 0) {
|
||||||
o.requested_data_files["nmap-service-probes"] = optarg;
|
o.requested_data_files["nmap-service-probes"] = optarg;
|
||||||
} else if (optcmp(long_options[option_index].name, "append-output") == 0) {
|
} else if (optcmp(long_options[option_index].name, "append-output") == 0) {
|
||||||
o.append_output = 1;
|
o.append_output = true;
|
||||||
} else if (strcmp(long_options[option_index].name, "noninteractive") == 0) {
|
} else if (strcmp(long_options[option_index].name, "noninteractive") == 0) {
|
||||||
o.noninteractive = true;
|
o.noninteractive = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "spoof-mac") == 0) {
|
} else if (optcmp(long_options[option_index].name, "spoof-mac") == 0) {
|
||||||
@@ -843,7 +843,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
files set up, --datadir, etc. */
|
files set up, --datadir, etc. */
|
||||||
delayed_options.spoofmac = optarg;
|
delayed_options.spoofmac = optarg;
|
||||||
} else if (strcmp(long_options[option_index].name, "allports") == 0) {
|
} else if (strcmp(long_options[option_index].name, "allports") == 0) {
|
||||||
o.override_excludeports = 1;
|
o.override_excludeports = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "version-intensity") == 0) {
|
} else if (optcmp(long_options[option_index].name, "version-intensity") == 0) {
|
||||||
o.version_intensity = atoi(optarg);
|
o.version_intensity = atoi(optarg);
|
||||||
if (o.version_intensity < 0 || o.version_intensity > 9)
|
if (o.version_intensity < 0 || o.version_intensity > 9)
|
||||||
@@ -860,9 +860,9 @@ void parse_options(int argc, char **argv) {
|
|||||||
fatal("Since April 2010, the default unit for --scan-delay is seconds, so your time of \"%s\" is %.1f minutes. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0 / 60, optarg, l / 1000.0);
|
fatal("Since April 2010, the default unit for --scan-delay is seconds, so your time of \"%s\" is %.1f minutes. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0 / 60, optarg, l / 1000.0);
|
||||||
delayed_options.pre_scan_delay = l;
|
delayed_options.pre_scan_delay = l;
|
||||||
} else if (optcmp(long_options[option_index].name, "defeat-rst-ratelimit") == 0) {
|
} else if (optcmp(long_options[option_index].name, "defeat-rst-ratelimit") == 0) {
|
||||||
o.defeat_rst_ratelimit = 1;
|
o.defeat_rst_ratelimit = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "defeat-icmp-ratelimit") == 0) {
|
} else if (optcmp(long_options[option_index].name, "defeat-icmp-ratelimit") == 0) {
|
||||||
o.defeat_icmp_ratelimit = 1;
|
o.defeat_icmp_ratelimit = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "max-scan-delay") == 0) {
|
} else if (optcmp(long_options[option_index].name, "max-scan-delay") == 0) {
|
||||||
l = tval2msecs(optarg);
|
l = tval2msecs(optarg);
|
||||||
if (l < 0)
|
if (l < 0)
|
||||||
@@ -876,7 +876,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
fatal("max-retries must be positive");
|
fatal("max-retries must be positive");
|
||||||
} else if (optcmp(long_options[option_index].name, "randomize-hosts") == 0
|
} else if (optcmp(long_options[option_index].name, "randomize-hosts") == 0
|
||||||
|| strcmp(long_options[option_index].name, "rH") == 0) {
|
|| strcmp(long_options[option_index].name, "rH") == 0) {
|
||||||
o.randomize_hosts = 1;
|
o.randomize_hosts = true;
|
||||||
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) {
|
} else if (optcmp(long_options[option_index].name, "nsock-engine") == 0) {
|
||||||
if (nsock_set_default_engine(optarg) < 0)
|
if (nsock_set_default_engine(optarg) < 0)
|
||||||
@@ -885,14 +885,14 @@ void parse_options(int argc, char **argv) {
|
|||||||
if (nsock_proxychain_new(optarg, &o.proxy_chain, NULL) < 0)
|
if (nsock_proxychain_new(optarg, &o.proxy_chain, NULL) < 0)
|
||||||
fatal("Invalid proxy chain specification");
|
fatal("Invalid proxy chain specification");
|
||||||
} 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 = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "osscan-guess") == 0
|
} else if (optcmp(long_options[option_index].name, "osscan-guess") == 0
|
||||||
|| strcmp(long_options[option_index].name, "fuzzy") == 0) {
|
|| strcmp(long_options[option_index].name, "fuzzy") == 0) {
|
||||||
o.osscan_guess = 1;
|
o.osscan_guess = true;
|
||||||
} else if (optcmp(long_options[option_index].name, "packet-trace") == 0) {
|
} else if (optcmp(long_options[option_index].name, "packet-trace") == 0) {
|
||||||
o.setPacketTrace(true);
|
o.setPacketTrace(true);
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
o.scripttrace = 1;
|
o.scripttrace = true;
|
||||||
#endif
|
#endif
|
||||||
} else if (optcmp(long_options[option_index].name, "version-trace") == 0) {
|
} else if (optcmp(long_options[option_index].name, "version-trace") == 0) {
|
||||||
o.setVersionTrace(true);
|
o.setVersionTrace(true);
|
||||||
@@ -982,7 +982,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
log_write(LOG_STDOUT, "!!Greets to Van Hauser, Plasmoid, Skyper and the rest of THC!!\n");
|
log_write(LOG_STDOUT, "!!Greets to Van Hauser, Plasmoid, Skyper and the rest of THC!!\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (strcmp(long_options[option_index].name, "badsum") == 0) {
|
} else if (strcmp(long_options[option_index].name, "badsum") == 0) {
|
||||||
o.badsum = 1;
|
o.badsum = true;
|
||||||
} else if (strcmp(long_options[option_index].name, "iL") == 0) {
|
} else if (strcmp(long_options[option_index].name, "iL") == 0) {
|
||||||
if (o.inputfd) {
|
if (o.inputfd) {
|
||||||
fatal("Only one input filename allowed");
|
fatal("Only one input filename allowed");
|
||||||
@@ -996,7 +996,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strcmp(long_options[option_index].name, "iR") == 0) {
|
} else if (strcmp(long_options[option_index].name, "iR") == 0) {
|
||||||
o.generate_random_ips = 1;
|
o.generate_random_ips = true;
|
||||||
o.max_ips_to_scan = strtoul(optarg, &endptr, 10);
|
o.max_ips_to_scan = strtoul(optarg, &endptr, 10);
|
||||||
if (*endptr != '\0') {
|
if (*endptr != '\0') {
|
||||||
fatal("ERROR: -iR argument must be the maximum number of random IPs you wish to scan (use 0 for unlimited)");
|
fatal("ERROR: -iR argument must be the maximum number of random IPs you wish to scan (use 0 for unlimited)");
|
||||||
@@ -1121,7 +1121,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
Strncpy(o.device, optarg, sizeof(o.device));
|
Strncpy(o.device, optarg, sizeof(o.device));
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
o.fastscan++;
|
o.fastscan = true;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
o.fragscan += 8;
|
o.fragscan += 8;
|
||||||
@@ -1171,11 +1171,11 @@ void parse_options(int argc, char **argv) {
|
|||||||
delayed_options.machinefilename = logfilename(optarg, local_time);
|
delayed_options.machinefilename = logfilename(optarg, local_time);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
o.noresolve++;
|
o.noresolve = true;
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
if (!optarg || *optarg == '2')
|
if (!optarg || *optarg == '2')
|
||||||
o.osscan++;
|
o.osscan = true;
|
||||||
else if (*optarg == '1')
|
else if (*optarg == '1')
|
||||||
fatal("First-generation OS detection (-O1) is no longer supported. Use -O instead.");
|
fatal("First-generation OS detection (-O1) is no longer supported. Use -O instead.");
|
||||||
else
|
else
|
||||||
@@ -1290,13 +1290,13 @@ void parse_options(int argc, char **argv) {
|
|||||||
o.always_resolve = true;
|
o.always_resolve = true;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
o.randomize_ports = 0;
|
o.randomize_ports = false;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
if (o.spoofsource)
|
if (o.spoofsource)
|
||||||
fatal("You can only use the source option once! Use -D <decoy1> -D <decoy2> etc. for decoys\n");
|
fatal("You can only use the source option once! Use -D <decoy1> -D <decoy2> etc. for decoys\n");
|
||||||
delayed_options.spoofSource = strdup(optarg);
|
delayed_options.spoofSource = strdup(optarg);
|
||||||
o.spoofsource = 1;
|
o.spoofsource = true;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (!*optarg) {
|
if (!*optarg) {
|
||||||
@@ -1310,25 +1310,25 @@ void parse_options(int argc, char **argv) {
|
|||||||
case 'P':
|
case 'P':
|
||||||
delayed_options.warn_deprecated("sP", "sn");
|
delayed_options.warn_deprecated("sP", "sn");
|
||||||
case 'n':
|
case 'n':
|
||||||
o.noportscan = 1;
|
o.noportscan = true;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
o.ackscan = 1;
|
o.ackscan = true;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
fatal("No scan type 'B', did you mean bounce scan (-b)?");
|
fatal("No scan type 'B', did you mean bounce scan (-b)?");
|
||||||
break;
|
break;
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
case 'C':
|
case 'C':
|
||||||
o.script = 1;
|
o.script = true;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'F':
|
case 'F':
|
||||||
o.finscan = 1;
|
o.finscan = 1;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
o.listscan = 1;
|
o.listscan = true;
|
||||||
o.noportscan = 1;
|
o.noportscan = true;
|
||||||
o.pingtype |= PINGTYPE_NONE;
|
o.pingtype |= PINGTYPE_NONE;
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
@@ -1342,7 +1342,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
/* Alias for -sV since March 2011. */
|
/* Alias for -sV since March 2011. */
|
||||||
case 'R':
|
case 'R':
|
||||||
o.servicescan = 1;
|
o.servicescan = true;
|
||||||
delayed_options.warn_deprecated("sR", "sV");
|
delayed_options.warn_deprecated("sR", "sV");
|
||||||
error("WARNING: -sR is now an alias for -sV and activates version detection as well as RPC scan.");
|
error("WARNING: -sR is now an alias for -sV and activates version detection as well as RPC scan.");
|
||||||
break;
|
break;
|
||||||
@@ -1356,7 +1356,7 @@ void parse_options(int argc, char **argv) {
|
|||||||
o.udpscan++;
|
o.udpscan++;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
o.servicescan = 1;
|
o.servicescan = true;
|
||||||
break;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
o.windowscan = 1;
|
o.windowscan = 1;
|
||||||
@@ -1469,10 +1469,10 @@ void apply_delayed_options() {
|
|||||||
if (delayed_options.advanced) {
|
if (delayed_options.advanced) {
|
||||||
o.servicescan = true;
|
o.servicescan = true;
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
o.script = 1;
|
o.script = true;
|
||||||
#endif
|
#endif
|
||||||
if (o.isr00t) {
|
if (o.isr00t) {
|
||||||
o.osscan++;
|
o.osscan = true;
|
||||||
o.traceroute = true;
|
o.traceroute = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2033,7 +2033,7 @@ int nmap_main(int argc, char *argv[]) {
|
|||||||
o.max_ips_to_scan = o.numhosts_scanned; // disable warnings?
|
o.max_ips_to_scan = o.numhosts_scanned; // disable warnings?
|
||||||
}
|
}
|
||||||
if (o.servicescan)
|
if (o.servicescan)
|
||||||
o.scriptversion = 1;
|
o.scriptversion = true;
|
||||||
if (o.scriptversion || o.script || o.scriptupdatedb)
|
if (o.scriptversion || o.script || o.scriptupdatedb)
|
||||||
open_nse();
|
open_nse();
|
||||||
|
|
||||||
|
|||||||
@@ -378,9 +378,9 @@ static void open_cnse (lua_State *L)
|
|||||||
|
|
||||||
luaL_newlib(L, nse);
|
luaL_newlib(L, nse);
|
||||||
/* Add some other fields */
|
/* Add some other fields */
|
||||||
nseU_setbfield(L, -1, "default", o.script == 1);
|
nseU_setbfield(L, -1, "default", o.script);
|
||||||
nseU_setbfield(L, -1, "scriptversion", o.scriptversion == 1);
|
nseU_setbfield(L, -1, "scriptversion", o.scriptversion);
|
||||||
nseU_setbfield(L, -1, "scriptupdatedb", o.scriptupdatedb == 1);
|
nseU_setbfield(L, -1, "scriptupdatedb", o.scriptupdatedb);
|
||||||
nseU_setbfield(L, -1, "scripthelp", o.scripthelp);
|
nseU_setbfield(L, -1, "scripthelp", o.scripthelp);
|
||||||
nseU_setsfield(L, -1, "script_dbpath", SCRIPT_ENGINE_DATABASE);
|
nseU_setsfield(L, -1, "script_dbpath", SCRIPT_ENGINE_DATABASE);
|
||||||
nseU_setsfield(L, -1, "scriptargs", o.scriptargs);
|
nseU_setsfield(L, -1, "scriptargs", o.scriptargs);
|
||||||
|
|||||||
@@ -1112,9 +1112,9 @@ void log_flush_all() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Open a log descriptor of the type given to the filename given. If
|
/* Open a log descriptor of the type given to the filename given. If
|
||||||
append is nonzero, the file will be appended instead of clobbered if
|
append is true, the file will be appended instead of clobbered if
|
||||||
it already exists. If the file does not exist, it will be created */
|
it already exists. If the file does not exist, it will be created */
|
||||||
int log_open(int logt, int append, char *filename) {
|
int log_open(int logt, bool append, char *filename) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (logt <= 0 || logt > LOG_FILE_MASK)
|
if (logt <= 0 || logt > LOG_FILE_MASK)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -2534,7 +2534,7 @@ void printfinaloutput() {
|
|||||||
|
|
||||||
if (o.numhosts_scanned == 0
|
if (o.numhosts_scanned == 0
|
||||||
#ifndef NOLUA
|
#ifndef NOLUA
|
||||||
&& o.scriptupdatedb == 0
|
&& !o.scriptupdatedb
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
error("WARNING: No targets were specified, so 0 hosts scanned.");
|
error("WARNING: No targets were specified, so 0 hosts scanned.");
|
||||||
|
|||||||
2
output.h
2
output.h
@@ -228,7 +228,7 @@ void log_flush_all();
|
|||||||
/* Open a log descriptor of the type given to the filename given. If
|
/* Open a log descriptor of the type given to the filename given. If
|
||||||
append is nonzero, the file will be appended instead of clobbered if
|
append is nonzero, the file will be appended instead of clobbered if
|
||||||
it already exists. If the file does not exist, it will be created */
|
it already exists. If the file does not exist, it will be created */
|
||||||
int log_open(int logt, int append, char *filename);
|
int log_open(int logt, bool append, char *filename);
|
||||||
|
|
||||||
/* Output the list of ports scanned to the top of machine parseable
|
/* Output the list of ports scanned to the top of machine parseable
|
||||||
logs (in a comment, unfortunately). The items in ports should be
|
logs (in a comment, unfortunately). The items in ports should be
|
||||||
|
|||||||
Reference in New Issue
Block a user