Last active
June 14, 2016 14:32
-
-
Save OsandaMalith/bf4cb8694b0b1cccdafa40217ff06184 to your computer and use it in GitHub Desktop.
Solution 1 for hasharazade's birthday crackme :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <string> | |
#include <iostream> | |
#include <fstream> | |
/* | |
* Author : Osanda Malith Jayathissa (@OsandaMalith) | |
*/ | |
using namespace std; | |
int valid( char *str) { | |
char String[100]; | |
strcpy_s(String, str); | |
unsigned int var; | |
_asm { | |
lea esi, [String] | |
xor eax, eax | |
mov[var], eax | |
mov ebx, 0 | |
mov ecx, 4 | |
_loop: | |
test ecx, ecx | |
jz _finish | |
xor byte ptr[var + 1], ah | |
lodsw | |
dec ecx | |
add[var], eax | |
jmp _loop | |
_finish : | |
} | |
return var; | |
} | |
int main(int argc, char const *argv[]) { | |
string line; | |
ifstream myfile("my1.txt"); | |
if (myfile.is_open()) | |
{ | |
while (getline(myfile, line)) | |
if (valid((char *)line.c_str()) == 0x39a) | |
cout << line.c_str() << endl; | |
myfile.close(); | |
} | |
else cout << "Unable to open file"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment