Use tiny var names by default.

bug/bundler_fix
Joe Vennix 2014-04-09 16:54:02 -05:00
parent 49139cc07f
commit 52432ef482
1 changed files with 6 additions and 8 deletions

View File

@ -74,14 +74,16 @@ class JSObfu
@rand_gen = Rex::RandomIdentifierGenerator.new(
:max_length => 15,
:first_char_set => Rex::Text::Alpha+"_$",
:char_set => Rex::Text::AlphaNumeric+"_$"
:char_set => Rex::Text::AlphaNumeric+"_$",
:min_length => 1
)
end
# @return [String] a unique random var name that is not a reserved keyword
def random_var_name
len = 1
loop do
text = random_string
text = @rand_gen.generate(len)
unless has_key?(text) or
RESERVED_KEYWORDS.include?(text) or
BUILTIN_VARS.include?(text)
@ -89,6 +91,7 @@ class JSObfu
self[text] = nil
return text
end
len += 1
end
end
@ -97,15 +100,10 @@ class JSObfu
super or (@parent and @parent.has_key?(key))
end
# @return [String] a random string
def random_string
@rand_gen.generate
end
end
#
# The maximum length of a string that will be passed through
# The maximum length of a string that can be passed through
# #transform_string without being chopped up into separate
# expressions and concatenated
#