def __init__(self, scans_store): HIGVBox.__init__(self) # This is a cache of details windows we have open. self._details_windows = {} self.set_spacing(0) hbox = HIGHBox() self.scans_list = gtk.ComboBox(scans_store) cell = gtk.CellRendererText() self.scans_list.pack_start(cell, True) self.scans_list.set_cell_data_func(cell, scan_entry_data_func) hbox._pack_expand_fill(self.scans_list) self.scans_list.connect("changed", self._selection_changed) scans_store.connect("row-changed", self._row_changed) scans_store.connect("row-deleted", self._row_deleted) self.throbber = Throbber() hbox._pack_noexpand_nofill(self.throbber) self.details_button = gtk.Button(_("Details")) self.details_button.connect("clicked", self._show_details) hbox._pack_noexpand_nofill(self.details_button) self._pack_noexpand_nofill(hbox) self.nmap_output = NmapOutputViewer() self._pack_expand_fill(self.nmap_output) self._update()
def __init__(self): HIGVBox.__init__(self) self._create_widgets() self._set_port_list() self._set_host_list() self._pack_widgets()
def __init__(self): HIGVBox.__init__(self) # The borders are consuming too much space on Maemo. Setting it to # 0 pixels while on Maemo if is_maemo(): self.set_border_width(0) self.set_spacing(0) # True if nothing has happened here page yet, i.e., it's okay to load a # scan from a file here. self.empty = True # The most recent name the inventory on this page has been saved under. self.saved_filename = None # The network inventory shown by this page. It may consist of multiple # scans. self.inventory = NetworkInventory() # The list of currently running scans (NmapCommand objects). self.jobs = [] # The list of running and finished scans shown on the Nmap Output page. self.scans_store = ScansListStore() self.top_box = HIGVBox() self.__create_toolbar() self.__create_command_toolbar() self.select_default_profile() self.scan_result = ScanResult(self.inventory, self.scans_store) self.host_view_selection = self.scan_result.get_host_selection() self.service_view_selection = self.scan_result.get_service_selection() self.host_view_selection.connect('changed', self.update_host_info) self.service_view_selection.connect('changed', self.update_service_info) self.scan_result.scan_result_notebook.scans_list.remove_button.connect( "clicked", self._remove_scan_cb) self.hosts = {} self.services = {} self.top_box.set_border_width(6) self.top_box.set_spacing(5) self.top_box._pack_noexpand_nofill(self.toolbar) self.top_box._pack_noexpand_nofill(self.command_toolbar) self._pack_noexpand_nofill(self.top_box) self._pack_expand_fill(self.scan_result) self.scan_result.scan_result_notebook.scans_list.cancel_button.connect( "clicked", self._cancel_scan_cb)
def __init__(self, colors): HIGVBox.__init__(self) self.colors = colors self.set_border_width(5) self.set_spacing(6) self._create_widgets() self._set_diff_view() self._pack_widgets()
def __init__(self, inventory): HIGVBox.__init__(self) self.set_border_width(6) self.set_spacing(4) self.network_inventory = inventory self._create_widgets() self._pack_widgets()
def __init__ (self, colors, check_color): HIGVBox.__init__(self) self.set_border_width(5) self.set_spacing(6) self.colors = colors self.check_color = check_color self._create_widgets() self._pack_hbox() self._set_text_view() self._set_scrolled() self._pack_noexpand_nofill(self.lbl_diff) self._pack_expand_fill(self.hbox)
def __init__(self, scans_store): HIGVBox.__init__(self) self.set_spacing(4) scans_store.connect("row-changed", self._row_changed) self.scans_list = gtk.TreeView(scans_store) self.scans_list.get_selection().connect( "changed", self._selection_changed) status_col = gtk.TreeViewColumn(_("Status")) cell = gtk.CellRendererText() status_col.pack_start(cell) status_col.set_cell_data_func(cell, status_data_func) self.scans_list.append_column(status_col) command_col = gtk.TreeViewColumn(_("Command")) cell = gtk.CellRendererText() command_col.pack_start(cell) command_col.set_cell_data_func(cell, command_data_func) self.scans_list.append_column(command_col) scrolled_window = HIGScrolledWindow() scrolled_window.set_border_width(0) scrolled_window.add(self.scans_list) self.pack_start(scrolled_window, True, True) hbox = HIGHBox() buttonbox = gtk.HButtonBox() buttonbox.set_layout(gtk.BUTTONBOX_START) buttonbox.set_spacing(4) self.append_button = HIGButton(_("Append Scan"), gtk.STOCK_ADD) buttonbox.pack_start(self.append_button, False) self.remove_button = HIGButton(_("Remove Scan"), gtk.STOCK_REMOVE) buttonbox.pack_start(self.remove_button, False) self.cancel_button = HIGButton(_("Cancel Scan"), gtk.STOCK_CANCEL) buttonbox.pack_start(self.cancel_button, False) hbox.pack_start(buttonbox, padding=4) self.pack_start(hbox, False, padding=4) self._update()
def __init__(self, scans_store): HIGVBox.__init__(self) self.set_spacing(4) scans_store.connect("row-changed", self._row_changed) self.scans_list = gtk.TreeView(scans_store) self.scans_list.get_selection().connect("changed", self._selection_changed) status_col = gtk.TreeViewColumn(_("Status")) cell = gtk.CellRendererText() status_col.pack_start(cell) status_col.set_cell_data_func(cell, status_data_func) self.scans_list.append_column(status_col) command_col = gtk.TreeViewColumn(_("Command")) cell = gtk.CellRendererText() command_col.pack_start(cell) command_col.set_cell_data_func(cell, command_data_func) self.scans_list.append_column(command_col) scrolled_window = HIGScrolledWindow() scrolled_window.set_border_width(0) scrolled_window.add(self.scans_list) self.pack_start(scrolled_window, True, True) hbox = HIGHBox() buttonbox = gtk.HButtonBox() buttonbox.set_layout(gtk.BUTTONBOX_START) buttonbox.set_spacing(4) self.append_button = HIGButton(_("Append Scan"), gtk.STOCK_ADD) buttonbox.pack_start(self.append_button, False) self.remove_button = HIGButton(_("Remove Scan"), gtk.STOCK_REMOVE) buttonbox.pack_start(self.remove_button, False) self.cancel_button = HIGButton(_("Cancel Scan"), gtk.STOCK_CANCEL) buttonbox.pack_start(self.cancel_button, False) hbox.pack_start(buttonbox, padding=4) self.pack_start(hbox, False, padding=4) self._update()
def __init__(self, hosts={}, services={}): HIGVBox.__init__(self) self._create_widgets() self._connect_widgets() self._pack_widgets() self._set_scrolled() self._set_host_list(hosts) self._set_service_list(services) self._pack_expand_fill(self.main_vbox) # Default mode is host mode self.host_mode(self.host_mode_button) self.host_view.show_all() self.service_view.show_all()
def __init__(self, scan_interface): HIGVBox.__init__(self) self._scan_interface = scan_interface self._create_widgets() self._connect_widgets() self._pack_widgets() self._set_scrolled() self._set_host_list() self._set_service_list() self._pack_expand_fill(self.main_vbox) self.mode = None # Default mode is host mode self.host_mode(self.host_mode_button) self.host_view.show_all() self.service_view.show_all()
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 __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 __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 __init__(self): HIGVBox.__init__(self) # The borders are consuming too much space on Maemo. Setting it to # 0 pixels while on Maemo if is_maemo(): self.set_border_width(0) self.set_spacing(0) # True if nothing has happened here page yet, i.e., it's okay to load a # scan from a file here. self.empty = True # The most recent name the inventory on this page has been saved under. self.saved_filename = None # The network inventory shown by this page. It may consist of multiple # scans. self.inventory = FilteredNetworkInventory() # The list of currently running scans (NmapCommand objects). self.jobs = [] # The list of running and finished scans shown on the Nmap Output page. self.scans_store = ScansListStore() self.top_box = HIGVBox() self.__create_toolbar() self.__create_command_toolbar() self.select_default_profile() self.scan_result = ScanResult(self.inventory, self.scans_store, scan_interface=self) self.host_view_selection = self.scan_result.get_host_selection() self.service_view_selection = self.scan_result.get_service_selection() self.host_view_selection.connect( 'changed', self.host_selection_changed) self.service_view_selection.connect( 'changed', self.service_selection_changed) host_page = self.scan_result.scan_result_notebook.open_ports.host host_page.host_view.get_selection().connect( 'changed', self.service_host_selection_changed) self.host_view_selection.connect( 'changed', self.host_selection_changed) self.scan_result.scan_result_notebook.nmap_output.connect( "changed", self._displayed_scan_change_cb) self.scan_result.scan_result_notebook.scans_list.remove_button.connect( "clicked", self._remove_scan_cb) # The hosts dict maps hostnames (as returned by HostInfo.get_hostname) # to HostInfo objects. self.hosts = {} # The services dict maps service names ("http") to lists of dicts of # the form # {'host': <HostInfo object>, 'hostname': u'example.com', # 'port_state': u'open', 'portid': u'22', 'protocol': u'tcp', # 'service_conf': u'10', 'service_extrainfo': u'protocol 2.0', # 'service_method': u'probed', 'service_name': u'ssh', # 'service_product': u'OpenSSH', 'service_version': u'4.3'} # In other words each dict has the same keys as an entry in # HostInfo.ports, with the addition of "host" and "hostname" keys. self.services = {} self.top_box.set_border_width(6) self.top_box.set_spacing(5) self.top_box._pack_noexpand_nofill(self.toolbar) self.top_box._pack_noexpand_nofill(self.command_toolbar) self._pack_noexpand_nofill(self.top_box) self._pack_expand_fill(self.scan_result) self.scan_result.scan_result_notebook.scans_list.cancel_button.connect( "clicked", self._cancel_scans_list_cb) self.update_cancel_button() # Create the filter GUI self.filter_bar = FilterBar() self.pack_start(self.filter_bar, False, True, 0) self.filter_bar.set_no_show_all(True) self.filter_timeout_id = None self.filter_bar.connect("changed", self.filter_changed) self.scan_result.filter_toggle_button.connect("toggled", self.filter_toggle_toggled) self.scan_result.filter_toggle_button.show()
def __init__(self, scan): HIGVBox.__init__(self) na = _('Not available') # Command info self.command_label = HIGEntryLabel(_('Command:')) self.info_command_label = HIGEntryLabel(na) self.nmap_version_label = HIGEntryLabel(_('Nmap Version:')) self.info_nmap_version_label = HIGEntryLabel(na) self.verbose_label = HIGEntryLabel(_('Verbosity level:')) self.info_verbose_label = HIGEntryLabel(na) self.debug_label = HIGEntryLabel(_('Debug level:')) self.info_debug_label = HIGEntryLabel(na) self.command_expander = gtk.Expander( "<b>" + _("Command Info") + "</b>") self.command_expander.set_use_markup(True) self.command_table = HIGTable() self.command_table.set_border_width(5) self.command_table.set_row_spacings(6) self.command_table.set_col_spacings(6) self.command_hbox = HIGHBox() self.command_hbox._pack_noexpand_nofill(hig_box_space_holder()) self.command_hbox._pack_noexpand_nofill(self.command_table) self.command_table.attach(self.command_label, 0, 1, 0, 1) self.command_table.attach(self.info_command_label, 1, 2, 0, 1) self.command_table.attach(self.nmap_version_label, 0, 1, 1, 2) self.command_table.attach(self.info_nmap_version_label, 1, 2, 1, 2) self.command_table.attach(self.verbose_label, 0, 1, 2, 3) self.command_table.attach(self.info_verbose_label, 1, 2, 2, 3) self.command_table.attach(self.debug_label, 0, 1, 3, 4) self.command_table.attach(self.info_debug_label, 1, 2, 3, 4) self.command_expander.add(self.command_hbox) self._pack_noexpand_nofill(self.command_expander) self.command_expander.set_expanded(True) # General info: self.start_label = HIGEntryLabel(_('Started on:')) self.info_start_label = HIGEntryLabel(na) self.finished_label = HIGEntryLabel(_('Finished on:')) self.info_finished_label = HIGEntryLabel(na) self.host_up_label = HIGEntryLabel(_('Hosts up:')) self.info_hosts_up_label = HIGEntryLabel(na) self.host_down_label = HIGEntryLabel(_('Hosts down:')) self.info_hosts_down_label = HIGEntryLabel(na) self.host_scanned_label = HIGEntryLabel(_('Hosts scanned:')) self.info_hosts_scanned_label = HIGEntryLabel(na) self.open_label = HIGEntryLabel(_('Open ports:')) self.info_open_label = HIGEntryLabel(na) self.filtered_label = HIGEntryLabel(_('Filtered ports:')) self.info_filtered_label = HIGEntryLabel(na) self.closed_label = HIGEntryLabel(_('Closed ports:')) self.info_closed_label = HIGEntryLabel(na) self.general_expander = gtk.Expander( "<b>" + _("General Info") + "</b>") self.general_expander.set_use_markup(True) self.general_table = HIGTable() self.general_table.set_border_width(5) self.general_table.set_row_spacings(6) self.general_table.set_col_spacings(6) self.general_hbox = HIGHBox() self.general_hbox._pack_noexpand_nofill(hig_box_space_holder()) self.general_hbox._pack_noexpand_nofill(self.general_table) self.general_table.attach(self.start_label, 0, 1, 0, 1) self.general_table.attach(self.info_start_label, 1, 2, 0, 1) self.general_table.attach(self.finished_label, 0, 1, 1, 2) self.general_table.attach(self.info_finished_label, 1, 2, 1, 2) self.general_table.attach(self.host_up_label, 0, 1, 2, 3) self.general_table.attach(self.info_hosts_up_label, 1, 2, 2, 3) self.general_table.attach(self.host_down_label, 0, 1, 3, 4) self.general_table.attach(self.info_hosts_down_label, 1, 2, 3, 4) self.general_table.attach(self.host_scanned_label, 0, 1, 4, 5) self.general_table.attach(self.info_hosts_scanned_label, 1, 2, 4, 5) self.general_table.attach(self.open_label, 0, 1, 5, 6) self.general_table.attach(self.info_open_label, 1, 2, 5, 6) self.general_table.attach(self.filtered_label, 0, 1, 6, 7) self.general_table.attach(self.info_filtered_label, 1, 2, 6, 7) self.general_table.attach(self.closed_label, 0, 1, 7, 8) self.general_table.attach(self.info_closed_label, 1, 2, 7, 8) self.general_expander.add(self.general_hbox) self._pack_noexpand_nofill(self.general_expander) self.general_expander.set_expanded(True) self._set_from_scan(scan)
def __init__(self, scan): HIGVBox.__init__(self) na = _('Not available') # Command info self.command_label = HIGEntryLabel(_('Command:')) self.info_command_label = HIGEntryLabel(na) self.nmap_version_label = HIGEntryLabel(_('Nmap Version:')) self.info_nmap_version_label = HIGEntryLabel(na) self.verbose_label = HIGEntryLabel(_('Verbosity level:')) self.info_verbose_label = HIGEntryLabel(na) self.debug_label = HIGEntryLabel(_('Debug level:')) self.info_debug_label = HIGEntryLabel(na) self.command_expander = gtk.Expander("<b>" + _("Command Info") + "</b>") self.command_expander.set_use_markup(True) self.command_table = HIGTable() self.command_table.set_border_width(5) self.command_table.set_row_spacings(6) self.command_table.set_col_spacings(6) self.command_hbox = HIGHBox() self.command_hbox._pack_noexpand_nofill(hig_box_space_holder()) self.command_hbox._pack_noexpand_nofill(self.command_table) self.command_table.attach(self.command_label, 0, 1, 0, 1) self.command_table.attach(self.info_command_label, 1, 2, 0, 1) self.command_table.attach(self.nmap_version_label, 0, 1, 1, 2) self.command_table.attach(self.info_nmap_version_label, 1, 2, 1, 2) self.command_table.attach(self.verbose_label, 0, 1, 2, 3) self.command_table.attach(self.info_verbose_label, 1, 2, 2, 3) self.command_table.attach(self.debug_label, 0, 1, 3, 4) self.command_table.attach(self.info_debug_label, 1, 2, 3, 4) self.command_expander.add(self.command_hbox) self._pack_noexpand_nofill(self.command_expander) self.command_expander.set_expanded(True) # General info: self.start_label = HIGEntryLabel(_('Started on:')) self.info_start_label = HIGEntryLabel(na) self.finished_label = HIGEntryLabel(_('Finished on:')) self.info_finished_label = HIGEntryLabel(na) self.host_up_label = HIGEntryLabel(_('Hosts up:')) self.info_hosts_up_label = HIGEntryLabel(na) self.host_down_label = HIGEntryLabel(_('Hosts down:')) self.info_hosts_down_label = HIGEntryLabel(na) self.host_scanned_label = HIGEntryLabel(_('Hosts scanned:')) self.info_hosts_scanned_label = HIGEntryLabel(na) self.open_label = HIGEntryLabel(_('Open ports:')) self.info_open_label = HIGEntryLabel(na) self.filtered_label = HIGEntryLabel(_('Filtered ports:')) self.info_filtered_label = HIGEntryLabel(na) self.closed_label = HIGEntryLabel(_('Closed ports:')) self.info_closed_label = HIGEntryLabel(na) self.general_expander = gtk.Expander("<b>" + _("General Info") + "</b>") self.general_expander.set_use_markup(True) self.general_table = HIGTable() self.general_table.set_border_width(5) self.general_table.set_row_spacings(6) self.general_table.set_col_spacings(6) self.general_hbox = HIGHBox() self.general_hbox._pack_noexpand_nofill(hig_box_space_holder()) self.general_hbox._pack_noexpand_nofill(self.general_table) self.general_table.attach(self.start_label, 0, 1, 0, 1) self.general_table.attach(self.info_start_label, 1, 2, 0, 1) self.general_table.attach(self.finished_label, 0, 1, 1, 2) self.general_table.attach(self.info_finished_label, 1, 2, 1, 2) self.general_table.attach(self.host_up_label, 0, 1, 2, 3) self.general_table.attach(self.info_hosts_up_label, 1, 2, 2, 3) self.general_table.attach(self.host_down_label, 0, 1, 3, 4) self.general_table.attach(self.info_hosts_down_label, 1, 2, 3, 4) self.general_table.attach(self.host_scanned_label, 0, 1, 4, 5) self.general_table.attach(self.info_hosts_scanned_label, 1, 2, 4, 5) self.general_table.attach(self.open_label, 0, 1, 5, 6) self.general_table.attach(self.info_open_label, 1, 2, 5, 6) self.general_table.attach(self.filtered_label, 0, 1, 6, 7) self.general_table.attach(self.info_filtered_label, 1, 2, 6, 7) self.general_table.attach(self.closed_label, 0, 1, 7, 8) self.general_table.attach(self.info_closed_label, 1, 2, 7, 8) self.general_expander.add(self.general_hbox) self._pack_noexpand_nofill(self.general_expander) self.general_expander.set_expanded(True) self._set_from_scan(scan)