SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <stdio.h> | |
| 2 | ||
| 3 | ||
| 4 | char buf[4096]; | |
| 5 | ||
| 6 | void decrypt(char *mem, int len, char initial, char step) {
| |
| 7 | - | int x = 170, i=0, r2=0;; |
| 7 | + | int i=0; |
| 8 | char x = initial; | |
| 9 | for(i=0; i<len; i++) | |
| 10 | - | FILE *in = fopen("dump.bin", "r"); // file to open (vm code dump)
|
| 10 | + | |
| 11 | mem[i] ^= x; | |
| 12 | - | for(i=0x100; i<0x100+0x80; i++) |
| 12 | + | x+=step; |
| 13 | } | |
| 14 | - | char c = buf[i]; |
| 14 | + | |
| 15 | - | printf("%c", c^x);
|
| 15 | + | |
| 16 | - | x++; |
| 16 | + | |
| 17 | int i=0; | |
| 18 | // decode next decrypt code | |
| 19 | - | // decrypt next sequence (GET) |
| 19 | + | FILE *in = fopen("initial", "r");
|
| 20 | - | r2=0; |
| 20 | + | |
| 21 | - | x = 50; |
| 21 | + | |
| 22 | - | char c; |
| 22 | + | decrypt(buf+0x100, 0x80, 170, 1); // decrypt first decryptor at 0x100 |
| 23 | - | do {
|
| 23 | + | decrypt(buf+0x1c0, 0x1F2 - 0x1C0, 50, 3); // decrypt get string |
| 24 | - | c = buf[0x1c0 + r2]; |
| 24 | + | |
| 25 | - | c ^= x; |
| 25 | + | //dump memory |
| 26 | - | buf[0x1c0+r2] = c; |
| 26 | + | |
| 27 | - | r2++; |
| 27 | + | |
| 28 | - | x+=3; |
| 28 | + | } |
| 29 | - | //if(r2==0) jump x |
| 29 | + |