sonic-buildimage/device/centec/arm64-centec_e530_48s4x-r0/platform_reboot
Mai Bui 3cd9b2e1b5
[device/centec] Replace os.system and remove subprocess with shell=True (#12024)
Signed-off-by: maipbui <maibui@microsoft.com>
#### Why I did it
`subprocess.Popen()` and `subprocess.run()` is used with `shell=True`, which is very dangerous for shell injection.
`os` - not secure against maliciously constructed input and dangerous if used to evaluate dynamic content
#### How I did it
Replace `os` by `subprocess`, remove `shell=True`
Remove unused functions
2022-10-07 10:48:25 -04:00

13 lines
325 B
Python
Executable File

#!/usr/bin/python
import subprocess
def main():
# reboot the system
subprocess.call(['modprobe', 'i2c-dev'])
subprocess.call(['i2cset', '-y', '0', '0x36', '0x23', '0x0'])
subprocess.call(['sleep', '1'])
subprocess.call(['i2cset', '-y', '0', '0x36', '0x23', '0x3'])
if __name__ == "__main__":
main()