Skip to content

Commit 869233c

Browse files
committed
Fix bug with when quoted < or > is misinterpreted as file download or upload, thanks @NicolasG
1 parent 1bbb80e commit 869233c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stormshield/sns/sslclient/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class SSLClient:
267267
NEED_TOTP_AUTH = "NEED_TOTP_AUTH"
268268
ERR_BRUTEFORCE = "ERR_BRUTEFORCE"
269269

270-
fileregexp = re.compile(r'(.*)\s*(\<|\>)\s*(.*)\s*')
270+
fileregexp = re.compile(r'^(?P<cmd>.+?)\s*[<>]\s*(?!.*\")(?P<file>.*?)$')
271271

272272
CHUNK_SIZE = 10240 # bytes
273273

@@ -500,8 +500,8 @@ def send_command(self, command, **conn_options):
500500
filename = None
501501
result = self.fileregexp.match(command)
502502
if result:
503-
command = result.group(1)
504-
filename = result.group(3)
503+
command = result.group('cmd')
504+
filename = result.group('file')
505505

506506
request = self.session.get(
507507
self.baseurl + '/api/command?sessionid=' + self.sessionid +

0 commit comments

Comments
 (0)