@@ -166,12 +166,12 @@ def test_rpc_xss_injection(self):
166
166
167
167
results = []
168
168
for i , payload in enumerate (self .XSS_PAYLOADS ):
169
- logger .debug (f"Testing XSS payload #{ i + 1 } : { payload [:50 ]} ..." )
169
+ logger .debug (f"Testing XSS payload #{ i + 1 } : { payload [:50 ]} ..." )
170
170
try :
171
171
RPCRequest (jsonrpc = "2.0" , method = payload , id = 1 )
172
- results .append (f"❌ XSS #{ i + 1 } was NOT rejected (security issue!): { payload [:30 ]} ..." )
172
+ results .append (f"❌ XSS #{ i + 1 } was NOT rejected (security issue!): { payload [:30 ]} ..." )
173
173
except ValidationError as e :
174
- results .append (f"✅ XSS #{ i + 1 } correctly rejected: { payload [:30 ]} ... -> { str (e ).split (chr (10 ))[0 ]} " )
174
+ results .append (f"✅ XSS #{ i + 1 } correctly rejected: { payload [:30 ]} ... -> { str (e ).split (chr (10 ))[0 ]} " )
175
175
176
176
# Print all results
177
177
for result in results :
@@ -183,12 +183,12 @@ def test_rpc_sql_injection(self):
183
183
184
184
results = []
185
185
for i , payload in enumerate (self .SQL_INJECTION_PAYLOADS ):
186
- logger .debug (f"Testing SQL injection #{ i + 1 } : { payload } " )
186
+ logger .debug (f"Testing SQL injection #{ i + 1 } : { payload } " )
187
187
try :
188
188
RPCRequest (jsonrpc = "2.0" , method = payload , id = 1 )
189
- results .append (f"❌ SQL injection #{ i + 1 } was NOT rejected (security issue!): { payload } " )
189
+ results .append (f"❌ SQL injection #{ i + 1 } was NOT rejected (security issue!): { payload } " )
190
190
except ValidationError as e :
191
- results .append (f"✅ SQL injection #{ i + 1 } correctly rejected: { payload } -> { str (e ).split (chr (10 ))[0 ]} " )
191
+ results .append (f"✅ SQL injection #{ i + 1 } correctly rejected: { payload } -> { str (e ).split (chr (10 ))[0 ]} " )
192
192
193
193
# Print all results
194
194
for result in results :
@@ -200,12 +200,12 @@ def test_rpc_command_injection(self):
200
200
201
201
results = []
202
202
for i , payload in enumerate (self .COMMAND_INJECTION_PAYLOADS ):
203
- logger .debug (f"Testing command injection #{ i + 1 } : { payload } " )
203
+ logger .debug (f"Testing command injection #{ i + 1 } : { payload } " )
204
204
try :
205
205
RPCRequest (jsonrpc = "2.0" , method = payload , id = 1 )
206
- results .append (f"❌ Command injection #{ i + 1 } was NOT rejected (security issue!): { payload } " )
206
+ results .append (f"❌ Command injection #{ i + 1 } was NOT rejected (security issue!): { payload } " )
207
207
except ValidationError as e :
208
- results .append (f"✅ Command injection #{ i + 1 } correctly rejected: { payload } -> { str (e ).split (chr (10 ))[0 ]} " )
208
+ results .append (f"✅ Command injection #{ i + 1 } correctly rejected: { payload } -> { str (e ).split (chr (10 ))[0 ]} " )
209
209
210
210
# Print all results
211
211
for result in results :
@@ -217,12 +217,12 @@ def test_rpc_path_traversal(self):
217
217
218
218
results = []
219
219
for i , payload in enumerate (self .PATH_TRAVERSAL_PAYLOADS ):
220
- logger .debug (f"Testing path traversal #{ i + 1 } : { payload } " )
220
+ logger .debug (f"Testing path traversal #{ i + 1 } : { payload } " )
221
221
try :
222
222
RPCRequest (jsonrpc = "2.0" , method = payload , id = 1 )
223
- results .append (f"❌ Path traversal #{ i + 1 } was NOT rejected (security issue!): { payload [:30 ]} ..." )
223
+ results .append (f"❌ Path traversal #{ i + 1 } was NOT rejected (security issue!): { payload [:30 ]} ..." )
224
224
except ValidationError as e :
225
- results .append (f"✅ Path traversal #{ i + 1 } correctly rejected: { payload [:30 ]} ... -> { str (e ).split (chr (10 ))[0 ]} " )
225
+ results .append (f"✅ Path traversal #{ i + 1 } correctly rejected: { payload [:30 ]} ... -> { str (e ).split (chr (10 ))[0 ]} " )
226
226
227
227
# Print all results
228
228
for result in results :
@@ -308,12 +308,12 @@ def test_rpc_unicode_attacks(self):
308
308
309
309
results = []
310
310
for i , payload in enumerate (self .UNICODE_PAYLOADS ):
311
- logger .debug (f"Testing Unicode attack #{ i + 1 } : { repr (payload [:30 ])} ..." )
311
+ logger .debug (f"Testing Unicode attack #{ i + 1 } : { repr (payload [:30 ])} ..." )
312
312
try :
313
313
RPCRequest (jsonrpc = "2.0" , method = payload , id = 1 )
314
- results .append (f"❌ Unicode attack #{ i + 1 } was NOT rejected (security issue!)" )
314
+ results .append (f"❌ Unicode attack #{ i + 1 } was NOT rejected (security issue!)" )
315
315
except ValidationError :
316
- results .append (f"✅ Unicode attack #{ i + 1 } correctly rejected" )
316
+ results .append (f"✅ Unicode attack #{ i + 1 } correctly rejected" )
317
317
318
318
# Print all results
319
319
for result in results :
@@ -325,12 +325,12 @@ def test_rpc_crlf_injection(self):
325
325
326
326
results = []
327
327
for i , payload in enumerate (self .CRLF_INJECTION_PAYLOADS ):
328
- logger .debug (f"Testing CRLF injection #{ i + 1 } : { repr (payload [:30 ])} ..." )
328
+ logger .debug (f"Testing CRLF injection #{ i + 1 } : { repr (payload [:30 ])} ..." )
329
329
try :
330
330
RPCRequest (jsonrpc = "2.0" , method = payload , id = 1 )
331
- results .append (f"❌ CRLF injection #{ i + 1 } was NOT rejected (security issue!)" )
331
+ results .append (f"❌ CRLF injection #{ i + 1 } was NOT rejected (security issue!)" )
332
332
except ValidationError :
333
- results .append (f"✅ CRLF injection #{ i + 1 } correctly rejected" )
333
+ results .append (f"✅ CRLF injection #{ i + 1 } correctly rejected" )
334
334
335
335
# Print all results
336
336
for result in results :
@@ -470,8 +470,8 @@ def test_rpc_params_validation(self):
470
470
deep_params = {"level1" : {}}
471
471
current = deep_params ["level1" ]
472
472
for i in range (20 ):
473
- current [f"level{ i + 2 } " ] = {}
474
- current = current [f"level{ i + 2 } " ]
473
+ current [f"level{ i + 2 } " ] = {}
474
+ current = current [f"level{ i + 2 } " ]
475
475
476
476
try :
477
477
RPCRequest (jsonrpc = "2.0" , method = "valid_method" , params = deep_params )
0 commit comments