We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f56eac7 commit 1cebc9fCopy full SHA for 1cebc9f
lib/msf/base/sessions/powershell.rb
@@ -6,14 +6,17 @@ class Msf::Sessions::PowerShell < Msf::Sessions::CommandShell
6
# Execute any specified auto-run scripts for this session
7
#
8
def process_autoruns(datastore)
9
- # Read the initial output (PS banner) and toss it)
+
10
+ # Read the username and hostname from the initial banner
11
initial_output = shell_read(-1, 0.01)
12
if initial_output =~ /running as user ([^\s]+) on ([^\s]+)/
13
username = $1
14
hostname = $2
15
+ self.info = "#{username} @ #{hostname}"
16
+ else
17
+ self.info = initial_output.gsub(/[\r\n]/, ' ')
18
end
- # Set the session info
- self.info = "#{username} @ #{hostname}"
19
20
# Call our parent class's autoruns processing method
21
super
22
0 commit comments