Skip to content

Instantly share code, notes, and snippets.

@OsandaMalith
Last active June 14, 2016 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OsandaMalith/bf4cb8694b0b1cccdafa40217ff06184 to your computer and use it in GitHub Desktop.
Save OsandaMalith/bf4cb8694b0b1cccdafa40217ff06184 to your computer and use it in GitHub Desktop.
Solution 1 for hasharazade's birthday crackme :)
#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