20 lines
454 B
Python
Executable file
20 lines
454 B
Python
Executable file
#!/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")
|