File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
lib/msf/core/payload/windows Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def initialize(*args)
26
26
super
27
27
register_advanced_options (
28
28
[
29
- OptInt . new ( 'HTTPStagerURILength' , [ false , 'The URI length for the stager (5 to 240ish bytes)' ] )
29
+ OptInt . new ( 'HTTPStagerURILength' , [ false , 'The URI length for the stager (at least 5 bytes)' ] )
30
30
] , self . class )
31
31
end
32
32
@@ -73,16 +73,12 @@ def generate_reverse_http(opts={})
73
73
# Generate the URI for the initial stager
74
74
#
75
75
def generate_uri
76
- # Maximum URL is limited to https:// plus 256 bytes, figure out our maximum URI
77
- uri_max_len = 256 - "#{ datastore [ 'LHOST' ] } :#{ datastore [ 'LPORT' ] } /" . length
76
+
78
77
uri_req_len = datastore [ 'HTTPStagerURILength' ] . to_i
79
78
79
+ # Choose a random URI length between 30 and 255 bytes
80
80
if uri_req_len == 0
81
- uri_req_len = 30 + rand ( uri_max_len -30 )
82
- end
83
-
84
- if uri_req_len > uri_max_len
85
- raise ArgumentError , "Maximum HTTPStagerURILength is #{ uri_max_len } "
81
+ uri_req_len = 30 + rand ( 256 -30 )
86
82
end
87
83
88
84
if uri_req_len < 5
You can’t perform that action at this time.
0 commit comments