def run_scan(self, host, profile): if re.match(self.rgx_is_domain, host): commands = self.qs_data.get_profiles("profile_commands") try: nmap_option = commands[profile] except: nmap_option = "-T Aggressive -v -n" print "QuickScan: running scan: %s on %s" % (nmap_option, host) if Ipv6.is_ipv6(host): namp_option = nmap_option + " -6" self.command_execution = NmapCommand('%s %s %s' % (Path.nmap_command_path, nmap_option, host)) try: alive = self.command_execution.scan_state() if alive: warn_dialog = HIGAlertDialog( message_format="Scan has not finished yet", secondary_text="Another scan is running in the background.", type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_OK_CANCEL) response = warn_dialog.run() warn_dialog.destroy() if response == gtk.RESPONSE_OK: self.kill_scan() else: return except: pass try: self.command_execution.run_scan() self.status.set_scanning() except OSError, msg: warn_dialog = HIGAlertDialog( message_format="Nmap couldn't be found", secondary_text="Umit Quick Scan couldn't find Nmap. " "Please check your Nmap instalation.", type=gtk.MESSAGE_ERROR) warn_dialog.run() warn_dialog.destroy() except Exception, msg: warn_dialog = HIGAlertDialog( message_format="Command is missing!", secondary_text="Please check your profile's command.", type=gtk.MESSAGE_ERROR) warn_dialog.run() warn_dialog.destroy()
def __init__(self, nmap_path, command, host): Path.set_umit_conf(os.path.dirname(sys.argv[0])) Path.set_running_path(os.path.abspath(os.path.dirname(sys.argv[0]))) self.nmap_path = nmap_path self.command = command #add option for ipv6 address by checking the host # # #check for ipv6 address and -6 to command option if Ipv6.is_ipv6(host): command = command +" -6" self.host = host