subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# 1. Fetch the logs using shell try: cmd = f"docker logs --tail {max_lines} {container_name}" result = subprocess.run(cmd, shell=True, capture_output=True, text=True) lines = result.stderr.splitlines() + result.stdout.splitlines() # Docker logs often hit stderr except Exception as e: return f"Error fetching logs: {str(e)}"- Confidence
- 98% confidence
- Finding
- result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
