Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to decrypt images #2

Open
asanakoy opened this issue Apr 19, 2017 · 6 comments
Open

How to decrypt images #2

asanakoy opened this issue Apr 19, 2017 · 6 comments

Comments

@asanakoy
Copy link

Hi,

Google art stores images in encrypted format. I think the haven't changed the encryption algorithm till today.
For example image.
I have seen in your core.py some functions that decrypt images. Could you please explain how this decryption works?

@asanakoy asanakoy changed the title Decrypt images How to decrypt images Apr 19, 2017
@expenses
Copy link

expenses commented May 1, 2017

I've been working on this as well.

Try decrypterFragment. It takes the bytes of the image, decrypts them and then returns them.

Use it like this:

from extractionGoogleArtProject_Unix import decrypterFragment

input = "encrypted.jpg"
output = "decrypted.jpg"

fragment = open(input, "rb").read()
fragment = decrypterFragment(fragment)
open(output, "wb").write(fragment)

Google art stores images in encrypted format. I think the haven't changed the encryption algorithm till today.

I'm not sure what you mean by this, but I'm not sure if it'll work for all images.

I don't really know how the decryption works, I think @EmelyanenkoK just copied it right out of the minified javascript of the website - that's why the code is written so unobviously.

As far as I've been able to tell so far, the files aren't really encrypted - it's just that 4 bytes have been added at the start and the ends and their huffman tables have been messed up. Use a hex editor like Hex Fiend to compare the files:

untitled

If you're really interested, here are the jpeg marker bytes.

I presume that this function just undoes those changes. I'll try digging into it to see if I can understand it. Email me at expenses@airmail.cc or post in this thread I guess if you want to know more!

@expenses
Copy link

expenses commented May 1, 2017

Update: I've made an attempt to understand the decrypt function and make it more explicit, see my fork here: https://github.com/expenses/GAPDownloader/blob/master/core.py#L240

@asanakoy
Copy link
Author

asanakoy commented May 1, 2017

@expenses This is awesome! Thanks for a great effort! Your function makes perfect sense now.

@expenses
Copy link

expenses commented May 1, 2017

@asanakoy No problem! I'm still working on it, mostly to understand it and see if I can speed it somehow.

@asanakoy
Copy link
Author

asanakoy commented May 1, 2017

@expenses if you are interested in scraping the data from googleart on a large scale take a look at my scraper https://github.com/asanakoy/googleart_scraper.
But I donwload small images, not zoomed in, and a lot of metadata.

@EmelyanenkoK
Copy link
Owner

@expenses
I just translate obfuscated js-code from GAP to python, so it is indeed very messy. However in 24hours after I publish code on github, google have changed something in data encryption.
Since I only needed a few images at that moment and I already got it, I abandoned this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants