Skip to content

Instantly share code, notes, and snippets.

@alexwh
Last active November 15, 2023 11:27
Show Gist options
  • Save alexwh/68c897e55b72f15ffde7e593c0d9cddb to your computer and use it in GitHub Desktop.
Save alexwh/68c897e55b72f15ffde7e593c0d9cddb to your computer and use it in GitHub Desktop.
pushbullet manual accesstoken registry encryption to bypass dysfunctional localhost:20807 server
#!/usr/bin/env python3
import sys
import struct
import base64
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import padding
key = [26, 81, 131, 250, 10, 187, 159, 184, 11, 73, 15, 155, 49, 88, 34, 42, 208, 18, 72, 255, 54, 63, 172, 106, 238, 47, 139, 16, 106, 105, 155, 41]
key = struct.pack(">" + "B"*len(key), *key)
iv = [189, 12, 193, 53, 87, 80, 242, 83, 178, 140, 144, 17, 190, 48, 4, 143]
iv = struct.pack(">" + "B"*len(iv), *iv)
padder = padding.PKCS7(128).padder()
padded_data = padder.update(bytes(sys.argv[1], "utf-8"))
padded_data += padder.finalize()
cipher = Cipher(algorithms.AES(key), modes.CBC(iv))
encryptor = cipher.encryptor()
ct = encryptor.update(padded_data)
# print(ct)
decryptor = cipher.decryptor()
# print(decryptor.update(ct) + decryptor.finalize())
print(f"put {base64.b64encode(ct).decode()} in HKEY_CURRENT_USER\\SOFTWARE\\Pushbullet\\AccessToken (string)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment