You don't need this, Msf::Exploit::Remote::HttpClient provides a peer method which returns just that.