Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/gather/external_ip.rb
Views: 11778
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary67# Exploit mixins should be called first8include Msf::Exploit::Remote::HttpClient9include Msf::Auxiliary::Report1011def initialize12super(13'Name' => 'Discover External IP via Ifconfig.me',14'Description' => %q{15This module checks for the public source IP address of the current16route to the RHOST by querying the public web application at ifconfig.me.17It should be noted this module will register activity on ifconfig.me,18which is not affiliated with Metasploit.19},20'Author' => ['RageLtMan <rageltman[at]sempervictus>'],21'License' => MSF_LICENSE,22'References' =>23[24[ 'URL', 'http://ifconfig.me/ip' ],25],26'DefaultOptions' => { 'VHOST' => 'ifconfig.me' }27)2829register_options(30[31Opt::RHOST('ifconfig.me'),32OptBool.new('REPORT_HOST', [false, 'Add the found IP to the database', false])33])34end3536def run37connect38res = send_request_cgi({'uri' => '/ip', 'method' => 'GET' })3940if res.nil?41print_error("Connection timed out")42return43end4445our_addr = res.body.strip46if Rex::Socket.is_ipv4?(our_addr) or Rex::Socket.is_ipv6?(our_addr)47print_good("Source ip to #{rhost} is #{our_addr}")48report_host(our_addr) if datastore['REPORT_HOST']49end50end51end525354