Revert "Precalculate some uri strings in case the 1000-round generation fails"

This reverts commit 7161a548f4.

Prepping for a more sane solution that doesn't change the URI sizes and
succeeds without fallingback to a pre-generated list.
This commit is contained in:
Tod Beardsley
2012-03-26 12:22:19 -05:00
committed by James Lee
parent 9bc309958d
commit 4f4200a7b7
2 changed files with 8 additions and 20 deletions
+5 -8
View File
@@ -61,21 +61,18 @@ module ReverseHttps
uri_match
end
#
# Create a URI that matches a given checksum
#
def generate_uri_checksum(sum)
urix = nil
uri = Rex::Text.rand_text_alphanumeric(3)
("a".."z").sort_by {rand}.each do |x|
urix = (uri + x) if Rex::Text.checksum8(uri + x)
break if urix
0.upto(1000) do
uri = Rex::Text.rand_text_alphanumeric(4)
return uri if Rex::Text.checksum8(uri) == sum
end
return urix if urix
raise RuntimeError, "Unable to generate a string with checksum #{sum}"
end
#
# Initializes the HTTP SSL tunneling handler.
#