diff --git a/lib/msf/core/handler/reverse_http.rb b/lib/msf/core/handler/reverse_http.rb index dc241353cc..148e78dd46 100644 --- a/lib/msf/core/handler/reverse_http.rb +++ b/lib/msf/core/handler/reverse_http.rb @@ -65,9 +65,9 @@ module ReverseHttp # Create a URI that matches a given checksum # def generate_uri_checksum(sum) - 0.upto(1000) do - uri = Rex::Text.rand_text_alphanumeric(4) - return uri if Rex::Text.checksum8(uri) == sum + uri = Rex::Text.rand_text_alphanumeric(3) + ("a".."z").sort_by {rand}.each do |x| + return(uri + x) if Rex::Text.checksum8(uri + x) end raise RuntimeError, "Unable to generate a string with checksum #{sum}" end diff --git a/lib/msf/core/handler/reverse_https.rb b/lib/msf/core/handler/reverse_https.rb index a8148a88f3..da94a3f670 100644 --- a/lib/msf/core/handler/reverse_https.rb +++ b/lib/msf/core/handler/reverse_https.rb @@ -61,18 +61,18 @@ module ReverseHttps uri_match end - + # # Create a URI that matches a given checksum # def generate_uri_checksum(sum) - 0.upto(1000) do - uri = Rex::Text.rand_text_alphanumeric(4) - return uri if Rex::Text.checksum8(uri) == sum + uri = Rex::Text.rand_text_alphanumeric(3) + ("a".."z").sort_by {rand}.each do |x| + return(uri + x) if Rex::Text.checksum8(uri + x) end raise RuntimeError, "Unable to generate a string with checksum #{sum}" end - + # # Initializes the HTTP SSL tunneling handler. #