def save_password(password, port):
 password_file = abspath(('parameters_%i.py' % port))
 if (password == '<random>'):
  chars = (string.letters + string.digits)
  password = ''.join([random.choice(chars) for _ in range(8)])
  cpassword = CRYPT()(password)[0]
  print('******************* IMPORTANT!!! ************************')
  print(('your admin password is "%s"' % password))
  print('*********************************************************')
 elif (password == '<recycle>'):
  if exists(password_file):
   return
  else:
   password = ''
 elif password.startswith('<pam_user:'):
  cpassword = password[1:(-1)]
 else:
  cpassword = CRYPT()(password)[0]
 fp = open(password_file, 'w')
 if password:
  fp.write(('password="%s"\n' % cpassword))
 else:
  fp.write('password=None\n')
 fp.close()

def save_password ( password , port ) : password_file = abspath ( ( 'parameters_%i.py' % port ) ) if ( password == '<random>' ) : chars = ( string . letters + string . digits ) password = '' . join ( [ random . choice ( chars ) for _ in range ( 8 ) ] ) cpassword = CRYPT ( ) ( password ) [ 0 ] print ( '******************* IMPORTANT!!! ************************' ) print ( ( 'your admin password is "%s"' % password ) ) print ( '*********************************************************' ) elif ( password == '<recycle>' ) : if exists ( password_file ) : return else : password = '' elif password . startswith ( '<pam_user:' ) : cpassword = password [ 1 : ( - 1 ) ] else : cpassword = CRYPT ( ) ( password ) [ 0 ] fp = open ( password_file , 'w' ) if password : fp . write ( ( 'password="%s"\n' % cpassword ) ) else : fp . write ( 'password=None\n' ) fp . close ( )
used by main() to save the password in the parameters_port .