Skip to content

Commit 852961f

Browse files
committed
Tweaking of transport behaviour, removal of patch
1 parent cf62d1f commit 852961f

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

lib/msf/core/payload/linux/reverse_tcp.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require 'msf/core'
44
require 'msf/core/transport_config'
5+
require 'msf/core/payload/linux'
56

67
module Msf
78

@@ -51,15 +52,16 @@ def transport_config(opts={})
5152
#
5253
def generate_reverse_tcp(opts={})
5354
asm = asm_reverse_tcp(opts)
54-
Metasm::Shellcode.assemble(Metasm::X86.new, asm).encode_string
55+
buf = Metasm::Shellcode.assemble(Metasm::X86.new, asm).encode_string
56+
apply_prepends(buf)
5557
end
5658

5759
#
5860
# Determine the maximum amount of space required for the features requested
5961
#
6062
def required_space
6163
# Start with our cached default generated size
62-
space = cached_size
64+
space = 300
6365

6466
# Reliability adds 10 bytes for recv error checks
6567
space += 10
@@ -72,11 +74,10 @@ def required_space
7274
# Generate an assembly stub with the configured feature set and options.
7375
#
7476
# @option opts [Fixnum] :port The port to connect to
75-
# @option opts [String] :exitfunk The exit method to use if there is an error, one of process, thread, or seh
77+
# @option opts [String] :host The host IP to connect to
7678
# @option opts [Bool] :reliable Whether or not to enable error handling code
7779
#
7880
def asm_reverse_tcp(opts={})
79-
8081
# TODO: reliability is coming
8182
#retry_count = [opts[:retry_count].to_i, 1].max
8283
#reliable = opts[:reliable]
@@ -129,6 +130,3 @@ def asm_reverse_tcp(opts={})
129130

130131
end
131132

132-
133-
134-

lib/rex/post/meterpreter/client_core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ def transport_prepare_request(method, opts={})
628628
# do more magic work for http(s) payloads
629629
unless opts[:transport].ends_with?('tcp')
630630
sum = uri_checksum_lookup(:connect)
631-
url << generate_uri_uuid(sum, uuid) + '/'
631+
url << generate_uri_uuid(sum, opts[:uuid]) + '/'
632632

633633
# TODO: randomise if not specified?
634634
opts[:ua] ||= 'Mozilla/4.0 (compatible; MSIE 6.1; Windows NT)'

lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ def cmd_transport(*args)
545545
end
546546

547547
opts = {
548+
:uuid => client.payload_uuid,
548549
:transport => nil,
549550
:lhost => nil,
550551
:lport => nil,
@@ -562,6 +563,7 @@ def cmd_transport(*args)
562563
:verbose => false
563564
}
564565

566+
valid = true
565567
@@transport_opts.parse(args) do |opt, idx, val|
566568
case opt
567569
when '-c'
@@ -598,9 +600,16 @@ def cmd_transport(*args)
598600
return
599601
end
600602
opts[:transport] = val
603+
else
604+
valid = false
601605
end
602606
end
603607

608+
unless valid
609+
cmd_transport_help
610+
return
611+
end
612+
604613
case command
605614
when 'list'
606615
result = client.core.transport_list

modules/payloads/stagers/linux/x86/reverse_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def initialize(info = {})
1919
super(merge_info(info,
2020
'Name' => 'Reverse TCP Stager',
2121
'Description' => 'Connect back to the attacker',
22-
'Author' => [ 'skape', 'egypt', ],
22+
'Author' => [ 'skape', 'egypt' ],
2323
'License' => MSF_LICENSE,
2424
'Platform' => 'linux',
2525
'Arch' => ARCH_X86,

modules/payloads/stages/linux/x86/meterpreter.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
require 'msf/base/sessions/meterpreter_options'
99
require 'rex/elfparsey'
1010

11-
# Provides methods to patch options into the metsrv stager.
12-
require 'rex/payloads/meterpreter/patch'
13-
1411
module Metasploit3
1512
include Msf::Sessions::MeterpreterOptions
1613

0 commit comments

Comments
 (0)