mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 21:21:31 +00:00
Allow negative matching in Zenmap filters
nmap-dev thread: http://seclists.org/nmap-dev/2012/q3/788 Host filter and others can now take things like "os:!linux" to match hosts without Linux OS.
This commit is contained in:
@@ -200,7 +200,11 @@ class SearchResult(object):
|
||||
"""A helper function that calls the matching function for the given
|
||||
operator and each of its arguments."""
|
||||
for arg in args:
|
||||
if not self.__getattribute__("match_%s" % operator)(arg):
|
||||
positive = True
|
||||
if arg != "" and arg[0] == "!":
|
||||
arg = arg[1:]
|
||||
positive = False
|
||||
if positive != self.__getattribute__("match_%s" % operator)(arg):
|
||||
# No match for this operator
|
||||
return False
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user