Skip to content

Commit

Permalink
gather/external_ip: set Host header
Browse files Browse the repository at this point in the history
http://ifconfig.me replies with 404 when Host header isn't set.
  • Loading branch information
arno01 committed Jan 8, 2021
1 parent 25aecc8 commit 32005de
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/auxiliary/gather/external_ip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ def initialize
register_options(
[
Opt::RHOST('ifconfig.me'),
OptString.new('VHOST', [false, "HTTP server hostname", 'ifconfig.me']),
OptBool.new('REPORT_HOST', [false, 'Add the found IP to the database', false])
])
end

def run
connect

# Use VHOST when set.
def rhost
datastore['VHOST'] || datastore['RHOST']
end

res = send_request_cgi({'uri' => '/ip', 'method' => 'GET' })

if res.nil?
Expand Down

0 comments on commit 32005de

Please sign in to comment.