'Running OpenSSL command in Python subprocess
I am trying to run an OpenSSL decrypt command via Python's subprocess module, but have no luck so far:
import subprocess
check = subprocess.run('openssl enc -aes-256-cbc -d -in filepath_in -out filepath_out -K aes_key -iv iv_key', capture_output=True, text=True, shell=True).stdout
print(check)
The script returns nothing. However, when running the same string in the command line manually - everything works and it returns an output. Substituting the string with something simple like 'help' does print a proper cmd output, meaning the following code works without issues:
import subprocess
check = subprocess.run('help', capture_output=True, text=True, shell=True).stdout
print(check)
My goal is to run an OpenSSL command via subprocess and capture the output. Would greatly appreciate any tips/pointers.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
