Update new_guest_password
This commit is contained in:
parent
d5fa80675f
commit
19a3a7f64b
1 changed files with 5 additions and 3 deletions
|
@ -3,13 +3,15 @@
|
|||
import random
|
||||
import os
|
||||
|
||||
from main import users_file
|
||||
|
||||
newpass = ''.join(random.sample('abcdfghjkmnpqrstuvwxyz',8))
|
||||
|
||||
f = open("/etc/freeradius/users.dpto2")
|
||||
f = open(users_file)
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
|
||||
f = open("/etc/freeradius/users.dpto2","w")
|
||||
f = open(users_file,"w")
|
||||
for line in lines:
|
||||
if line.startswith("guest"):
|
||||
f.write('guest Cleartext-Password := "{}"\n'.format(newpass))
|
||||
|
@ -17,4 +19,4 @@ for line in lines:
|
|||
f.write(line)
|
||||
f.close()
|
||||
|
||||
os.system("/home/ateijelo/programs/dpto2/reload_freeradius")
|
||||
os.system("/home/ateijelo/programs/dpto2/sendhup freeradius")
|
||||
|
|
Loading…
Reference in a new issue