Update session to display username and hostname
parent
ea0204b7e5
commit
82fe480c2e
|
@ -8,12 +8,12 @@ class Msf::Sessions::PowerShell < Msf::Sessions::CommandShell
|
||||||
def process_autoruns(datastore)
|
def process_autoruns(datastore)
|
||||||
# Read the initial output (PS banner) and toss it)
|
# Read the initial output (PS banner) and toss it)
|
||||||
initial_output = shell_read(-1, 0.01)
|
initial_output = shell_read(-1, 0.01)
|
||||||
# TODO: send command for getting the username
|
if initial_output =~ /running as user ([^\s]+) on ([^\s]+)/
|
||||||
# TODO: parse out the username and set it to a variable
|
username = $1
|
||||||
# TODO: send command for getting the hostname
|
hostname = $2
|
||||||
# TODO: parse out the hostname and set it to a variable
|
end
|
||||||
# Set the session info
|
# Set the session info
|
||||||
self.info = initial_output
|
self.info = "#{username} @ #{hostname}"
|
||||||
# Call our parent class's autoruns processing method
|
# Call our parent class's autoruns processing method
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,6 @@ module Metasploit3
|
||||||
'Arch' => ARCH_CMD,
|
'Arch' => ARCH_CMD,
|
||||||
'Handler' => Msf::Handler::BindTcp,
|
'Handler' => Msf::Handler::BindTcp,
|
||||||
'Session' => Msf::Sessions::PowerShell,
|
'Session' => Msf::Sessions::PowerShell,
|
||||||
'PayloadType' => 'cmd_interact',
|
|
||||||
'RequiredCmd' => 'generic',
|
'RequiredCmd' => 'generic',
|
||||||
'Payload' =>
|
'Payload' =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,6 @@ module Metasploit3
|
||||||
'Arch' => ARCH_CMD,
|
'Arch' => ARCH_CMD,
|
||||||
'Handler' => Msf::Handler::ReverseTcp,
|
'Handler' => Msf::Handler::ReverseTcp,
|
||||||
'Session' => Msf::Sessions::PowerShell,
|
'Session' => Msf::Sessions::PowerShell,
|
||||||
'PayloadType' => 'cmd_interact',
|
|
||||||
'RequiredCmd' => 'generic',
|
'RequiredCmd' => 'generic',
|
||||||
'Payload' =>
|
'Payload' =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue