Skip to content

Commit 091f4d4

Browse files
authored
Merge pull request #406 from yashsinghcodes/working
output stderr when running ssh commands
2 parents b8d8e31 + efafb3f commit 091f4d4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

shuffle-tools/1.2.0/src/app.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2632,10 +2632,19 @@ def run_ssh_command(self, host, port, user_name, private_key_file_id, password,
26322632

26332633
try:
26342634
stdin, stdout, stderr = ssh_client.exec_command(str(command))
2635+
try:
2636+
errorLog = stderr.read().decode(errors='ignore')
2637+
except Exception as e:
2638+
errorLog = f"Failed to read stderr {e}"
2639+
try:
2640+
output = stdout.read().decode(errors='ignore')
2641+
except Exception as e:
2642+
output = f"Failed to read stdout {e}"
2643+
26352644
except Exception as e:
26362645
return {"success":"false","message":str(e)}
26372646

2638-
return {"success":"true","output": stdout.read().decode(errors='ignore')}
2647+
return {"success":"true","output": output, "error_logs": errorLog}
26392648

26402649
def cleanup_ioc_data(self, input_data):
26412650
# Remove unecessary parts like { and }, quotes etc

0 commit comments

Comments
 (0)