#!/usr/bin/env ruby
##
# Copyright 2013 Adam Caudill <adam@adamcaudill.com>
#
# Decodes Evernote password recovered from Evernote for Android config file:
# File: /data/data/com.evernote/shared_prefs/com.evernote_preferences.xml
# (may also be in <userid>.prof.xml if missing from com.evernote_preferences.xml)
# Password: <string name="encrypted_password">
# Username: <string name="username">
##
require "base64"
if ARGV.count != 2
puts 'Usage: ./evernote_pass_decode.rb <pass> <username>'
end
pass = Base64.decode64(ARGV[0])
user = ARGV[1]
final = ''
pass.bytes.each_with_index do |byte, index|
final += (byte ^ user[index % user.length].unpack('c')[0]).chr
end
puts "Password: #{final}"