def __init__(self, inventory, scans_store): gtk.HPaned.__init__(self) self.scan_host_view = ScanHostsView() self.scan_result_notebook = ScanResultNotebook(inventory, scans_store) self.pack1(self.scan_host_view, True, True) self.pack2(self.scan_result_notebook, True, False)
def __init__(self, inventory, scans_store, scan_interface=None): gtk.HPaned.__init__(self) self.scan_host_view = ScanHostsView(scan_interface) self.scan_result_notebook = ScanResultNotebook(inventory, scans_store) self.filter_toggle_button = gtk.ToggleButton(_("Filter Hosts")) vbox = gtk.VBox() vbox.pack_start(self.scan_host_view, True, True) vbox.pack_start(self.filter_toggle_button, False) self.pack1(vbox) self.pack2(self.scan_result_notebook, True, False)
class ScanResult(gtk.HPaned): """ ScanResult Controls showing the results of a scan. Includes controls to change/clear output text, clear the hosts/services, return the selected host/services, obtain and display the nmap output, let the services and hosts lists be selected, and refresh output. """ def __init__(self, inventory, scans_store): gtk.HPaned.__init__(self) self.scan_host_view = ScanHostsView() self.scan_result_notebook = ScanResultNotebook(inventory, scans_store) self.pack1(self.scan_host_view, True, True) self.pack2(self.scan_result_notebook, True, False) def set_nmap_output(self, msg): self.scan_result_notebook.nmap_output.nmap_output.text_view.get_buffer( ).set_text(msg) def clear_nmap_output(self): self.scan_result_notebook.nmap_output.nmap_output.text_view.get_buffer( ).set_text("") def clear_host_view(self): self.set_hosts({}) def clear_service_view(self): self.set_services({}) def get_host_selection(self): return self.scan_host_view.host_view.get_selection() def get_service_selection(self): return self.scan_host_view.service_view.get_selection() def get_nmap_output(self): return self.scan_result_notebook.nmap_output.get_nmap_output() def set_hosts(self, hosts_dic): """Set hosts to those in host list""" self.scan_host_view.set_hosts(hosts_dic) def set_services(self, services_dic): """Set services to those in services list""" self.scan_host_view.set_services(services_dic) def clear_port_list(self): """Clear the scan result ports list""" self.scan_result_notebook.open_ports.host.clear_port_list() def change_to_ports_hosts_tab(self): """Show the "Ports / Hosts" tab""" self.scan_result_notebook.set_current_page(1) def change_to_nmap_output_tab(self): """Show the nmap output tab""" self.scan_result_notebook.set_current_page(0) def refresh_nmap_output(self): """Refresh the Nmap output with the newest output of command_execution, if it is not None.""" self.scan_result_notebook.nmap_output.nmap_output.refresh_output()