@@ -25,6 +25,14 @@ def initialize
25
25
] , self . class )
26
26
end
27
27
28
+ def rhost_or_vhost
29
+ if datastore [ 'VHOST' ]
30
+ return datastore [ 'VHOST' ]
31
+ else
32
+ return rhost
33
+ end
34
+ end
35
+
28
36
def run_host ( ip )
29
37
connect
30
38
@@ -39,14 +47,14 @@ def do_login(user, pass, ip)
39
47
40
48
# Perform the initial request and find the server nonce, which is required to log
41
49
# into IP Board
42
- res = send_request_raw ( {
43
- 'uri' => normalize_uri ( " #{ datastore [ 'TARGETURI' ] } " ) ,
50
+ res = send_request_cgi ( {
51
+ 'uri' => normalize_uri ( target_uri . path ) ,
44
52
'method' => 'GET' ,
45
- } , 25 )
53
+ } , 10 )
46
54
47
55
if not res
48
- print_error "Request failed... "
49
- return
56
+ print_error "No response when trying to connect to #{ rhost_or_vhost } "
57
+ return :connection_error
50
58
end
51
59
52
60
# Grab the key from within the body, or alert that it can't be found and exit out
@@ -55,13 +63,13 @@ def do_login(user, pass, ip)
55
63
print_status "Server nonce found, attempting to log in..."
56
64
else
57
65
print_error "Server nonce not present, potentially not an IP Board install or bad URI."
58
- print_error "Exiting .."
59
- return
66
+ print_error "Skipping #{ rhost_or_vhost } .."
67
+ return :skip_user
60
68
end
61
69
62
70
# With the server nonce found, try to log into IP Board with the user provided creds
63
71
res2 = send_request_cgi ( {
64
- 'uri' => normalize_uri ( " #{ datastore [ 'TARGETURI' ] } " , "index.php?app=core&module=global§ion=login&do=process" ) ,
72
+ 'uri' => normalize_uri ( target_uri . path , "index.php?app=core&module=global§ion=login&do=process" ) ,
65
73
'method' => 'POST' ,
66
74
'vars_post' => {
67
75
'auth_key' => "#{ server_nonce } " ,
@@ -89,9 +97,16 @@ def do_login(user, pass, ip)
89
97
return :next_user
90
98
else
91
99
print_error "Username: #{ user } and Password: #{ pass } are invalid credentials!"
100
+ return :skip_user
92
101
end
93
102
94
- rescue ::Timeout ::Error , ::Errno ::EPIPE
103
+ rescue ::Timeout ::Error
104
+ print_error "Connection timed out while attempting to reach #{ rhost_or_vhost } !"
105
+ return :connection_error
106
+
107
+ rescue ::Errno ::EPIPE
108
+ print_error "Broken pipe error when connecting to #{ rhost_or_vhost } !"
109
+ return :connection_error
95
110
end
96
111
end
97
112
0 commit comments