Skip to content

Commit a0b72bb

Browse files
committed
Updated module based on feedback
1 parent 383906c commit a0b72bb

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

modules/auxiliary/scanner/http/ipboard_login.rb

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ def initialize
2525
], self.class)
2626
end
2727

28+
def rhost_or_vhost
29+
if datastore['VHOST']
30+
return datastore['VHOST']
31+
else
32+
return rhost
33+
end
34+
end
35+
2836
def run_host(ip)
2937
connect
3038

@@ -39,14 +47,14 @@ def do_login(user, pass, ip)
3947

4048
# Perform the initial request and find the server nonce, which is required to log
4149
# 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),
4452
'method' => 'GET',
45-
}, 25)
53+
}, 10)
4654

4755
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
5058
end
5159

5260
# 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)
5563
print_status "Server nonce found, attempting to log in..."
5664
else
5765
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
6068
end
6169

6270
# With the server nonce found, try to log into IP Board with the user provided creds
6371
res2 = send_request_cgi({
64-
'uri' => normalize_uri("#{datastore['TARGETURI']}", "index.php?app=core&module=global&section=login&do=process"),
72+
'uri' => normalize_uri(target_uri.path, "index.php?app=core&module=global&section=login&do=process"),
6573
'method' => 'POST',
6674
'vars_post' => {
6775
'auth_key' => "#{server_nonce}",
@@ -89,9 +97,16 @@ def do_login(user, pass, ip)
8997
return :next_user
9098
else
9199
print_error "Username: #{user} and Password: #{pass} are invalid credentials!"
100+
return :skip_user
92101
end
93102

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
95110
end
96111
end
97112

0 commit comments

Comments
 (0)