diff --git a/NmapOps.cc b/NmapOps.cc index aa9bfa660..369fbdbe0 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -338,6 +338,7 @@ void NmapOps::Initialize() { proxy_chain = NULL; resuming = false; discovery_ignore_rst = false; + force_sqlping = false; } bool NmapOps::SCTPScan() { diff --git a/NmapOps.h b/NmapOps.h index 283612bb9..fcd9050fa 100644 --- a/NmapOps.h +++ b/NmapOps.h @@ -311,6 +311,7 @@ class NmapOps { nsock_proxychain proxy_chain; bool discovery_ignore_rst; /* host discovery should not consider TCP RST packet responses as a live asset */ + bool force_sqlping; #ifndef NOLUA bool script; diff --git a/docs/nmap.1 b/docs/nmap.1 index 6159c9da0..9eb0015e6 100644 --- a/docs/nmap.1 +++ b/docs/nmap.1 @@ -1160,6 +1160,11 @@ An alias for This causes Nmap to print out extensive debugging info about what version scanning is doing\&. It is a subset of what you get with \fB\-\-packet\-trace\fR\&. .RE +.PP +\fB\-\-force\-sqlping\fR +.RS 4 +This option overrides the default \fBno-payload\fR behavior of the \fBSqlping\fR UDP probe. It ensures the probe is sent during UDP scans (\fB-sU\fR) and version scans (\fB-sV\fR). This can be used to help change a UDP port's state from \fIopen|filtered\fR to \fIopen\fR by eliciting a response, and it ensures the specific MS-SQL server check is performed during a version scan. +.RE .SH "OS DETECTION" .PP One of Nmap\*(Aqs best\-known features is remote OS detection using TCP/IP stack fingerprinting\&. Nmap sends a series of TCP and UDP packets to the remote host and examines practically every bit in the responses\&. After performing dozens of tests such as TCP ISN sampling, TCP options support and ordering, IP ID sampling, and the initial window size check, Nmap compares the results to its diff --git a/nmap.cc b/nmap.cc index 205b07b75..14265fdb4 100644 --- a/nmap.cc +++ b/nmap.cc @@ -568,6 +568,7 @@ void parse_options(int argc, char **argv) { {"proxies", required_argument, 0, 0}, {"proxy", required_argument, 0, 0}, {"discovery-ignore-rst", no_argument, 0, 0}, + {"force-sqlping", no_argument, 0, 0}, {"osscan-limit", no_argument, 0, 0}, /* skip OSScan if no open ports */ {"osscan-guess", no_argument, 0, 0}, /* More guessing flexibility */ {"fuzzy", no_argument, 0, 0}, /* Alias for osscan_guess */ @@ -811,6 +812,8 @@ void parse_options(int argc, char **argv) { fatal("Invalid proxy chain specification"); } else if (strcmp(long_options[option_index].name, "discovery-ignore-rst") == 0) { o.discovery_ignore_rst = true; + } else if (strcmp(long_options[option_index].name, "force-sqlping") == 0) { + o.force_sqlping = true; } else if (strcmp(long_options[option_index].name, "osscan-limit") == 0) { o.osscan_limit = true; } else if (strcmp(long_options[option_index].name, "osscan-guess") == 0 diff --git a/service_scan.cc b/service_scan.cc index 2839833d5..57239e361 100644 --- a/service_scan.cc +++ b/service_scan.cc @@ -1165,6 +1165,13 @@ void ServiceProbe::setProbeDetails(char *pd, int lineno) { } while (*pd && !isspace((int) (unsigned char) *pd)) pd++; } + + if (probename && strcmp(probename, "Sqlping") == 0) { + if (o.force_sqlping) { + log_write(LOG_STDOUT, "User-forced Sqlping: overriding no-payload directive.\n"); + notForPayload = false; + } + } } void ServiceProbe::setProbeString(const u8 *ps, int stringlen) {