def __init__(self): QSData.__init__(self) Path.set_umit_conf(os.path.dirname(sys.argv[0])) Path.set_running_path(os.path.abspath(os.path.dirname(sys.argv[0]))) data = QSData() self.recent_scans = data.get_recent_scans() self.profiles = data.get_profiles() self.target_list = data.get_target_list self.nmap_options = data.get_nmap_options() self.nmap_command_option = data.get_nmap_command_option() self.db_data = data.get_from_db()
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
def main(cmd, base_path, home_conf, winhndl=None): if base_path not in sys.path: sys.path.insert(0, base_path) print base_path Path.set_running_path(os.path.abspath(os.path.dirname(base_path))) Path.force_set_umit_conf(home_conf) # Trying to adjust signals when running as a windows service won't work # since it needs to be adjusted while on the main thread. if not servicemanager.RunningAsService(): if os.name == "posix": signal.signal(signal.SIGHUP, safe_shutdown) signal.signal(signal.SIGTERM, safe_shutdown) signal.signal(signal.SIGINT, safe_shutdown) cmds = {'start': start} cmds[cmd](winhndl=winhndl)
try: self.scan_exec.run_scan() except OSError, msg: raise(msg) try: while self.scan_exec.scan_state(): print ">>>", self.scan_exec.get_normal_output() except Exception: print "Exception caught" from umit.core.UmitDB import Scans state = self.scan_exec.scan_state() if state == False: store = Scans(scan_name="Quick Scan on %s" % self.host, nmap_xml_output=self.scan_exec.get_xml_output(), date=datetime.now()) return self.scan_exec.get_normal_output() return False if __name__ == "__main__": Path.set_umit_conf(os.path.dirname(sys.argv[0])) Path.set_running_path(os.path.abspath(os.path.dirname(sys.argv[0]))) b = Nmap(Path.nmap_command_path, "Agressive -v", "google.com") b.run()
def __init__(self): Path.set_umit_conf(os.path.dirname(sys.argv[0])) Path.set_running_path(os.path.abspath(os.path.dirname(sys.argv[0])))