MCPcopy
hub / github.com/MacRimi/ProxMenux / _run_cmd

Function _run_cmd

AppImage/scripts/security_manager.py:125–137  ·  view source on GitHub ↗

Run a shell command and return (returncode, stdout, stderr)

(cmd, timeout=10)

Source from the content-addressed store, hash-verified

123 return isinstance(value, str) and bool(_FW_IFACE_RE.match(value))
124
125def _run_cmd(cmd, timeout=10):
126 """Run a shell command and return (returncode, stdout, stderr)"""
127 try:
128 result = subprocess.run(
129 cmd, capture_output=True, text=True, timeout=timeout
130 )
131 return result.returncode, result.stdout.strip(), result.stderr.strip()
132 except subprocess.TimeoutExpired:
133 return -1, "", "Command timed out"
134 except FileNotFoundError:
135 return -1, "", f"Command not found: {cmd[0]}"
136 except Exception as e:
137 return -1, "", str(e)
138
139
140def get_firewall_status():

Callers 15

get_firewall_statusFunction · 0.85
add_firewall_ruleFunction · 0.85
edit_firewall_ruleFunction · 0.85
delete_firewall_ruleFunction · 0.85
add_monitor_port_ruleFunction · 0.85
remove_monitor_port_ruleFunction · 0.85
_set_firewall_enabledFunction · 0.85
get_fail2ban_detailsFunction · 0.85
update_jail_configFunction · 0.85
apply_missing_jailsFunction · 0.85
unban_ipFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected