2

I have a simple function which looks like that:

keyAlphabet = [-1, 16, 32, 127, 61, -32, -31, 43, 0, 88, 2, 5, 7, 112, 64, 69, 96]
key = ??? # only keyAlphabet values
p = 0x1337
for i in key:
...p*=i
...p+=0x31337

Finally p should be 0xfd0970e7.

I've tried to subtract 0x31337 from the final result and search dividers of that value from the keyAlphabet (I've done that operation 8 times and after that multiple dividers came out, 0x12ef1e can be divided with 2,7 and 61), but because of negative values (specially -1) I'm not sure where should I change the sign. As a result I'm not able to find the key which will proceed values from 0x1337 into 0xfd0970e7.

  • I assume original code is in assembly. Care to share that? Nuances might be lost in translation – NirIzr Aug 22 '16 at 16:05
  • @NirIzr here's the binary I've disassembled github.com/wapiflapi/exrs/blob/master/reverse/r9 – desu Aug 22 '16 at 18:07
  • @NirIzr and here's pseudo-code pastebin.com/3NkB3h6S. I runned this binary with chars possible to pass as argument and received this key alphabet – desu Aug 22 '16 at 18:10
  • pseudocode shows every iteration in the last loop (the one you pasted python code for) has a different key. it iterates all possible values. i think that if keyAlphabet is actually var_18, you should have something like keyAlphabet.reverse() ; for key in keyAlphabet: – NirIzr Aug 22 '16 at 23:29
  • 1
    @mayahustle unless random() is seeded with the same seed on every execution ;) – NirIzr Aug 24 '16 at 8:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.