Skip to content

Commit c3213a7

Browse files
author
Tod Beardsley
committed
Use peer when writing scanner modules
This fixes the module seen in PR rapid7#3684 to use the peer method at the beginning of print_* messages, rather than the vhost method at the end. Doing this tends to make reading the output much easier since it's more consistent. Incidentally, this module has an msftidy complaint: ```` --- Checking new and changed module syntax with tools/msftidy.rb --- modules/auxiliary/scanner/http/ipboard_login.rb - [INFO] Please use vars_get in send_request_cgi: send_request_cgi({ 'uri' => normalize_uri(target_uri.path, "index.php?app=core&module=global&section=login&do=process" ```` This should be fixed as well, or explained why it's not being honored.
1 parent 1ee83ff commit c3213a7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

modules/auxiliary/scanner/http/ipboard_login.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def run_host(ip)
3434

3535
def do_login(user, pass, ip)
3636
begin
37-
print_status "Connecting to target, searching for IP Board server nonce..."
37+
print_status "#{peer} - Connecting to target, searching for IP Board server nonce..."
3838

3939
# Perform the initial request and find the server nonce, which is required to log
4040
# into IP Board
@@ -44,17 +44,17 @@ def do_login(user, pass, ip)
4444
}, 10)
4545

4646
unless res
47-
print_error "No response when trying to connect to #{vhost}"
47+
print_error "#{peer} No response when trying to connect"
4848
return :connection_error
4949
end
5050

5151
# Grab the key from within the body, or alert that it can't be found and exit out
5252
if res.body =~ /name='auth_key'\s+value='.*?((?:[a-z0-9]*))'/i
5353
server_nonce = $1
54-
print_status "Server nonce found, attempting to log in..."
54+
print_status "#{peer} Server nonce found, attempting to log in..."
5555
else
56-
print_error "Server nonce not present, potentially not an IP Board install or bad URI."
57-
print_error "Skipping #{vhost}.."
56+
print_error "#{peer} Server nonce not present, potentially not an IP Board install or bad URI."
57+
print_error "#{peer} Skipping..."
5858
return :abort
5959
end
6060

@@ -82,20 +82,20 @@ def do_login(user, pass, ip)
8282

8383
# Inform the user if the user supplied credentials were valid or not
8484
if valid_creds
85-
print_good "Username: #{user} and Password: #{pass} are valid credentials!"
85+
print_good "#{peer} Username: #{user} and Password: #{pass} are valid credentials!"
8686
register_creds(user, pass, ip)
8787
return :next_user
8888
else
89-
vprint_error "Username: #{user} and Password: #{pass} are invalid credentials!"
89+
vprint_error "#{peer} Username: #{user} and Password: #{pass} are invalid credentials!"
9090
return nil
9191
end
9292

9393
rescue ::Timeout::Error
94-
print_error "Connection timed out while attempting to reach #{vhost}!"
94+
print_error "#{peer} Connection timed out while attempting to connect!"
9595
return :connection_error
9696

9797
rescue ::Errno::EPIPE
98-
print_error "Broken pipe error when connecting to #{vhost}!"
98+
print_error "#{peer} Broken pipe error when connecting!"
9999
return :connection_error
100100
end
101101
end

0 commit comments

Comments
 (0)