GithubHelp home page GithubHelp logo

hoshimin / sig Goto Github PK

View Code? Open in Web Editor NEW
199.0 12.0 46.0 31 KB

The most powerful and customizable binary pattern scanner

License: MIT License

C++ 100.00%
signature signatures patterns pattern-matching pattern signature-recognition pattern-recognition signature-scanner sig-scan

sig's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sig's Issues

Cant compile with g++ version 11.1.0

Hi, i tried your example code and sadly cant compile it on linux with g++ 11.1.0 which is the newest for my distro.

I tried the following code:

#include "Sig.hpp"

#include <cassert>

static const unsigned char g_arr[]{
    '?', '?', '?', '?',
    0x11, 0x22, 0x33, 0x44};

int main()
{
    const void *const found1 = Sig::find<Sig::Dword<0x44332211>>(g_arr, sizeof(g_arr));

    const void *const found2 = Sig::find<
        Sig::Mask::Eq<'.'>,
        Sig::Mask::Any<'?'>>(g_arr, sizeof(g_arr), "\x11\x22\x00\x44", "..?.");

    const void *const found3 = Sig::find(g_arr, sizeof(g_arr), "11 22 ? 44");

    assert(found1 == &g_arr[4]);
    assert(found1 == found2);
    assert(found2 == found3);

    return 0;
}

and got these errors:

In file included from test.cpp:1:
Sig.hpp:297:15: error: explicit specialization in non-namespace scope ‘struct Sig’
  297 |     template <>
      |               ^
Sig.hpp:298:12: error: too few template-parameter-lists
  298 |     struct SetComparator<>
      |            ^~~~~~~~~~~~~~~
Sig.hpp:444:15: error: explicit specialization in non-namespace scope ‘struct Sig’
  444 |     template <>
      |               ^
Sig.hpp:445:12: error: too few template-parameter-lists
  445 |     struct Comparator<>
      |            ^~~~~~~~~~~~
Sig.hpp:822:15: error: explicit specialization in non-namespace scope ‘struct Sig’
  822 |     template <>
      |               ^
Sig.hpp:823:12: error: too few template-parameter-lists
  823 |     struct MaskComparator<>
      |            ^~~~~~~~~~~~~~~~
Sig.hpp: In instantiation of ‘static bool Sig::Comparator<Entry>::cmp(const void*) [with Entry = Sig::Holder<unsigned int, Sig::Cmp::Eq, 1144201745>]’:
Sig.hpp:464:60:   required from ‘static const void* Sig::find(const void*, size_t) [with Entries = {Sig::Holder<unsigned int, Sig::Cmp::Eq, 1144201745>}; size_t = long unsigned int]’
test.cpp:11:65:   required from here
Sig.hpp:403:45: error: no type named ‘cmp’ in ‘using Cmp = struct Sig::Cmp::Eq<unsigned int, 1144201745>’ {aka ‘struct Sig::Cmp::Eq<unsigned int, 1144201745>’}
  403 |                 return typename Entry::Cmp::cmp(pos);
      |                                             ^~~~~~~~
Sig.hpp: In instantiation of ‘static bool Sig::MaskComparator<Entry, Entries ...>::cmp(char, char, char) [with Entry = Sig::Mask::Any<'?'>; Entries = {}]’:
Sig.hpp:794:55:   required from ‘static bool Sig::MaskComparator<Entry, Entries ...>::cmp(char, char, char) [with Entry = Sig::Mask::Eq<'.'>; Entries = {Sig::Mask::Any<'?'>}]’
Sig.hpp:854:73:   required from ‘static const void* Sig::find(const void*, size_t, const char*, const char*, size_t) [with Comparators = {Sig::Mask::Eq<'.'>, Sig::Mask::Any<'?'>}; size_t = long unsigned int]’
Sig.hpp:882:36:   required from ‘static const void* Sig::find(const void*, size_t, const char*, const char*) [with Comparators = {Sig::Mask::Eq<'.'>, Sig::Mask::Any<'?'>}; size_t = long unsigned int]’
test.cpp:15:29:   required from here
Sig.hpp:794:55: error: ‘cmp’ is not a member of ‘Sig::MaskComparator<>’
  794 |                 return MaskComparator<Entries...>::cmp(data, pattern, mask);

[FEATURE REQUEST]

Respected Developer,
I appreciate your work so far. But the scanner is not able to detect more matches after it finds the first match. So for example I have an array
{0x00,0x13,0x00,0x56,0x00,0x13,0x66,0x77}
The algorithm can find 00 13 first offset, but not the next one.
If there are multiple matches, the program should return offsets for all of those matches.

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.