Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
946 stars 214 forks source link

Option for simplifying boolean comparisons in HLIL #4137

Open op2786 opened 1 year ago

op2786 commented 1 year ago

Is it possible to have an option that simplifies boolean comparisons like this examples:

Option disabled (current output):

if (IsUserAnAdmin() == 0 && check_if_elevated() != 1) {
...
if (stb.bypass_uac != 0 && check_if_elevated() != 1) {
...
if (stb.enable_guard != 0) {
...
if (IsWow64Process(GetCurrentProcess(), &Wow64Process) != 0) {
...
if (data_41e694 == 0) {
...
if (is_guard_active(&stc->stb) != 0) {

Option Enabled:

if (!IsUserAnAdmin() && !check_if_elevated()) {
...
if (stb.bypass_uac && !check_if_elevated())
...
if (stb.enable_guard) {
...
if (IsWow64Process(GetCurrentProcess(), &Wow64Process)) {
...
if (!data_41e694) {
...
if (is_guard_active(&stc->stb)) {

I could show more examples, but I think that's enough to tell what I mean.

ccarpenter04 commented 1 year ago

It would clean up the output considerably and I can't think of any downsides as long as it's a toggle.

plafosse commented 3 weeks ago

We now do this by default in PseudoC image