@@ -37,6 +37,7 @@ def __init__(self, rule, file_path, line, code):
37
37
self .line = line
38
38
self .code = code
39
39
self .param_name = None
40
+ self .param_value = None
40
41
41
42
def functions (self ):
42
43
logging .info ('---------------------- [-]. Functions --------------------------------------' )
@@ -189,7 +190,7 @@ def is_controllable_param(self):
189
190
logging .info ("Check controllable param rule" )
190
191
controllable_param_rule = [
191
192
{
192
- 'rule' : r'\ \s?=\s?( \$\w+(?:\[(?:[^[\]]|( \?R) )*\])*)' .format (param_name ),
193
+ 'rule' : r'(\{0} \s?=\s?\$\w+(?:\[(?:[^[\]]|\?R)*\])*)' .format (param_name ),
193
194
'example' : '$param_name = $variable' ,
194
195
'test' : """
195
196
$param_name = $_GET
@@ -200,18 +201,18 @@ def is_controllable_param(self):
200
201
"""
201
202
},
202
203
{
203
- 'rule' : r'function\s+ \w+\s? \(.*( \{0})' .format (param_name ),
204
+ 'rule' : r'( function\s* \w+\s* \(.*\{0})' .format (param_name ),
204
205
'example' : 'function ($param_name)' ,
205
206
'test' : """
206
207
function ($param_name)
207
208
function ($some, $param_name)
208
209
"""
209
210
}
210
-
211
211
]
212
212
for c_rule in controllable_param_rule :
213
213
c_rule_result = re .findall (c_rule ['rule' ], param_block_code )
214
214
if len (c_rule_result ) >= 1 :
215
+ self .param_value = c_rule_result [0 ]
215
216
logging .info ("R: True (New rule: controllable param: {0}, {1})" .format (param_name , c_rule ['example' ]))
216
217
return True
217
218
logging .info ("R: True" )
0 commit comments