def generate_secret():
 import rsa
 print '[*] Generating secret, please hang on.'
 (pubkey, privkey) = rsa.newkeys(2048)
 priv_key_file = open(CONFIG['MobSF']['priv_key'], 'w')
 priv_key_file.write(privkey.save_pkcs1().decode('utf-8'))
 priv_key_file.close()
 pub_key_file = open(CONFIG['MobSF']['pub_key'], 'w')
 pub_key_file.write(pubkey.save_pkcs1().decode('utf-8'))
 pub_key_file.close()
 print '[!] Please move the private key file\n DCTB {}\n DCTB to MobSF to the path specified in settings.py\n DCTB (default: Mobile-Security-Framework-MobSF/MobSF/windows_vm_priv_key.asc)'.format(CONFIG['MobSF']['priv_key'])
 if (sys.version_info.major == 3):
  input('Please press any key when done..')
 elif (sys.version_info.major == 2):
  raw_input('Please press any key when done..')

def generate_secret ( ) : import rsa print '[*] Generating secret, please hang on.' ( pubkey , privkey ) = rsa . newkeys ( 2048 ) priv_key_file = open ( CONFIG [ 'MobSF' ] [ 'priv_key' ] , 'w' ) priv_key_file . write ( privkey . save_pkcs1 ( ) . decode ( 'utf-8' ) ) priv_key_file . close ( ) pub_key_file = open ( CONFIG [ 'MobSF' ] [ 'pub_key' ] , 'w' ) pub_key_file . write ( pubkey . save_pkcs1 ( ) . decode ( 'utf-8' ) ) pub_key_file . close ( ) print '[!] Please move the private key file\n DCTB {}\n DCTB to MobSF to the path specified in settings.py\n DCTB (default: Mobile-Security-Framework-MobSF/MobSF/windows_vm_priv_key.asc)' . format ( CONFIG [ 'MobSF' ] [ 'priv_key' ] ) if ( sys . version_info . major == 3 ) : input ( 'Please press any key when done..' ) elif ( sys . version_info . major == 2 ) : raw_input ( 'Please press any key when done..' )
make a secret key suitable for use in totp .