class BugReport(gtk.Window, object): def __init__(self): gtk.Window.__init__(self) self.set_title(_('How to Report a Bug')) self.set_position(gtk.WIN_POS_CENTER_ALWAYS) self._create_widgets() self._pack_widgets() self._connect_widgets() def _create_widgets(self): self.vbox = HIGVBox() self.button_box = gtk.HButtonBox() self.text = gtk.Label() self.btn_ok = gtk.Button(stock=gtk.STOCK_OK) def _pack_widgets(self): self.vbox.set_border_width(6) self.text.set_line_wrap(True) self.text.set_markup(_("""\ <big><b>How to report a bug</b></big> Like their author, %(nmap)s and %(app)s aren't perfect. But you can help \ make it better by sending bug reports or even writing patches. If \ %(nmap)s doesn't behave the way you expect, first upgrade to the latest \ version available from <b>%(nmap_web)s</b>. If the problem persists, do \ some research to determine whether it has already been discovered and \ addressed. Try Googling the error message or browsing the nmap-dev \ archives at http://seclists.org/. Read the full manual page as well. If \ nothing comes of this, mail a bug report to \ <b><[email protected]></b>. Please include everything you have \ learned about the problem, as well as what version of Nmap you are \ running and what operating system version it is running on. Problem \ reports and %(nmap)s usage questions sent to [email protected] are \ far more likely to be answered than those sent to Fyodor directly. Code patches to fix bugs are even better than bug reports. Basic \ instructions for creating patch files with your changes are available at \ http://nmap.org/data/HACKING. Patches may be sent to nmap-dev \ (recommended) or to Fyodor directly. """) % {"app": escape(APP_DISPLAY_NAME), "nmap": escape(NMAP_DISPLAY_NAME), "nmap_web": escape(NMAP_WEB_SITE)}) self.vbox.add(self.text) self.button_box.set_layout(gtk.BUTTONBOX_END) self.button_box.pack_start(self.btn_ok) self.vbox._pack_noexpand_nofill(self.button_box) self.add(self.vbox) def _connect_widgets(self): self.btn_ok.connect("clicked", self.close) self.connect("delete-event", self.close) def close(self, widget=None, event=None): self.destroy()
class ScanResultNotebook(HIGNotebook): """This is the right side of a ScanResult, the notebook with the tabs such as "Nmap Output".""" def __init__(self, inventory, scans_store): HIGNotebook.__init__(self) self.set_border_width(5) self.__create_widgets(inventory, scans_store) self.scans_list.scans_list.connect( "row-activated", self._scan_row_activated) self.append_page(self.nmap_output_page, gtk.Label(_('Nmap Output'))) self.append_page(self.open_ports_page, gtk.Label(_('Ports / Hosts'))) self.append_page(self.topology_page, gtk.Label(_('Topology'))) self.append_page(self.host_details_page, gtk.Label(_('Host Details'))) self.append_page(self.scans_list_page, gtk.Label(_('Scans'))) def host_mode(self): self.open_ports.host.host_mode() def port_mode(self): self.open_ports.host.port_mode() def __create_widgets(self, inventory, scans_store): self.open_ports_page = HIGVBox() self.nmap_output_page = HIGVBox() self.topology_page = HIGVBox() self.host_details_page = HIGScrolledWindow() self.host_details_vbox = HIGVBox() self.scans_list_page = HIGVBox() self.open_ports = ScanOpenPortsPage() self.nmap_output = ScanNmapOutputPage(scans_store) self.topology = TopologyPage(inventory) self.scans_list = ScanScanListPage(scans_store) self.no_selected = gtk.Label(_('No host selected.')) self.host_details = self.no_selected self.open_ports_page.add(self.open_ports) self.nmap_output_page.add(self.nmap_output) self.topology_page.add(self.topology) self.scans_list_page.add(self.scans_list) self.host_details_page.add_with_viewport(self.host_details_vbox) self.host_details_vbox._pack_expand_fill(self.host_details) def _scan_row_activated(self, treeview, path, view_column): """Switch back to the Nmap Output view when a scan is activated (double-clicked) on the scans list.""" self.nmap_output.set_active_iter(treeview.get_model().get_iter(path)) self.set_current_page(0)
class ScanResultNotebook(HIGNotebook): """ ScanResultNotebook Creates a new Scan Results notebook page, which includes the sections Ports/Hosts, Nmap Output, Host Details, and Scan Details. Organizes the way the results for scan is displayed in its new tab. """ def __init__(self, inventory, scans_store): HIGNotebook.__init__(self) self.set_border_width(5) self.__create_widgets(inventory, scans_store) self.__nmap_output_refreshing() self.scans_list.scans_list.connect("row-activated", self._scan_row_activated) self.append_page(self.nmap_output_page, gtk.Label(_('Nmap Output'))) self.append_page(self.open_ports_page, gtk.Label(_('Ports / Hosts'))) self.append_page(self.topology_page, gtk.Label(_('Topology'))) self.append_page(self.host_details_page, gtk.Label(_('Host Details'))) self.append_page(self.scans_list_page, gtk.Label(_('Scans'))) def host_mode(self): self.open_ports.host.host_mode() def port_mode(self): self.open_ports.host.port_mode() def __create_widgets(self, inventory, scans_store): self.open_ports_page = HIGVBox() self.nmap_output_page = HIGVBox() self.topology_page = HIGVBox() self.host_details_page = HIGScrolledWindow() self.host_details_vbox = HIGVBox() self.scans_list_page = HIGVBox() self.open_ports = ScanOpenPortsPage() self.nmap_output = ScanNmapOutputPage(scans_store) self.topology = TopologyPage(inventory) self.scans_list = ScanScanListPage(scans_store) self.no_selected = gtk.Label(_('No host selected.')) self.host_details = self.no_selected self.open_ports_page.add(self.open_ports) self.nmap_output_page.add(self.nmap_output) self.topology_page.add(self.topology) self.scans_list_page.add(self.scans_list) self.host_details_page.add_with_viewport(self.host_details_vbox) self.host_details_vbox._pack_expand_fill(self.host_details) def __nmap_output_refreshing(self): self.connect('switch-page', self.refresh_cb) def _scan_row_activated(self, treeview, path, view_column): """Switch back to the Nmap Output view when a scan is activated (double-clicked) on the scans list.""" self.nmap_output.set_active_iter(treeview.get_model().get_iter(path)) self.set_current_page(0) def refresh_cb(self, widget, page=None, page_num=None): if self.nmap_output.nmap_output.thread.isAlive(): if page_num == 2: self.nmap_output.nmap_output.refresh_output()