Skip to content

Instantly share code, notes, and snippets.

View VadimGush's full-sized avatar
👔
If I don't input those numbers... Doesn't make much of a difference.

Vadim Gush VadimGush

👔
If I don't input those numbers... Doesn't make much of a difference.
View GitHub Profile
@VadimGush
VadimGush / decode.java
Last active January 31, 2025 11:35
Decode AmneziaWG client key in Java
public static class Decoder {
public void test() throws Exception {
// AmneziaWG client key which starts with "vpn://" is just a Base64 encoded and compressed JSON configuration file
final var encoded = "vpn://<insert your client key>".replace("vpn://", "");
// They use Base64 URL encoder. Inside of the Base64 encoded string is a compressed data.
final var compressed = ByteBuffer.wrap(Base64.getUrlDecoder().decode(encoded));
// Data is compressed using QT qCompress function, which uses zlib and adds a 4 byte header to the compressed data
final var header = new byte[4]; // The header is 32-bit unsigned integer representing the size of uncompressed data
compressed.get(header); // This will remove 4 byte header from the buffer
import { exec, spawn } from 'child_process';
const args = process.argv;
// If false, it fails with the following error:
// 1 | import { exec, spawn } from 'child_process';
// 2 |
// 3 | const args = process.argv;
// 4 |
// 5 | if (args.length < 4) {

Keybase proof

I hereby claim:

  • I am vadimgush on github.
  • I am vadimgush (https://keybase.io/vadimgush) on keybase.
  • I have a public key ASAvDPiollJpGryY0yXyXDv0krsmPfoqVWG8NBZmuZ4rZgo

To claim this, I am signing this object: