Last active
July 6, 2019 04:12
-
-
Save bryanjhv/b1a0dcbd81784a6c23a49f05109312c2 to your computer and use it in GitHub Desktop.
Decrypt locked configuration from Wenz VPN for Android.
This file contains hidden or 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
import java.util.Map; | |
import java.util.HashMap; | |
import java.util.Base64; | |
import java.util.Map.Entry; | |
import javax.crypto.Cipher; | |
import javax.crypto.SecretKey; | |
import java.io.FileInputStream; | |
import java.io.ObjectInputStream; | |
import javax.crypto.spec.PBEKeySpec; | |
import javax.crypto.SecretKeyFactory; | |
import javax.crypto.spec.PBEParameterSpec; | |
public class WenzVPNDecrypt { | |
public static String decrypt(String data) throws Exception { | |
char[] key = "FH238924HCKWEHC3R239RCH47RY7RYCQ8X82X91298XYFH74R".toCharArray(); | |
Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES"); | |
SecretKey secret = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec(key)); | |
cipher.init(2, secret, new PBEParameterSpec("WENZ VPN".getBytes(), 20)); | |
return new String(cipher.doFinal(Base64.getDecoder().decode(data)), "utf-8"); | |
} | |
public static void main(String[] args) throws Exception { | |
if (args.length < 1) { | |
System.err.println("ERROR: Missing file..."); | |
System.exit(0); | |
return; | |
} | |
FileInputStream fis = new FileInputStream(args[0]); | |
ObjectInputStream ois = new ObjectInputStream(fis); | |
Map<String, String> cfg = (HashMap) ois.readObject(); | |
if (cfg.containsKey("303")) { | |
cfg.remove("303"); | |
} | |
for (Entry<String, String> entry: cfg.entrySet()) { | |
System.out.println(decrypt(entry.getKey()) + " = " + decrypt(entry.getValue())); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment