selinux/sandbox/start
Vit Mojzis 94389f2102 python: Harden more tools against "rogue" modules
Python scripts present in the same directory as the tool
override regular modules.

Fixes:
      #cat > /usr/bin/signal.py <<EOF
      import sys
      print("BAD GUY!", file=sys.stderr)
      sys.exit(1)
      EOF
      #sandbox date
      BAD GUY!

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
Acked-by: James Carter <jwcart2@gmail.com>
2023-12-12 10:26:50 -05:00

14 lines
250 B
Python

#!/usr/bin/python3 -EsI
try:
from subprocess import getstatusoutput
except ImportError:
from commands import getstatusoutput
import sys
rc = [-1, '']
try:
rc = getstatusoutput(sys.argv[1])
except:
pass
if rc[0] == 0:
print(rc[1])