diff --git a/zenmap/zenmapCore/NetworkInventory.py b/zenmap/zenmapCore/NetworkInventory.py index dc28662..4fc0be6 100644 --- a/zenmap/zenmapCore/NetworkInventory.py +++ b/zenmap/zenmapCore/NetworkInventory.py @@ -445,7 +445,11 @@ class FilteredNetworkInventory(NetworkInventory): """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)(host, arg): + positive = True + if arg != "" and arg[0] == "!": + arg = arg[1:] + positive = False + if positive != self.__getattribute__("match_%s" % operator)(host, arg): # No match for this operator return False else: diff --git a/zenmap/zenmapCore/SearchResult.py b/zenmap/zenmapCore/SearchResult.py index 75c023f..640de29 100644 --- a/zenmap/zenmapCore/SearchResult.py +++ b/zenmap/zenmapCore/SearchResult.py @@ -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: