File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -74,24 +74,21 @@ def initialize(parent=nil)
74
74
@rand_gen = Rex ::RandomIdentifierGenerator . new (
75
75
:max_length => 15 ,
76
76
:first_char_set => Rex ::Text ::Alpha +"_$" ,
77
- :char_set => Rex ::Text ::AlphaNumeric +"_$" ,
78
- :min_length => 1
77
+ :char_set => Rex ::Text ::AlphaNumeric +"_$"
79
78
)
80
79
end
81
80
82
81
# @return [String] a unique random var name that is not a reserved keyword
83
82
def random_var_name
84
- len = 1
85
83
loop do
86
- text = @rand_gen . generate ( len )
84
+ text = random_string
87
85
unless has_key? ( text ) or
88
86
RESERVED_KEYWORDS . include? ( text ) or
89
87
BUILTIN_VARS . include? ( text )
90
88
91
89
self [ text ] = nil
92
90
return text
93
91
end
94
- len += 1
95
92
end
96
93
end
97
94
@@ -100,10 +97,15 @@ def has_key?(key)
100
97
super or ( @parent and @parent . has_key? ( key ) )
101
98
end
102
99
100
+ # @return [String] a random string
101
+ def random_string
102
+ @rand_gen . generate
103
+ end
104
+
103
105
end
104
106
105
107
#
106
- # The maximum length of a string that can be passed through
108
+ # The maximum length of a string that will be passed through
107
109
# #transform_string without being chopped up into separate
108
110
# expressions and concatenated
109
111
#
You can’t perform that action at this time.
0 commit comments