mrexodia Posted May 18, 2014 Posted May 18, 2014 Hello everyone,For x64_dbg I had to create a pattern finder and mudlord asked me to extend it with a pattern search & replace ability.Example of usage:#include "patternfind.h"int main(int argc, char* argv[]){ unsigned char data[0x100]; memcpy(data, main, sizeof(data)); //find pattern offset size_t found = patternfind(data, sizeof(data), "68 ?? ?1 0? 00"); printf("found: main+%p\n", found); if(found==-1) //not found return 0; //print current data for(int i=0; i<5; i++) printf("%.2X ", data[found+i]); puts(""); //search & replace if(!patternsnr(data, sizeof(data), "68 ?? ?1 0? 00", "?? ?1 1? 21 23")) return 0; //search & replace failed //print replaced data for(int i=0; i<5; i++) printf("%.2X ", data[found+i]); puts(""); return 0;}Output:found: main+0000002668 00 01 00 0068 01 11 21 23Feel free to use it wherever you like, credit (link to http://x64dbg.com) is appreciated, but not required. Attached the full source (only ~150 lines)Greetings,Mr. eXoDiaPatternFindUpdate.rar 7
newbie_newbe Posted June 18, 2014 Posted June 18, 2014 (edited) Mr. eXoDiaHow to compile this source code, sory newbie. Edited June 18, 2014 by newbie_newbe
mrexodia Posted June 19, 2014 Author Posted June 19, 2014 @newbie_newbe: just add the .cpp and .h file to your coding project and include the .h file. This is not useful if you want some GUI or anything, just for coding projects that require a pattern searcher. Greetings
mrexodia Posted August 16, 2014 Author Posted August 16, 2014 Latest version will always be here: https://bitbucket.org/mrexodia/patternfind
TiLT Posted October 15, 2014 Posted October 15, 2014 (edited) thanks, it's nicer than the code i use. i wrote a little tool that uses BeaEngine to hook anywhere in code, and i use a few different pattern matching algorithms to find my hook targets. Edited October 15, 2014 by electroglyph
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now