def manage_args(self): """ Managing the args that the user enters if the user enter [obevilion.py --cli (attack type)] this method is managing the (attack type) place in the previews ex. Parameters: '-d' '--dictionary' is for dictionary attack '-b' '--bruteforce' is for bruteforce attack if the user enter '-b' the user will be using bruteforce attack and this method will direct the user to this method 'cli_bruteforce_attack_outshell'. 'cli_bruteforce_attack_outshell' will take argument[3] for the archive path if the user enter '-d' the user will be using bruteforce attack and this method will direct the user to this method 'cli_bruteforce_attack_outshell'. 'cli_bruteforce_attack_outshell' will take argument[3] but it will not do anything cause the dictionary attack not implemented yet. otherwise, it will print 'Invalid argument: ' and the argument that the user miss typed. """ try: # Set attack type to the second arg in terminal self.arg = sys.argv[2] # if second arg = '-b' or '--bruteforce' start bruteforce attack if self.arg == "-b" or self.arg == '--bruteforce': try: self.tempArgument = sys.argv[3] self.cli_bruteforce_attack_outshell() except Exception as e: print(writer.red("Path argument missing!")) elif self.arg == '-d' or self.arg == '--dictionary': # if second arg = 'd' or '--dictionary' start dictionary attack try: self.tempArgument = sys.argv[3] self.cli_dictionary_attack_outshell() except Exception as e: print(writer.red("Path argument missing!")) else: print(writer.red("Invalid argument: {}".format(self.arg))) except Exception as e: pass
def check_os(self): '''Checking if the os is not linux. if not linux, do not run :)''' req_os = 'posix' if os.name != req_os: print( writer.red("{} {} is not supported yet".format( platform.system(), platform.release()))) print('Exiting...') time.sleep(2) sys.exit(1)
def rc(rf): # Alphabets Used in cracking alphabet = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890!@#*+-" # Start Counting start = time.time() # Begin with 0 tries tryn = 0 # for every letter in {alphabet} increase tryn with 1 for a in range(1, len(alphabet) + 1): for b in itertools.product(alphabet, repeat=a): k = "".join(b) if rf[-4:] == ".rar": # Rar Cracing print("Trying:", k) kf = os.popen( "unrar t -y -p{} {} 2>&1|grep 'All OK'".format(k, rf)) tryn += 1 for rkf in kf.readlines(): if rkf == "All OK\n": # if all is 'OK', Print The Password print(writer.green( "Found password: {}".format(str(k)), bold=True)) print(writer.green( "Tried combination count: {}".format(tryn))) print(writer.green("It took {} seconds".format( round(time.time() - start, 3)))) booker.write(rf, k) print("Exiting...") time.sleep(2) sys.exit(1) elif rf[-4:] == ".zip" or rf[-3:] == ".7z": # Cracing zip and 7z files print("Trying: {}".format(k)) kf = os.popen( "7za t -p{} {} 2>&1|grep 'Everything is Ok'".format(k, rf)) tryn += 1 for rkf in kf.readlines(): if rkf == "Everything is Ok\n": # if all is 'OK', Print The Password print(writer.green( "Found password: {}".format(str(k)), bold=True)) print(writer.green( "Tried combination count: {}".format(tryn))) print(writer.green("It took {} seconds".format( round(time.time() - start, 3)))) booker.write(rf, k) print("Exiting...") time.sleep(2) sys.exit(1) else: # If the user enters invalid file type print(writer.red("Cracking [zip / 7z / rar] only"))
def cli_bruteforce_attack(self): """ Attacking inside [the easy mode] """ try: path = raw_input('path:') if path != '': # if path not equal blank subprocess.call( 'python3 core/model.py {file}'.format(file=path), shell=True) else: print(writer.red("Try Again!")) except Exception as e: printer.unknowen_error(e) time.sleep(2) sys.exit(1)
def cli_dictionary_attack_outshell(self): """ Dictionary Attack in the external shell [Terminal Arguments] """ try: # path is set to user input at the third arg path = sys.argv[3] if path == '' or path is None: # if the user enter nothing print(writer.red("There Is 1 argument Messing!")) else: print( writer.yellow( "Use BruteForce Attack\nTrust Me Its Better")) except Exception as e: printer.unknowen_error(e) time.sleep(2) sys.exit(1)
def cli_bruteforce_attack_outshell(self): """ BruteForce Attack in the external shell [Terminal Arguments] """ try: # path is set to user input at the third arg path = sys.argv[3] if path == '' or path is None: # if the user enter nothing print(writer.red("Try Again!")) else: subprocess.call( 'python3 core/model.py {file}'.format(file=path), shell=True) except Exception as e: printer.unknowen_error(exception=e) time.sleep(2) sys.exit(1)
def check_py_version(self): '''checking if the python version valid. python3 is not supported at the main script. but it requires when running the attacking script. you must have both''' req_version = '2.7.14' not_valid_version = '3.0.0' if platform.python_version() >= req_version: pass elif platform.python_version() >= not_valid_version: print( writer.red( "python {} is not supported yet\nTry the latest version of python2" .format(platform.python_version()))) print('Exiting...') time.sleep(2) sys.exit(1)
def check_for_updates(self): try: with open('core/configuration/version.txt', 'r') as check_version: data = check_version.read().strip() # Reading the file content response = urlopen( # Updated version of the file 'https://raw.githubusercontent.com/BL4CKvGHOST/Ob3vil1on/master/core/configuration/version.txt' ) version = response.read().decode('utf-8').strip() if version != data: # if the online version not equal the local version print( writer.red( "current is {} there is new version available: {}". format(data, version), bold=True)) else: # if the online version equal the local version print( writer.green( "You are using the latest version:{}".format(data), bold=True)) except Exception as e: printer.unknowen_error(e)
kf = os.popen( "7za t -p{} {} 2>&1|grep 'Everything is Ok'".format(k, rf)) tryn += 1 for rkf in kf.readlines(): if rkf == "Everything is Ok\n": # if all is 'OK', Print The Password print(writer.green( "Found password: {}".format(str(k)), bold=True)) print(writer.green( "Tried combination count: {}".format(tryn))) print(writer.green("It took {} seconds".format( round(time.time() - start, 3)))) booker.write(rf, k) print("Exiting...") time.sleep(2) sys.exit(1) else: # If the user enters invalid file type print(writer.red("Cracking [zip / 7z / rar] only")) # Check That The File Already Exists . Then Run The File if len(sys.argv) == 2: if os.path.exists(sys.argv[1]): rc(sys.argv[1]) else: # if the file is not exist print(writer.red("Check The File Again! , The File Not Exist.\nExiting...")) else: pass
def loop(self): """ Looping throgh user input. Console will be somthing like that ==================================== = Obevilion = = Version = = Startup commands = = +=> = ==================================== this is the loop for easy mode prompt easy mode prompt is [easy] for noob users easy mode is a simple mode to use instead of entering command line arguments. it will loop with this prompt '+=>' until the user enters a valid command; if the command is valid, go execute what in it. if not just print("Invalid Input"). if the user press 'CTRL+C' exit. """ choice = "" try: # While loop to loop in user input while choice != "exit": choice = raw_input(writer.blue("+=> ", bold=True)) # Pointer if choice == 'gui': gui.main() # Start GUI Window elif choice == 'cli': self.attacks.cli_bruteforce_attack() # Start cli attack elif choice == 'help': # print help printer.help_banner() elif choice == 'about': printer.about() # print about elif choice == '': # Just Pass :) pass elif choice == 'set': self.noob_conf() elif choice == 'extract': print("Not Available Right Now!") elif choice == 'exit': # Exit From easy_mode print("Exiting...") time.sleep(2) sys.exit(1) elif choice == 'clear': subprocess.call('clear', shell=True) # Clear the terminal elif choice == 'license': printer.License() # print the license elif choice == 'attacks': printer.attacks() elif choice == "vault": booker.read() # read from the vault elif choice == 'install': subprocess.call("pip install colorama", shell=True) else: print(writer.red("Invalid Input")) except KeyboardInterrupt as ki: """If the user enters 'Ctrl+C' exit""" print(writer.red('\nCtrl+C detected!', bold=True)) time.sleep(1) print("Exiting...") time.sleep(2)