@@ -23,13 +23,14 @@ def initialize(info={})
23
23
register_options (
24
24
[
25
25
Opt ::RPORT ( 5984 ) ,
26
- OptString . new ( 'TARGETURI' , [ false , "TARGETURI for CouchDB. Default here is /_users/_all_docs " , "/" ] ) ,
26
+ OptString . new ( 'TARGETURI' , [ false , "TARGETURI for CouchDB. Default here is /" , "/" ] ) ,
27
27
OptPath . new ( 'USERPASS_FILE' , [ false , "File containing users and passwords separated by space, one pair per line" ,
28
28
File . join ( Msf ::Config . install_root , "data" , "wordlists" , "http_default_userpass.txt" ) ] ) ,
29
29
OptPath . new ( 'USER_FILE' , [ false , "File containing users, one per line" ,
30
30
File . join ( Msf ::Config . install_root , "data" , "wordlists" , "http_default_users.txt" ) ] ) ,
31
31
OptPath . new ( 'PASS_FILE' , [ false , "File containing passwords, one per line" ,
32
- File . join ( Msf ::Config . install_root , "data" , "wordlists" , "http_default_pass.txt" ) ] )
32
+ File . join ( Msf ::Config . install_root , "data" , "wordlists" , "http_default_pass.txt" ) ] ) ,
33
+ OptBool . new ( 'USER_AS_PASS' , [ false , "Try the username as the password for all users" , false ] ) ,
33
34
] , self . class )
34
35
end
35
36
@@ -38,9 +39,17 @@ def run_host(ip)
38
39
user = datastore [ 'USERNAME' ] . to_s
39
40
pass = datastore [ 'PASSWORD' ] . to_s
40
41
42
+ if user . nil? || user . strip == ''
43
+ each_user_pass do |user , pass |
44
+ do_login ( user , pass )
45
+ end
46
+ return
47
+ end
48
+
41
49
vprint_status ( "#{ rhost } :#{ rport } - Trying to login with '#{ user } ' : '#{ pass } '" )
42
50
43
51
uri = target_uri . path
52
+
44
53
res = send_request_cgi ( {
45
54
'uri' => normalize_uri ( uri , '_users/_all_docs' ) ,
46
55
'method' => 'GET' ,
@@ -55,18 +64,16 @@ def run_host(ip)
55
64
vprint_good ( "#{ rhost } :#{ rport } - Successful login with '#{ user } ' : '#{ pass } '" )
56
65
else
57
66
vprint_error ( "#{ rhost } :#{ rport } - Failed login with '#{ user } ' : '#{ pass } '" )
58
- print_status ( "Brute-forcing... >:-} " )
59
- each_user_pass do |user , pass |
60
- do_login ( user , pass )
61
- end
62
67
end
68
+
63
69
rescue ::Rex ::ConnectionError
64
70
vprint_error ( "'#{ rhost } ':'#{ rport } ' - Failed to connect to the web server" )
65
71
end
66
72
67
73
def do_login ( user , pass )
68
74
vprint_status ( "Trying username:'#{ user } ' with password:'#{ pass } '" )
69
75
begin
76
+
70
77
uri = target_uri . path
71
78
res = send_request_cgi (
72
79
{
0 commit comments