File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
lib/msf/core/payload/windows Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -77,21 +77,19 @@ def generate_uri
7777 uri_max_len = 256 - "#{ datastore [ 'LHOST' ] } :#{ datastore [ 'LPORT' ] } /" . length
7878 uri_req_len = datastore [ 'HTTPStagerURILength' ] . to_i
7979
80- if uri_req_len > 0
81-
82- if uri_req_len > uri_max_len
83- raise ArgumentError , "Maximum HTTPStagerURILength is #{ uri_max_len } "
84- end
80+ if uri_req_len == 0
81+ uri_req_len = 30 + rand ( uri_max_len -30 )
82+ end
8583
86- if uri_req_len < 5
87- raise ArgumentError , "Minimum HTTPStagerURILength is 5 "
88- end
84+ if uri_req_len > uri_max_len
85+ raise ArgumentError , "Maximum HTTPStagerURILength is #{ uri_max_len } "
86+ end
8987
90- return "/" + generate_uri_checksum ( Msf ::Handler ::ReverseHttp ::URI_CHECKSUM_INITW , uri_req_len )
88+ if uri_req_len < 5
89+ raise ArgumentError , "Minimum HTTPStagerURILength is 5"
9190 end
9291
93- # Generate a random 30+ byte URI
94- "/" + generate_uri_checksum ( Msf ::Handler ::ReverseHttp ::URI_CHECKSUM_INITW , 30 + rand ( uri_max_len -30 ) )
92+ "/" + generate_uri_checksum ( Msf ::Handler ::ReverseHttp ::URI_CHECKSUM_INITW , uri_req_len )
9593 end
9694
9795 #
You can’t perform that action at this time.
0 commit comments