Compare commits
No commits in common. "0be4944a74868544215a09440cf2ec383ded7574" and "42056f3df653c46a684268cf5bbfb6b8e67d94b1" have entirely different histories.
0be4944a74
...
42056f3df6
1 changed files with 6 additions and 6 deletions
12
app.py
12
app.py
|
|
@ -1209,15 +1209,15 @@ SYSCTL_AUDIT_KEYS = (
|
|||
|
||||
|
||||
def _sysctl_audit_command() -> str:
|
||||
script = f'''import glob, json
|
||||
from pathlib import Path
|
||||
script = f'''import glob, json, subprocess
|
||||
keys = {SYSCTL_AUDIT_KEYS!r}
|
||||
live, errors = {{}}, {{}}
|
||||
for key in keys:
|
||||
try:
|
||||
live[key] = Path("/proc/sys/" + key.replace(".", "/")).read_text().strip()
|
||||
except OSError as exc:
|
||||
errors[key] = str(exc)[:160]
|
||||
result = subprocess.run(["sysctl", "-n", key], capture_output=True, text=True)
|
||||
if result.returncode == 0:
|
||||
live[key] = result.stdout.strip()
|
||||
else:
|
||||
errors[key] = result.stderr.strip()[:160]
|
||||
persistent = {{}}
|
||||
for path in ["/etc/sysctl.conf", *sorted(glob.glob("/etc/sysctl.d/*.conf"))]:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue