Obfuscation is a technique used to deliberately make code or data difficult to read and understand. It is often used for:
Reversing obfuscation depends on the type of obfuscation applied. Here are some common types and how they are reversed:
Obfuscation Example:
encoded = "".join([chr(ord(c) + 1) for c in "hello"])
print(encoded) # "ifmmp"
Reversing:
decoded = "".join([chr(ord(c) - 1) for c in "ifmmp"])
print(decoded) # "hello"
Obfuscated Code:
function x(a, b) { return a * b; }
console.log(x(2, 3));
De-Obfuscation (Renaming variables meaningfully):
function multiplyNumbers(num1, num2) { return num1 * num2; }
console.log(multiplyNumbers(2, 3));
Obfuscated Code:
let obfStr = btoa("Hello World!");
console.log(obfStr); // "SGVsbG8gV29ybGQh"
Reversing:
let originalStr = atob("SGVsbG8gV29ybGQh");
console.log(originalStr); // "Hello World!"
Obfuscation: Introducing unnecessary conditionals, loops, or function calls.
Reversing: Identifying redundant jumps and simplifying the flow.
Obfuscation: Using cryptographic techniques to obscure data.
Reversing: Requires knowledge of the decryption key or brute force techniques.