Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[C++] PatternFind (Pattern Find + Search & Replace)

Featured Replies

Posted

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 23
Feel 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. eXoDia

PatternFindUpdate.rar

  • 5 weeks later...

Mr. eXoDia


How to compile this source code, sory newbie.


Edited by newbie_newbe

  • Author

@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

Ooooh..... Ok Thank you


  • 1 month later...
  • 1 month later...

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 by electroglyph

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.