Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples in C++ #1223

Closed
Nitr0-G opened this issue Jan 11, 2023 · 7 comments
Closed

Examples in C++ #1223

Nitr0-G opened this issue Jan 11, 2023 · 7 comments

Comments

@Nitr0-G
Copy link

Nitr0-G commented Jan 11, 2023

Hello everyone!!

Where can I see examples of writing deobfuscators using triton in c++?
There are catastrophically few examples in C++ in the examples folder

@JonathanSalwan
Copy link
Owner

At least there are some...

@Nitr0-G
Copy link
Author

Nitr0-G commented Jan 11, 2023

At least there are some...

If I figure out Triton, there may be more examples ;)
Even a whole deobfuscator =)
But so far everything is going very tight

@SweetVishnya
Copy link
Contributor

@JonathanSalwan
Copy link
Owner

@Nitr0-G
Copy link
Author

Nitr0-G commented Jan 11, 2023

https://github.com/JonathanSalwan/Triton/wiki#deobfuscation

https://github.com/quarkslab/qsynthesis

Thank you!!!

How can I declare an array with obfuscated expressions in c++?
https://ibb.co/MhfVvdN
https://ibb.co/bQ8SqqL

In the case of this code, I get an error

int main() {
    triton::Context ctx;
    engines::symbolic::SharedSymbolicExpression obfs_expr{};

    ctx.setArchitecture(ARCH_X86_64);
    ctx.setAstRepresentationMode(ast::representations::PYTHON_REPRESENTATION);

    auto x = ctx.newSymbolicVariable(8, "x");
    auto y = ctx.newSymbolicVariable(8, "y");
    auto z = ctx.newSymbolicVariable(32, "z");
    auto c = ctx.newSymbolicVariable(32, "c");

    obfs_expr[2] = {
        x+y,
        z-c
    };

    return 0;
}

@Nitr0-G
Copy link
Author

Nitr0-G commented Jan 11, 2023

How can I output a synthesis string if it is not converted?
https://ibb.co/HT6PQgL
https://ibb.co/HgBvJyS

I get a "magnificent nothing" when I output it this way, otherwise what I get in synthesis is not converted

ctx.setAstRepresentationMode(ast::representations::PYTHON_REPRESENTATION);
printf("\nOut: %s",(string)ctx.synthesize(al,NULL,NULL,NULL));//Doesn't work
printf("\nOut: %s",ctx.synthesize(al,NULL,NULL,NULL));//magnificent nothing
cout << "\n Out: " << ctx.synthesize(al, NULL, NULL, NULL);//Doesn't work

The same

ctx.setAstRepresentationMode(ast::representations::PYTHON_REPRESENTATION);
auto RES = ctx.synthesize(al,NULL,NULL,NULL);
printf("\nOut: %s",(string)RES;//Doesn't work
printf("\nOut: %s",RES);//magnificent nothing
cout << "\n Out: " << RES;//Doesn't work

;-@JonathanSalwan
;-@JonathanSalwan
Comment puis-je sortir une chaîne de synthèse si elle n'est pas convertie?
https://ibb.co/HT6PQgL
https://ibb.co/HgBvJyS
J'obtiens un "magnifique rien" quand je le sors de cette façon, sinon ce que j'obtiens en synthèse n'est pas converti

ctx.setAstRepresentationMode(ast::representations::PYTHON_REPRESENTATION);
printf("\nOut: %s",(string)ctx.synthesize(al,NULL,NULL,NULL));//Ne fonctionne pas
printf("\nOut: %s",ctx.synthesize(al,NULL,NULL,NULL));//magnifique rien
cout << "\n Out: " << ctx.synthesize(al, NULL, NULL, NULL);//Ne fonctionne pas

Le même

ctx.setAstRepresentationMode(ast::representations::PYTHON_REPRESENTATION);
auto RES = ctx.synthesize(al,NULL,NULL,NULL);
printf("\nOut: %s",(string)RES;//Ne fonctionne pas
printf("\nOut: %s",RES);//magnifique rien
cout << "\n Out: " << RES;//Ne fonctionne pas

;-@SweetVishnya
;-@SweetVishnya
Как я могу вывести эту злоебучую строку?!
https://ibb.co/HT6PQgL
https://ibb.co/HgBvJyS
Ниже примеры, где я получаю нихуя,

ctx.setAstRepresentationMode(ast::representations::PYTHON_REPRESENTATION);
printf("\nOut: %s",(string)ctx.synthesize(al,NULL,NULL,NULL));//Не работает
printf("\nOut: %s",ctx.synthesize(al,NULL,NULL,NULL));//Нихуя
cout << "\n Out: " << ctx.synthesize(al, NULL, NULL, NULL);//Не работает

Такая же хуйня

ctx.setAstRepresentationMode(ast::representations::PYTHON_REPRESENTATION);
auto RES = ctx.synthesize(al,NULL,NULL,NULL);
printf("\nOut: %s",(string)RES;//Не работает
printf("\nOut: %s",RES);//Нихуя
cout << "\n Out: " << RES;//Не работает

@Nitr0-G
Copy link
Author

Nitr0-G commented Jan 12, 2023

I beat that bitch!
EXAMPLE USING TRITON IN OBSUCATED CODE ON C++(rewritten code from here #1074 - chapter "Working on obfuscated trace (emulate the code)"))
https://pastebin.com/LZjqJf00 - Triton using example on c++

@JonathanSalwan
Please add to the examples folder so the location!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:
https://github.com/JonathanSalwan/Triton/tree/master/src/examples/cpp

@Nitr0-G Nitr0-G closed this as completed Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants