mirror of
https://github.com/outbackdingo/step-ca-webui.git
synced 2026-01-27 18:20:22 +00:00
20 lines
545 B
Python
20 lines
545 B
Python
import shlex
|
|
import subprocess
|
|
from typing import Tuple
|
|
|
|
|
|
class CLIWrapper:
|
|
@staticmethod
|
|
def sanitize_input(input_str: str) -> str:
|
|
return shlex.quote(input_str)
|
|
|
|
@staticmethod
|
|
def execute_command(command: str) -> Tuple[str, int]:
|
|
try:
|
|
result = subprocess.run(
|
|
command, shell=True, check=True, text=True, capture_output=True
|
|
)
|
|
return result.stdout, result.returncode
|
|
except subprocess.CalledProcessError as e:
|
|
return e.stdout, e.returncode
|