As i find that some java jar using a boolean
variable to decide whether output the log, the example is as follow:
public final class a {
private static boolean a = false;
private static boolean b = false;
private static Logger c;
public static void a(String var0, String var1) {
if(a) {
var0 = "Log-" + var0;
if(b && c != null) {
c.log(Level.INFO, var0 + ": " + var1);
} else {
Log.v(var0, var1);
}
}
}
the above code is decompiled by Intellij idea. Since:
- There is no source code, only
jar
file includes.class
files - The code is obfuscated(as you see the member variable is all a, b, c), so can reflection work?
Here i want to modify the member private static boolean a
,change from false
to true
in order to output the log. I try jclasslib
but i can only get the variables as org.gjt.jclasslib.structures.FieldInfo
object, i can not find a way to modify its value. Can anyone help?
Second, i write a class that defines a boolean
variable like:
public class BroadcastHook {
private static boolean testBoolean=true;
What confuses me is that whether the testBoolean
is true
or false
, the testBoolean
Fields
is same in Bytecode viewer
, below is the screenshots
Why can't i find the false value of testBoolean
in Fields?
You need to find the right one but the change is simple:
To change the boolean variable from
true
tofalse
hex edit a0x04
to0x03
.