{"nwo":"0xSobky\/HackVault","sha":"6c45804095b407133182c1461455c7610b187f5f","path":"AutoRecon.py","language":"python","identifier":"main","parameters":"()","argument_list":"","return_statement":"","docstring":"Execute main code.","docstring_summary":"Execute main code.","docstring_tokens":["Execute","main","code","."],"function":"def main():\n \"\"\"Execute main code.\"\"\"\n try:\n domain = sys.argv[1]\n ip_address = socket.gethostbyname(domain)\n except IndexError:\n print('Error: Domain name not specified.')\n sys.exit(1)\n except socket.gaierror:\n print('Error: Domain name cannot be resolved.')\n raise\n procs = []\n whois_cmd = ['whois', domain]\n dig_cmd = ['dig', '-t', 'txt', '+short', domain]\n wpscan_cmd = ['wpscan', '--force', '--update', '--url', domain]\n nmap_hosts_cmd = ['nmap', '-sn', ip_address + '\/24']\n nmap_script_names = ('*-vuln*, banner, default, dns-brute,'\n 'dns-zone-transfer, ftp-*, hostmap-ip2hosts, http-config-backup,'\n 'http-cross*, http-devframework, http-enum, http-headers,'\n 'http-shellshock, http-sitemap-generator, http-waf-fingerprint,'\n 'http-xssed, smtp-*, ssl-*, version')\n nmap_full_cmd = ['nmap', '-sV', '-sS', '-A', '-Pn', '--script',\n nmap_script_names, domain]\n cmds = {'TXT Records': dig_cmd, 'WHOIS Info': whois_cmd,\n 'Active Hosts': nmap_hosts_cmd, 'Nmap Results': nmap_full_cmd,\n 'WPScan': wpscan_cmd}\n\n def handle_proc(proc):\n \"\"\"Handle subprocesses outputs.\"\"\"\n separator = '=================='\n output = b''.join(proc.stdout.readlines()).decode('utf-8')\n print(proc.title)\n print(separator)\n print(output.strip())\n print(separator + '\\n')\n procs.remove(proc)\n\n for title, cmd in cmds.items():\n try:\n proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n proc.title = title\n procs.append(proc)\n except OSError:\n print('%s >> Dependency error occurred.\\n' % title)\n\n while True:\n for proc in procs:\n retcode = proc.poll()\n if retcode is not None:\n handle_proc(proc)\n else:\n continue\n if not procs:\n break\n else:\n sleep(1)","function_tokens":["def","main","(",")",":","try",":","domain","=","sys",".","argv","[","1","]","ip_address","=","socket",".","gethostbyname","(","domain",")","except","IndexError",":","print","(","'Error: Domain name not specified.'",")","sys",".","exit","(","1",")","except","socket",".","gaierror",":","print","(","'Error: Domain name cannot be resolved.'",")","raise","procs","=","[","]","whois_cmd","=","[","'whois'",",","domain","]","dig_cmd","=","[","'dig'",",","'-t'",",","'txt'",",","'+short'",",","domain","]","wpscan_cmd","=","[","'wpscan'",",","'--force'",",","'--update'",",","'--url'",",","domain","]","nmap_hosts_cmd","=","[","'nmap'",",","'-sn'",",","ip_address","+","'\/24'","]","nmap_script_names","=","(","'*-vuln*, banner, default, dns-brute,'","'dns-zone-transfer, ftp-*, hostmap-ip2hosts, http-config-backup,'","'http-cross*, http-devframework, http-enum, http-headers,'","'http-shellshock, http-sitemap-generator, http-waf-fingerprint,'","'http-xssed, smtp-*, ssl-*, version'",")","nmap_full_cmd","=","[","'nmap'",",","'-sV'",",","'-sS'",",","'-A'",",","'-Pn'",",","'--script'",",","nmap_script_names",",","domain","]","cmds","=","{","'TXT Records'",":","dig_cmd",",","'WHOIS Info'",":","whois_cmd",",","'Active Hosts'",":","nmap_hosts_cmd",",","'Nmap Results'",":","nmap_full_cmd",",","'WPScan'",":","wpscan_cmd","}","def","handle_proc","(","proc",")",":","\"\"\"Handle subprocesses outputs.\"\"\"","separator","=","'=================='","output","=","b''",".","join","(","proc",".","stdout",".","readlines","(",")",")",".","decode","(","'utf-8'",")","print","(","proc",".","title",")","print","(","separator",")","print","(","output",".","strip","(",")",")","print","(","separator","+","'\\n'",")","procs",".","remove","(","proc",")","for","title",",","cmd","in","cmds",".","items","(",")",":","try",":","proc","=","subprocess",".","Popen","(","cmd",",","stdout","=","subprocess",".","PIPE",",","stderr","=","subprocess",".","STDOUT",")","proc",".","title","=","title","procs",".","append","(","proc",")","except","OSError",":","print","(","'%s >> Dependency error occurred.\\n'","%","title",")","while","True",":","for","proc","in","procs",":","retcode","=","proc",".","poll","(",")","if","retcode","is","not","None",":","handle_proc","(","proc",")","else",":","continue","if","not","procs",":","break","else",":","sleep","(","1",")"],"url":"https:\/\/github.com\/0xSobky\/HackVault\/blob\/6c45804095b407133182c1461455c7610b187f5f\/AutoRecon.py#L12-L67"}