bandit/examples/os-chmod-py2.py
Eric Brown 38ac37ce65 bad_file_permissions check: Use correct filename
This bumps test coverage of general_bad_file_permissions from 33%
to 93%.

Change-Id: I3a1b7be042fc8b34e99bd3b9564893d7d993dbca
2015-09-04 14:58:49 -07:00

18 lines
403 B
Python

import os
import stat
keyfile = 'foo'
os.chmod('/etc/passwd', 0227)
os.chmod('/etc/passwd', 07)
os.chmod('/etc/passwd', 0664)
os.chmod('/etc/passwd', 0777)
os.chmod('/etc/passwd', 0o770)
os.chmod('/etc/passwd', 0o776)
os.chmod('/etc/passwd', 0o760)
os.chmod('~/.bashrc', 511)
os.chmod('/etc/hosts', 0o777)
os.chmod('/tmp/oh_hai', 0x1ff)
os.chmod('/etc/passwd', stat.S_IRWXU)
os.chmod(key_file, 0o777)