mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
Fixed broken --exclude in nmap.
--exclude 1.2.3.4,5.6.7.8 now works.
This commit is contained in:
parent
5f99b2ad9e
commit
dc4e67dffc
1 changed files with 15 additions and 3 deletions
18
targets.cc
18
targets.cc
|
|
@ -186,9 +186,21 @@ int load_exclude_file(addrset *excludelist, FILE *fp) {
|
|||
/* Load a comma-separated exclude list from a string, the argument to
|
||||
--exclude. */
|
||||
int load_exclude_string(addrset *excludelist, const char *s) {
|
||||
if (!addrset_add_spec(excludelist, s, o.af(), 1)){
|
||||
fatal("Invalid address specification: %s", s);
|
||||
}
|
||||
const char *begin, *p;
|
||||
|
||||
p = s;
|
||||
while (*p != '\0') {
|
||||
begin = p;
|
||||
while (*p != '\0' && *p != ',')
|
||||
p++;
|
||||
const char * addr = std::string(begin, p - begin).c_str();
|
||||
if (!addrset_add_spec(excludelist,addr, o.af(), 1)){
|
||||
fatal("Invalid address specification: %s", addr);
|
||||
}
|
||||
if (*p == '\0')
|
||||
break;
|
||||
p++;
|
||||
};
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue