-1

I am working on a scraper and I got stuck trying to figure out a base64 encrypted data being passed through AJAX that contains a products Size and Color information.

Sample product URL: http://merchant.com/MARC-by-Marc-Jacobs-Orion-Metallic-Taffeta-1950s-Dress-Black/prod174690614/p.prod?eVar4=You%20May%20Also%20Like&RST=CategorySiloedViewCP

Using Fiddler, I can see that it calls an AJAX service to retrieve the sizes and colors for this product: http://merchant.com/productserviceAJAX

It passes the following string: data=$b64$eyJQcm9kdWN0U2l6ZUFuZENvbG9yIjp7InByb2R1Y3RJZHMiOiJwcm9kMTc0NjkwNjE0In19&timestamp=1424678606863

I need to be able to determine how to recreate the above string to be able to pass it to the service and I can get the returned JSON string from the AJAX call.

shifter
  • 143
  • 1
  • 13

1 Answers1

2

That's not an encryption, that's an encoding. Decode the base64 string, e.g. using an online tool and look at the result:

{"ProductSizeAndColor":{"productIds":"prod174690614"}}

This is a JSON expression, the product ID appears in your Sample product URL, so you should be able to construct a Base64 string from a given URL using C# Base64 methods.

Community
  • 1
  • 1
schnaader
  • 49,103
  • 10
  • 104
  • 136
  • How did you come up with the result? I did try using that tool earlier, I must have given it the wrong string to decode. What string did you use? – shifter Feb 23 '15 at 08:36
  • LOL thanks figured it out, I encoded the JSON you gave and found the string I was asking for, GENIUS! – shifter Feb 23 '15 at 08:47
  • 1
    I used the string between the second `$` sign and the `&` sign: `eyJQcm9kdWN0U2l6ZUFuZENvbG9yIjp7InByb2R1Y3RJZHMiOiJwcm9kMTc0NjkwNjE0In19` – schnaader Feb 23 '15 at 10:04