Nmap Development mailing list archives
Re: Feature request
From: Daniel Miller <bonsaiviking () gmail com>
Date: Wed, 12 Sep 2012 13:24:26 -0500
On 09/10/2012 05:29 PM, David Fifield wrote:
The patch attached here should make this work for every type of matching supported in the host filter (NetworkInventory class) as well as some other interface I couldn't find to test. It ended up being a bit larger than I thought, so I'm submitting here to let others take a look and test before I commit.On Mon, Sep 10, 2012 at 05:26:35PM -0500, Daniel Miller wrote:On 09/10/2012 09:15 AM, Terry Freestone wrote:Hi. I love the product, but I would like to request a feature. When using the host filter in the Zenmap GUI, would it be possible to add a host "not equal to" option? In the filter host field, just give the ability to put != in front of the filter term. Example: os:!=linuxCould you re-send this message to the mailing list, so that others can see it any perhaps discuss it? David FifieldTerry _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/Terry, Does this patch do what you like? diff --git a/zenmap/zenmapCore/SearchResult.py b/zenmap/zenmapCore/SearchResult.py index 75c023f..c679489 100644 --- a/zenmap/zenmapCore/SearchResult.py +++ b/zenmap/zenmapCore/SearchResult.py @@ -146,6 +146,10 @@ class HostSearch(object): @staticmethod def match_os(host, os): os = os.lower() + found = True + if os[0] == "!": + os = os[1:] + found = False os_str = "" osmatches = host.get_osmatches() @@ -158,8 +162,8 @@ class HostSearch(object): osclass['type'].lower() if os in os_str: - return True - return False + return found + return not found @staticmethod def match_port(host_ports, port, port_state): # Check if the port is parsable, if not return False silently The syntax would be "os:!windows" to match non-windows hosts, for example. (There is no problem using exclamation points, since this is not related to command shell use).I think it would be better if this applied to all possible matches, not just os:. David Fifield
Basic idea is that for any directive, including bare keywords, you can put an exclamation point ("!") in front of the search term to negate it. So "op:!22" matches hosts that do not have port 22 open.
Dan
Attachment:
zeneg.patch
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- RE: Feature request, (continued)
- RE: Feature request Terry Freestone (Sep 10)
- Re: Feature request Luis MartinGarcia. (Sep 10)
- Re: Feature request David Fifield (Sep 10)
- RE: Feature request Terry Freestone (Sep 10)
- RE: Feature request Terry Freestone (Sep 10)
- Re: Feature request ^..^ (Sep 10)
- RE: Feature request Terry Freestone (Sep 10)
- Re: Feature request David Fifield (Sep 10)
- Re: Feature request Daniel Miller (Sep 11)
- Re: Feature request Daniel Miller (Sep 12)
- Re: Feature request David Fifield (Sep 12)
- Re: Feature request Daniel Miller (Sep 12)
- Re: Feature request David Fifield (Sep 12)
- Re: Feature request Daniel Miller (Sep 13)