示例#1
0
    def open_file(self, widget):
        file_chooser = ResultsFileSingleChooserDialog(_("Select Scan Result"))

        response = file_chooser.run()
        file_chosen = file_chooser.get_filename()
        file_chooser.destroy()
        if response == gtk.RESPONSE_OK:
            try:
                parser = NmapParser()
                parser.parse_file(file_chosen)
            except xml.sax.SAXParseException, e:
                alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % _('Error parsing file'),
                    secondary_text=_(
                        "The file is not an Nmap XML output file. "
                        "The parsing error that occurred was\n%s") % str(e))
                alert.run()
                alert.destroy()
                return False
            except Exception, e:
                alert = HIGAlertDialog(
                        message_format='<b>%s</b>' % _(
                            'Cannot open selected file'),
                        secondary_text=_("""\
                            This error occurred while trying to open the file:
                            %s""") % str(e))
                alert.run()
                alert.destroy()
                return False
示例#2
0
    def open_file(self, widget):
        file_chooser = ResultsFileSingleChooserDialog(_("Select Scan Result"))

        response = file_chooser.run()
        file_chosen = file_chooser.get_filename()
        file_chooser.destroy()
        if response == gtk.RESPONSE_OK:
            try:
                parser = NmapParser()
                parser.parse_file(file_chosen)
            except xml.sax.SAXParseException as e:
                alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % _('Error parsing file'),
                    secondary_text=_(
                        "The file is not an Nmap XML output file. "
                        "The parsing error that occurred was\n%s") % str(e))
                alert.run()
                alert.destroy()
                return False
            except Exception as e:
                alert = HIGAlertDialog(message_format='<b>%s</b>' %
                                       _('Cannot open selected file'),
                                       secondary_text=_("""\
                        This error occurred while trying to open the file:
                        %s""") % str(e))
                alert.run()
                alert.destroy()
                return False

            scan_name = os.path.split(file_chosen)[-1]
            self.add_scan(scan_name, parser)

            self.combo_scan.set_active(len(self.list_scan) - 1)
示例#3
0
文件: DiffCompare.py 项目: x90/nmap
    def open_file(self, widget):
        file_chooser = ResultsFileSingleChooserDialog(_("Select Scan Result"))

        response = file_chooser.run()
        file_chosen = file_chooser.get_filename()
        file_chooser.destroy()
        if response == gtk.RESPONSE_OK:
            try:
                parser = NmapParser()
                parser.parse_file(file_chosen)
            except xml.sax.SAXParseException, e:
                alert = HIGAlertDialog(
                    message_format='<b>%s</b>' % _('Error parsing file'),
                    secondary_text=_(
                        "The file is not an Nmap XML output file. \
The parsing error that occurred was\n%s") % str(e))
                alert.run()
                alert.destroy()
                return False
            except Exception, e:
                alert = HIGAlertDialog(
                    message_format='<b>%s</b>' %
                    _('Cannot open selected file'),
                    secondary_text=
                    _("This error occurred while trying to open the file:\n%s")
                    % str(e))
                alert.run()
                alert.destroy()
                return False