Skip to content

Commit 21b2697

Browse files
committed
Revert "Use tiny var names by default."
This reverts commit 52432ef.
1 parent 0b23fc2 commit 21b2697

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/rex/exploitation/jsobfu.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,21 @@ def initialize(parent=nil)
7474
@rand_gen = Rex::RandomIdentifierGenerator.new(
7575
:max_length => 15,
7676
:first_char_set => Rex::Text::Alpha+"_$",
77-
:char_set => Rex::Text::AlphaNumeric+"_$",
78-
:min_length => 1
77+
:char_set => Rex::Text::AlphaNumeric+"_$"
7978
)
8079
end
8180

8281
# @return [String] a unique random var name that is not a reserved keyword
8382
def random_var_name
84-
len = 1
8583
loop do
86-
text = @rand_gen.generate(len)
84+
text = random_string
8785
unless has_key?(text) or
8886
RESERVED_KEYWORDS.include?(text) or
8987
BUILTIN_VARS.include?(text)
9088

9189
self[text] = nil
9290
return text
9391
end
94-
len += 1
9592
end
9693
end
9794

@@ -100,10 +97,15 @@ def has_key?(key)
10097
super or (@parent and @parent.has_key?(key))
10198
end
10299

100+
# @return [String] a random string
101+
def random_string
102+
@rand_gen.generate
103+
end
104+
103105
end
104106

105107
#
106-
# The maximum length of a string that can be passed through
108+
# The maximum length of a string that will be passed through
107109
# #transform_string without being chopped up into separate
108110
# expressions and concatenated
109111
#

0 commit comments

Comments
 (0)