subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def _run_cmd(cmd: str, timeout: int = 60) -> str: """Run *cmd* via shell, return stdout+stderr stripped; empty string on any failure.""" try: return subprocess.check_output( cmd, shell=True, stderr=subprocess.STDOUT, text=True, timeout=timeout ).strip() except Exception:- Confidence
- 98% confidence
- Finding
- return subprocess.check_output( cmd, shell=True, stderr=subprocess.STDOUT, text=True, timeout=timeout ).strip()
