From 2ee1764ceb23c406ac19dd9edc5e4e057f04e5e0 Mon Sep 17 00:00:00 2001 From: sinn3r Date: Mon, 3 Feb 2014 01:05:43 -0600 Subject: [PATCH] Add method rhost, rport, and peer for post modules [SeeRM #8761] --- lib/msf/core/post/common.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/msf/core/post/common.rb b/lib/msf/core/post/common.rb index e6cce966f8..cab869d366 100644 --- a/lib/msf/core/post/common.rb +++ b/lib/msf/core/post/common.rb @@ -2,6 +2,28 @@ module Msf::Post::Common + def rhost + case session.type + when 'meterpreter' + session.sock.peerhost + when 'shell' + session.session_host + end + end + + def rport + case session.type + when 'meterpreter' + session.sock.peerport + when 'shell' + session.session_port + end + end + + def peer + "#{rhost}:#{rport}" + end + # # Checks if the remote system has a process with ID +pid+ #