smallnet/new_guest_password.py

23 lines
446 B
Python
Executable file

#!/usr/bin/env python3
import random
import os
from main import users_file
newpass = ''.join(random.sample('abcdfghjkmnpqrstuvwxyz',8))
f = open(users_file)
lines = f.readlines()
f.close()
f = open(users_file,"w")
for line in lines:
if line.startswith("guest"):
f.write('guest Cleartext-Password := "{}"\n'.format(newpass))
else:
f.write(line)
f.close()
os.system("/home/ateijelo/programs/dpto2/sendhup freeradius")