metasploit-framework

https://github.com/rapid7/metasploit-framework

Ruby

Metasploit Framework

Msf::Exploit::Remote::HttpServer#srvhost_addr

An address to which the client can route.

If available, return LHOST which should be the right thing since it
already has to be an address the client can route to for the payload to
work.  However, LHOST will only be available if we're using a reverse_*
payload, so if we don't have it, try to use the client's peerhost
address.  Failing that, fall back to the addr with the default gateway.
All of this will be for naught in the case of a user behind NAT using a
bind payload but there's nothing we can do about it.

NOTE: The address will be *incorrect* in the following two situations:
1. LHOST is pointed at a exploit/multi/handler on some other box.
2. SRVHOST has a value of '0.0.0.0', the user is behind NAT, and we're
   using a bind payload.  In that case, we don't have an LHOST and
   the source address will be internal.

This can potentially be dealt with in a module by using the Host header
from a request if such a header exists.

Source | Google | Stack overflow

Edit

git clone [email protected]:rapid7/metasploit-framework.git

cd metasploit-framework

open lib/msf/core/exploit/http/server.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Msf--Exploit--Remote--HttpServer-srvhost_addr-for-pr


# Commit to git

git add lib/msf/core/exploit/http/server.rbgit commit -m "better docs for Msf::Exploit::Remote::HttpServer#srvhost_addr"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Msf--Exploit--Remote--HttpServer-srvhost_addr-for-pr

hub pull-request


# Celebrate!