GithubHelp home page GithubHelp logo

spriteovo / sigmatch Goto Github PK

View Code? Open in Web Editor NEW
87.0 4.0 14.0 55 KB

✨ Modern C++ 20 signature match / search library

License: Apache License 2.0

CMake 4.69% C++ 95.31%
signature match search library binary binary-analysis assembler pattern cpp cpp20 cpp20-library cpp20-lib compile-time security reverse-engineering cpp-library header-only

sigmatch's Issues

Feature Request: compatibility with Ghidra instruction pattern search

Hello,

I'm curious if you'd be interested in making your tooling compatible with Ghidra's builtin instruction pattern search syntax, IE:

[01001...] 89 5c [..100100] 08 [01001...] 89 6c [..100100] 18 [01001...] 89 74 [..100100] 20 57 [01000...] 54 [01000...] 55 [01000...] 56 [01000...] 57 [01001...] 83 ec 70 [01001...] 8b [11......] [01000...] 32 [11......] [01001...] 8b [00...101] [........] [........] [........] [........] [01001...] 85 [11......] 74 [........] [01000...] 8b [10......] [........] [........] [........] [........] with full bytes in hex, binary bits within [ and ] and . as single bit wildcards... I'm not entirely sure why, but Ghidra seems to love to mask a lot of the instructions to a 5 bit wildcarded byte.

The original unmasked byte sequence for this was:

48 89 5c 24 08 48 89 6c 24 18 48 89 74 24 20 57 41 54 41 55 41 56 41 57 48 83 ec 70 48 8b e9 45 32 e4 48 8b 15 cf 11 f2 01 48 85 d2 74 2d 44 8b 89 a8 00 00 00

I was thinking about trying to add this in myself, but the newer C++ syntax is a bit out of my skill level at this point. Ghidra's instruction pattern search editor makes it very easy to find a good signature that matches well IMO.

C++ 20 Module Version

This is already a C++ 20 library so why not have a version of this library that comes as a single C++20 module interface definition file instead of a header, to benefit from faster compile times and other advantages modules have over headers.

Instead of a single header you would have a single .ixx (or whatever extension other compilers use, the extension doesn't matter)

Problems compiling on the latest version of msvc

C:\PROGRA~1\MICROS~3\2022\ENTERP~1\VC\Tools\MSVC\1437~1.328\bin\HostX64\x64\cl.exe   /TP  -IE:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP  /MD /O2 /Oi /Gy /DNDEBUG /Z7  -std:c++20 /showIncludes /Foexamples\CMakeFiles\02.custom_reader.dir\02.custom_reader.cpp.obj /Fdexamples\CMakeFiles\02.custom_reader.dir\ /FS -c E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\examples\02.custom_reader.cpp
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(624): error C2512: 'std::array<sigmatch::sig_byte,6>': no appropriate default constructor available
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(624): note: Invalid aggregate initialization
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(2926): note: while evaluating consteval function 'sigmatch::impl::parse_sig_str_compile_time'
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(624): note: the template instantiation context (the oldest one first) is
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\examples\02.custom_reader.cpp(105): note: see reference to function template instantiation 'sigmatch::signature sigmatch_literals::operator ""_sig<sigmatch::details::consteval_str_buffer<18>{sigmatch::details::consteval_str_buffer<18>::char_type49,65,32,50,66,32,63,63,32,63,63,32,53,69,32,54,70,0}>(void)' being compiled
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(2926): note: see reference to function template instantiation 'std::array<sigmatch::sig_byte,6> sigmatch::impl::parse_sig_str_compile_time<sigmatch::details::consteval_str_buffer<18>{sigmatch::details::consteval_str_buffer<18>::char_type49,65,32,50,66,32,63,63,32,63,63,32,53,69,32,54,70,0}>(void)' being compiled
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(1425): note: see reference to function template instantiation 'std::array<sigmatch::sig_byte,6> sigmatch::details::friendly_construct_array<sigmatch::sig_byte,6>(void) noexcept' being compiled
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(2926): error C7595: 'sigmatch::impl::parse_sig_str_compile_time': call to immediate function is not a constant expression
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(624): note: a non-constant (sub-)expression was encountered
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(2926): note: the call stack of the evaluation (the oldest call first) is
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(2926): note: while evaluating function 'std::array<sigmatch::sig_byte,6> sigmatch::impl::parse_sig_str_compile_time<sigmatch::details::consteval_str_buffer<18>{sigmatch::details::consteval_str_buffer<18>::char_type49,65,32,50,66,32,63,63,32,63,63,32,53,69,32,54,70,0}>(void)'
E:\vcpkg\buildtrees\sigmatch\src\v0.2.0-bf43ea0aed\include\sigmatch/sigmatch.hpp(1425): note: while evaluating function 'std::array<sigmatch::sig_byte,6> sigmatch::details::friendly_construct_array<sigmatch::sig_byte,6>(void) noexcept'

Environment:
windows 10
msvc 14.37.32822

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.