I received this string as a response from a private API of a sports betting site: https://sport.synottip.cz:
CoEECv4DCvsDCgwKAjEyEgZGb3RiYWwYvwYi5wMKGAoDeDQ0Eg1NZXppbsOhcm9kbsOtGgIxMhLKAwrHAwoGeHgxMjc4EhhLdmFsaWZpa2FjZSBNUywgQ09OTUVCT0waA3g0NCqdAwjUt4wBEhVWZW5lenVlbGEgLSBBcmdlbnRpbmEiBwiAq6TFpzIqCDUzNjI0NjQ5Mt4CCDsSDkhsYXZuw60gc8Ohemt5GmoKCzJkMjIzNTI4MzQ5EgZaw6FwYXMyTwidi8tqEgZaw6FwYXMYkF8iEwoJNDg4Mzg5ODMyEgExHdejsEAiEwoJNDg4Mzg5ODMzEgEwHSlcf0AiEwoJNDg4Mzg5ODM0EgEyHbgexT9YAmACGm8KCzNkMjIzNTI4MzUwEgdEdm9qdGlwMlMInovLahIHRHZvanRpcBiSXyIUCgk0ODgzODk4MjgSAjEwHR+FC0AiFAoJNDg4Mzg5ODI5EgIxMh1I4Zo/IhQKCTQ4ODM4OTgzMBICMDIdheuRP1gBYAIabQoLNGQyMjM1MjgzNTESElPDoXprYSBiZXogcmVtw616eTJGCJ+Ly2oSElPDoXprYSBiZXogcmVtw616eRiTXyITCgk0ODgzODk4MzESATEdcT16QCITCgk0ODgzODk4MzUSATIdmpmZP1gBYAI6Bnh4MTI3OFADYL8G
This string is supposed to be encoded data about a match and the odds. I would appreciate any help with extracting the data.
I already found this great website, and I think the first step I need to take is to base64 decode the string. This will give me the binary data.
It looks like the second step should be to Protobuf decode the data. After that, I am getting a fairly solid JSON output. However, the issue is that where I expect to find the odds, there are only very large numbers. Based on data from the website, I believe that the numbers in the received JSON should correspond to these decimal odds:
1085318103 equals 5,52
1082088489 equals 3,99
1069883064 equals 1,54
1074496799 equals 2,18
1067114824 equals 1,21
1066527621 equals 1,14
1081752945 equals 3,91
1067030938 equals 1,20
I also found some information abou the API here: https://sport.synottip.cz/WebServices/Api/SportsBettingService.svc/help. I am interested in the GetWebStandardEvents
and GetWebStandardEventExt
calls.
Can anyone help me with the final steps? I prefer docoding it in Python, but help works. Thank you.
2
Answers
Caveat: This is only a partial answer and not complete but too much for a comment
The numbers are a 32 bit integer representation of 32 bit IEEE 754 single precision floating point numbers and can be converted to the appropriate values using the aforementioned CyberChef. Exactly how you would do this in Python is beyond me as it’s not a programming language I’m familiar with.
The recipe can be found here Link to working recipe in CyberChef
You are decoding a binary
float32
as anint32
. You will need to pack the number back into aint32
(long
) and then unpack as afloat32
(float
). You can use thestruct
module for that.However, the final solution would be to decode the binary number as a float32 in the Protobuf decoding step.
For additional polish:
will pack the long as a binary, unpack the binary as a float, extract the first item of the tuple and round to two digits.