如何对其进行反混淆[按位异或的条件语句]

发布于 2024-11-24 08:36:33 字数 366 浏览 2 评论 0原文

这相当于什么

if(~(i3 + -1) < -1) { ... }

如果没有 ixor ~

?会是这个吗?

if((i3 + 1) > 0)  { ... }

或(怀疑这一点?)

if((i3 + 0) > 0)  { ... }

或(怀疑这一点?)

if(i3 < -1)  { ... }

谢谢,我自己无法真正测试它,我可以..但我正在编写一个反混淆器,我想百分百确定。

Whats the equivalent of this without ixor ~

if(~(i3 + -1) < -1) { ... }

.

would it be this?

if((i3 + 1) > 0)  { ... }

or (doubt this?)

if((i3 + 0) > 0)  { ... }

or (doubt this?)

if(i3 < -1)  { ... }

Thanks I cannot really test it out myself well I can.. but I'm writing a deobfuscator and I want to be 100% sure.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浸婚纱 2024-12-01 08:36:38

~x 实际上是 -x - 1
因此,-(i3 - 1) 等价于 -(i3 - 1) - 1 ,而 cih 等于 -i3
所以,

if(~(i3 + -1) < -1) { ... } 

等价于:

if(-i3 < -1) { ... } // or simply if(i3 > 1) { ... }

~x is actually -x - 1
Hence, -(i3 - 1) is equivalent to -(i3 - 1) - 1 whcih is equal to -i3
So,

if(~(i3 + -1) < -1) { ... } 

is equivalent to:

if(-i3 < -1) { ... } // or simply if(i3 > 1) { ... }
晨与橙与城 2024-12-01 08:36:37

首先,我假设这是 Java,并且 i3 是一个 int (与 byteshort 的工作方式相同),或)。

i3 + -1i3-1,它只是某个整数。
~ 是按位非。所以我们减一并否定所有位。这与二进制补码数字相反。 (对二进制补码取反通常是通过加 1 然后求补来完成)。幸运的是,这个运算是它自己的逆运算,所以做相反的操作也是对数字的 2 补码求反的一种方法。所以我们最终得到了 -i3

你只剩下 -i3 < -1i3 > 相同1 这是尽可能清晰的。

First of all, I'm assuming this is Java and that i3 is an int (would work the same with byte, short, or long).

i3 + -1 is i3-1 which is just going to be some integer.
~ is bitwise not. So we've subtracted one and negated all the bits. This is the exact opposite of negating a two's complement number. (Negating a two's complement is usually done by adding 1 then complementing). Fortunately this operation is its own inverse, so doing the opposite is also a way to negate a 2's complement of a number. So we've ended up with just -i3.

You're left with -i3 < -1 which is the same as i3 > 1 which is as unobfuscated as it can get.

海之角 2024-12-01 08:36:36

~xx按位(非逻辑)反转。在二进制补码中,它等于-1 - x。尝试一下。

~0  = -1 -  0 = -1
~-1 = -1 - -1 = 0
~1  = -1 -  1 = -2

现在,将其应用到您的条件中:

-1 - (i3 - 1) < -1
-1 - i3 + 1   < -1   # commutative property of multiplication
   - i3       < -1   # 1 + -1 == 0
     i3       >  1   # * -1 inverts everything, including the inequality

注意,这仅适用于数字是二进制补码的情况 - 但现在几乎所有 CPU(以及大多数编程语言)都以这种方式运行。

~x is the bitwise (not logical) inversion of x. In two's complement, it is equal to -1 - x. Try it.

~0  = -1 -  0 = -1
~-1 = -1 - -1 = 0
~1  = -1 -  1 = -2

Now, to apply this to your condition:

-1 - (i3 - 1) < -1
-1 - i3 + 1   < -1   # commutative property of multiplication
   - i3       < -1   # 1 + -1 == 0
     i3       >  1   # * -1 inverts everything, including the inequality

Note, this only applies if the numbers are two's complement -- but almost all CPUs (and most programming languages) behave that way these days.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文