def get_serials1(path=STORAGE1):
 if (not os.path.isfile(path)):
  return []
 storage = parse_preference(path)
 salt = storage.get('AmazonSaltKey')
 if (salt and (len(salt) == 16)):
  obfuscation = AndroidObfuscationV2(a2b_hex(salt))
 else:
  obfuscation = AndroidObfuscation()
 def get_value(key):
  encrypted_key = obfuscation.encrypt(key)
  encrypted_value = storage.get(encrypted_key)
  if encrypted_value:
   return obfuscation.decrypt(encrypted_value)
  return ''
 try:
  dsnid = get_value('DsnId')
 except:
  sys.stderr.write('cannot get DsnId\n')
  return []
 try:
  tokens = set(get_value('kindle.account.tokens').split(','))
 except:
  return []
 serials = []
 if dsnid:
  serials.append(dsnid)
 for token in tokens:
  if token:
   serials.append(('%s%s' % (dsnid, token)))
   serials.append(token)
 return serials

def get_serials1 ( path = STORAGE1 ) : if ( not os . path . isfile ( path ) ) : return [ ] storage = parse_preference ( path ) salt = storage . get ( 'AmazonSaltKey' ) if ( salt and ( len ( salt ) == 16 ) ) : obfuscation = AndroidObfuscationV2 ( a2b_hex ( salt ) ) else : obfuscation = AndroidObfuscation ( ) def get_value ( key ) : encrypted_key = obfuscation . encrypt ( key ) encrypted_value = storage . get ( encrypted_key ) if encrypted_value : return obfuscation . decrypt ( encrypted_value ) return '' try : dsnid = get_value ( 'DsnId' ) except : sys . stderr . write ( 'cannot get DsnId\n' ) return [ ] try : tokens = set ( get_value ( 'kindle.account.tokens' ) . split ( ',' ) ) except : return [ ] serials = [ ] if dsnid : serials . append ( dsnid ) for token in tokens : if token : serials . append ( ( '%s%s' % ( dsnid , token ) ) ) serials . append ( token ) return serials
get serials from androids shared preference xml .