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
77
77
uri_max_len = 256 - "#{ datastore [ 'LHOST' ] } :#{ datastore [ 'LPORT' ] } /" . length
78
78
uri_req_len = datastore [ 'HTTPStagerURILength' ] . to_i
79
79
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
85
83
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
89
87
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"
91
90
end
92
91
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 )
95
93
end
96
94
97
95
#
You can’t perform that action at this time.
0 commit comments