How can I decrypt Snapchat .nomedia files?

Muniza Siddiqui picture Muniza Siddiqui · Jul 14, 2016 · Viewed 9.3k times · Source

Recently, all of my Snapchat photos and videos got deleted, so I have been trying to get them back. Apparently, Snapchat stores photos/videos in a file, then hides that file using a .nomedia extension. However, to make it harder to find, we apparently need to decrypt Snapchat .nomedia files using this code:

#!/usr/bin/env ruby

require 'openssl'

data = File.open('blob', 'r:ASCII-8BIT').read
c = OpenSSL::Cipher.new('AES-128-ECB')
c.decrypt
c.key = 'M02cnQ51Ji97vwT4'
o = ''.force_encoding('ASCII-8BIT')
data.bytes.each_slice(16) { |s| o += c.update(s.map(&:chr).join) }
o += c.final
File.open('blob.jpg', 'w') { |f| f.write(o) }

Sadly, I have no idea what to do with this.

Answer

peter picture peter · Jul 14, 2016

You got this sample from

http://features.en.softonic.com/retrieve-deleted-snapchat-photos ?

but you will need to adapt some values like filename (with extension !), key etc. If all you files are store in an encrypted .nomedia file you would need to decrypt each file with the exact encryption key, not that from the sample. If you don't have the key I'm afraid you are lost, at the site linked they may callt he encyption weak, but even if you were an experienced coder, the challenge would be daunting.

I read something about hese files no longer being encrypted, so you could try renaming them with the correct file extension and opening them, good luck !

My advise: don't store files on snapshat to keep them, that's contrary to the purpose of snapshat, though on the new policy this is changing as it seems. Keep them local and on a backup and redundantly in the cloud on a remote storage like www.Box.com, Google drive, dropbox etc..