Пример #1
0
    def __init__(self, host):
        HIGVBox.__init__(self)

        self.__create_widgets()

        self.set_os_image(get_os_logo(host))

        self.set_vulnerability_image(get_vulnerability_logo(host.get_open_ports()))

        self.set_host_status(
            {
                "state": host.get_state(),
                "open": str(host.get_open_ports()),
                "filtered": str(host.get_filtered_ports()),
                "closed": str(host.get_closed_ports()),
                "scanned": str(host.get_scanned_ports()),
                "uptime": host.get_uptime()["seconds"],
                "lastboot": host.get_uptime()["lastboot"],
            }
        )

        addresses = {}
        if host.ip is not None:
            addresses["ipv4"] = host.ip["addr"]
        if host.ipv6 is not None:
            addresses["ipv6"] = host.ipv6["addr"]
        if host.mac is not None:
            addresses["mac"] = host.mac["addr"]
        self.set_addresses(addresses)

        self.set_hostnames(host.get_hostnames())

        os = host.get_best_osmatch()
        if os:
            os["portsused"] = host.get_ports_used()

        self.set_os(os)
        self.set_tcpseq(host.get_tcpsequence())
        self.set_ipseq(host.get_ipidsequence())
        self.set_tcptsseq(host.get_tcptssequence())
        self.set_comment(host.comment)
Пример #2
0
    def __init__(self, host):
        HIGVBox.__init__(self)

        self.__create_widgets()

        self.set_os_image(get_os_logo(host))

        self.set_vulnerability_image(
            get_vulnerability_logo(host.get_open_ports()))

        self.set_host_status({
            'state': host.get_state(),
            'open': str(host.get_open_ports()),
            'filtered': str(host.get_filtered_ports()),
            'closed': str(host.get_closed_ports()),
            'scanned': str(host.get_scanned_ports()),
            'uptime': host.get_uptime()['seconds'],
            'lastboot': host.get_uptime()['lastboot']
        })

        addresses = {}
        if host.ip is not None:
            addresses['ipv4'] = host.ip['addr']
        if host.ipv6 is not None:
            addresses['ipv6'] = host.ipv6['addr']
        if host.mac is not None:
            addresses['mac'] = host.mac['addr']
        self.set_addresses(addresses)

        self.set_hostnames(host.get_hostnames())

        os = host.get_best_osmatch()
        if os:
            os['portsused'] = host.get_ports_used()

        self.set_os(os)
        self.set_tcpseq(host.get_tcpsequence())
        self.set_ipseq(host.get_ipidsequence())
        self.set_tcptsseq(host.get_tcptssequence())
        self.set_comment(host.comment)
Пример #3
0
    def __init__(self, host):
        HIGVBox.__init__(self)

        self.__create_widgets()

        self.set_os_image(get_os_logo(host))

        self.set_vulnerability_image(
                get_vulnerability_logo(host.get_open_ports()))

        self.set_host_status({'state': host.get_state(),
            'open': str(host.get_open_ports()),
            'filtered': str(host.get_filtered_ports()),
            'closed': str(host.get_closed_ports()),
            'scanned': str(host.get_scanned_ports()),
            'uptime': host.get_uptime()['seconds'],
            'lastboot': host.get_uptime()['lastboot']})

        addresses = {}
        if host.ip is not None:
            addresses['ipv4'] = host.ip['addr']
        if host.ipv6 is not None:
            addresses['ipv6'] = host.ipv6['addr']
        if host.mac is not None:
            addresses['mac'] = host.mac['addr']
        self.set_addresses(addresses)

        self.set_hostnames(host.get_hostnames())

        os = host.get_best_osmatch()
        if os:
            os['portsused'] = host.get_ports_used()

        self.set_os(os)
        self.set_tcpseq(host.get_tcpsequence())
        self.set_ipseq(host.get_ipidsequence())
        self.set_tcptsseq(host.get_tcptssequence())
        self.set_comment(host.comment)
    def update_ui(self):
        """Update the interface's lists of hosts and ports from a parsed
        scan."""
        self.empty = False

        self.scan_result.scan_host_view.clear_host_list()
        self.scan_result.scan_host_view.clear_service_list()

        self.scan_result.scan_result_notebook.topology.update_radialnet()

        self.hosts = {}
        self.services = {}

        for host in self.inventory.get_hosts():
            hostname = host.get_hostname()
            host_page = self.set_host_details(host)

            for service in host.services:
                name = service["service_name"]
                state = service["port_state"]

                if state not in ["open", "filtered", "open|filtered"]:
                    continue

                if name not in self.services.keys():
                    self.services[name] = {"hosts": []}

                hs = {"host": host, "page": host_page, "hostname": hostname}
                hs.update(service)

                self.services[name]["hosts"].append(hs)

            self.hosts[hostname] = {'host': host, 'page': host_page}

            host_details = self.hosts[hostname]['page'].host_details
            host_info = self.hosts[hostname]['host']

            try:
                host_details.set_os_image(get_os_logo(host))
            except:
                host_details.set_os_image(get_os_logo(''))

            host_details.set_vulnerability_image(get_vulnerability_logo\
                                                 (host_info.get_open_ports()))

            try:
                icon = get_os_icon(host)
            except:
                icon = get_os_icon('')

            self.scan_result.scan_host_view.add_host(
                {hostname: {
                    'stock': icon,
                    'action': None
                }})

        if len(self.scan_result.scan_host_view.host_list) > 0:
            # Select the first host found
            self.host_view_selection.select_iter(
                self.scan_result.scan_host_view.host_list.get_iter_root())

        self.scan_result.scan_host_view.set_services(self.services.keys())