forked from n0tr00t/Sreg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sreg.py
156 lines (149 loc) · 6.24 KB
/
sreg.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
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/env python
# encoding: utf-8
# author: n0tr00t
# website: buzz.beebeeto.com
import sys
import glob
import json
import chardet
import requests
import urlparse
import argparse
import multiprocessing
from common.color import *
from common.output import *
def check(plugin, passport, passport_type):
"""
plugin: *.json
passport: username, email, phone
passport_type: passport type
"""
if plugin["request"]["{0}_url".format(passport_type)]:
url = plugin["request"]["{0}_url".format(passport_type)]
else:
return
app_name = plugin['information']['name']
category = plugin["information"]["category"]
website = plugin["information"]["website"].encode("utf-8")
judge_yes_keyword = plugin['status']['judge_yes_keyword'].encode("utf-8")
judge_no_keyword = plugin['status']['judge_no_keyword'].encode("utf-8")
headers = {
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6',
'Host': urlparse.urlparse(url).netloc,
'Referer': url,
}
if plugin['request']['method'] == "GET":
try:
content = requests.get(url, headers=headers, timeout=8).content
encoding = chardet.detect(content)["encoding"]
if encoding == None or encoding == "ascii":
content = content.encode("utf-8")
else:
content = content.decode(encoding).encode("utf-8")
except Exception, e:
print inRed('\n[-] %s Error: %s\n' % (app_name, str(e)))
return
if judge_yes_keyword in content and judge_no_keyword not in content:
print u"[{0}] {1}".format(category, ('%s (%s)' % (app_name, website)))
icon = plugin['information']['icon'].encode("utf-8")
desc = plugin['information']['desc'].encode("utf-8")
output_add(category.encode("utf-8"), app_name.encode("utf-8"), website,
passport.encode("utf-8"), passport_type, icon, desc)
else:
pass
elif plugin['request']['method'] == "POST":
post_data = plugin['request']['post_fields']
if post_data.values().count("") != 1:
print "[*] The POST field can only leave a null value."
return
for k, v in post_data.iteritems():
if v == "":
post_data[k] = passport
try:
content = requests.post(url, data=post_data, headers=headers, timeout=8).content
encoding = chardet.detect(content)["encoding"]
if encoding == None or encoding == "ascii":
content = content.encode("utf-8")
else:
content = content.decode(encoding).encode("utf-8")
except Exception, e:
print inRed('\n[-] %s Error: %s\n' % (app_name, str(e)))
return
if judge_yes_keyword in content and judge_no_keyword not in content:
print u"[{0}] {1}".format(category, ('%s (%s)' % (app_name, website)))
icon = plugin['information']['icon'].encode("utf-8")
desc = plugin['information']['desc'].encode("utf-8")
output_add(category.encode("utf-8"), app_name.encode("utf-8"), website,
passport.encode("utf-8"), passport_type, icon, desc)
else:
pass
else:
print inRed(u'\n[*] {0} Error!\n'.format(plugin['request']['name']))
# print u"[-]{}:::Error!".format(plugin['request']['name'])
def main():
parser = argparse.ArgumentParser(description="Check how many Platforms the User registered.")
parser.add_argument("-u", action="store", dest="user")
parser.add_argument("-e", action="store", dest="email")
parser.add_argument("-c", action="store", dest="cellphone")
parser_argument = parser.parse_args()
banner = '''
.d8888b.
d88P Y88b
Y88b.
"Y888b. 888d888 .d88b. .d88b.
"Y88b.888P" d8P Y8bd88P"88b
"888888 88888888888 888
Y88b d88P888 Y8b. Y88b 888
"Y8888P" 888 "Y8888 "Y88888
888
Y8b d88P
"Y88P"
'''
all_argument = [parser_argument.cellphone, parser_argument.user, parser_argument.email]
plugins = glob.glob("./plugins/*.json")
print inGreen(banner)
print '[*] App: Search Registration'
print '[*] Version: V1.0(20150303)'
print '[*] Website: buzz.beebeeto.com'
file_name = ""
if all_argument.count(None) != 2:
print '\nInput "-h" view the help information.'
sys.exit(0)
if parser_argument.cellphone:
print inYellow('\n[+] Phone Checking: %s\n') % parser_argument.cellphone
file_name = "cellphone_" + str(parser_argument.cellphone)
output_init(file_name, "Phone: ", str(parser_argument.cellphone))
if parser_argument.user:
print inYellow('\n[+] Username Checking: %s\n') % parser_argument.user
file_name = "user_" + str(parser_argument.user)
output_init(file_name, "UserName: ", str(parser_argument.user))
if parser_argument.email:
print inYellow('\n[+] Email Checking: %s\n') % parser_argument.email
file_name = "email_" + str(parser_argument.email)
output_init(file_name, "E-mail: ", str(parser_argument.email))
jobs = []
for plugin in plugins:
with open(plugin) as f:
try:
content = json.load(f)
except Exception, e:
print e, plugin
continue
if parser_argument.cellphone:
p = multiprocessing.Process(target=check,
args=(content, unicode(parser_argument.cellphone, "utf-8"), "cellphone"))
elif parser_argument.user:
p = multiprocessing.Process(target=check,
args=(content, unicode(parser_argument.user, "utf-8"), "user"))
elif parser_argument.email:
p = multiprocessing.Process(target=check,
args=(content, unicode(parser_argument.email, "utf-8"), "email"))
p.start()
jobs.append(p)
while sum([i.is_alive() for i in jobs]) != 0:
pass
for i in jobs:
i.join()
output_finished(file_name)
if __name__ == '__main__':
main()