Created
March 30, 2012 17:49
-
-
Save cwarden/2253337 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* de-obfuscate kettle passwords */ | |
import java.math.BigInteger; | |
public class Decr { | |
private static final int RADIX = 16; | |
private static final String SEED = "0933910847463829827159347601486730416058"; | |
public static void main(String[] args) { | |
if (args.length!=1) { | |
printOptions(); | |
System.exit(9); | |
} | |
String obfuscated = args[0]; | |
String password = Decr.decryptPassword(obfuscated); | |
System.out.println(password); | |
System.exit(0); | |
} | |
public static final String decryptPassword(String encrypted) { | |
if (encrypted==null) return ""; | |
if (encrypted.length()==0) return ""; | |
BigInteger bi_confuse = new BigInteger(SEED); | |
try { | |
BigInteger bi_r1 = new BigInteger(encrypted, RADIX); | |
BigInteger bi_r0 = bi_r1.xor(bi_confuse); | |
return new String(bi_r0.toByteArray()); | |
} catch(Exception e) { | |
return ""; | |
} | |
} | |
private static void printOptions() { | |
System.err.println("decr usage:\n"); | |
System.err.println(" decr <obfuscated>"); | |
System.err.println(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment