1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-16 04:39:03 +00:00

Make use of -4 with -6 illegal.

This commit is contained in:
dmiller
2016-03-14 23:54:51 +00:00
parent 4135ec518f
commit 3c994776f7
2 changed files with 21 additions and 2 deletions

View File

@@ -1,5 +1,10 @@
# Nmap Changelog ($Id$); -*-text-*-
o Allow the -4 option for Nmap to indicate IPv4 address family. This is the
default, and using the option doesn't change anything, but does make it more
explicit which address family you want to scan. Using -4 with -6 is an error.
[Daniel Miller]
o [NSE] Added rusers script to get logged-on users info from the rusersd RPC
service. [Daniel Miller]
@@ -113,6 +118,9 @@ o [NSE] [GH#226] Added http-vuln-cve2014-3704 for detecting and exploiting the
o [NSE] [GH#242] Fix multiple false-positive sources in http-backup-agent.
[Tom Sellers]
o [Zenmap] [GH#247] Remember window geometry (position and size) from the
previous time Zenmap was run. [isjing]
Nmap 7.01 [2015-12-09]
o Switch to using gtk-mac-bundler and jhbuild for building the OS X installer.

15
nmap.cc
View File

@@ -502,6 +502,7 @@ public:
this->pre_max_retries = -1;
this->pre_host_timeout = -1;
this->iflist = false;
this->af = AF_UNSPEC;
}
// Pre-specified timing parameters.
@@ -517,6 +518,7 @@ public:
char *exclude_spec, *exclude_file;
char *spoofSource;
const char *spoofmac;
int af;
std::vector<std::string> verbose_out;
void warn_deprecated (const char *given, const char *replacement) {
@@ -1033,13 +1035,19 @@ void parse_options(int argc, char **argv) {
case '4':
/* This is basically useless for now, but serves as a placeholder to
* ensure that -4 is a valid option */
o.setaf(AF_INET);
if (delayed_options.af == AF_INET6) {
fatal("Cannot use both -4 and -6 in one scan.");
}
delayed_options.af = AF_INET;
break;
case '6':
#if !HAVE_IPV6
fatal("I am afraid IPv6 is not available because your host doesn't support it or you chose to compile Nmap w/o IPv6 support.");
#else
o.setaf(AF_INET6);
if (delayed_options.af == AF_INET) {
fatal("Cannot use both -4 and -6 in one scan.");
}
delayed_options.af = AF_INET6;
#endif /* !HAVE_IPV6 */
break;
case 'A':
@@ -1453,6 +1461,9 @@ void apply_delayed_options() {
struct sockaddr_storage ss;
size_t sslen;
// Default IPv4
o.setaf(delayed_options.af == AF_UNSPEC ? AF_INET : delayed_options.af);
if (o.verbose > 0) {
for (std::vector<std::string>::iterator it = delayed_options.verbose_out.begin(); it != delayed_options.verbose_out.end(); ++it) {
error("%s", it->c_str());