smallnet/new_guest_password.py

21 lines
454 B
Python
Raw Normal View History

2015-11-02 18:08:11 -05:00
#!/usr/bin/env python3
import random
import os
newpass = ''.join(random.sample('abcdfghjkmnpqrstuvwxyz',8))
f = open("/etc/freeradius/users.dpto2")
lines = f.readlines()
f.close()
f = open("/etc/freeradius/users.dpto2","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/reload_freeradius")