Skip to content

Instantly share code, notes, and snippets.

@xperylab
xperylab / PMDecryptAttachments.py
Created October 15, 2021 15:01
PM : decrypt attachments
import pgpy
import pandas
import sqlite3
from Crypto.cipher import AES
import os
from base64 import b64decode
import plistllib
import ccl_bplist
@xperylab
xperylab / PMBruteforcePIN.py
Last active September 20, 2023 07:40
PM : bruteforce PIN code
import multiprocessing
import itertools
from tqdm.contrib.concurrent import process_map
charset="1234567890"
salt = keychainVal['PinProtection.salt']
encMainKey = keychainVal['PinProtection']
IVsize = 16
@xperylab
xperylab / PMPinProtectionMainKey.py
Created July 28, 2021 07:28
PM : get main key from PinProtection strategy
import hashlib
import plistlib
from Crypto.Cipher import AES
salt = keychainVal['PinProtection.salt']
encMainKey = keychainVal['PinProtection']
def getMainKeyFromPinProtection(pin):
iKey = hashlib.scrypt(pin, salt=salt, n=32768, r=8, p=1, maxmem=33*1024*1024, dklen=32)
cipher = AES.new(ikey, AES.MODE_CTR, initial_value=encMainKey[:IVsize], nonce=b'')
@xperylab
xperylab / PMDecryptMessage.py
Created July 25, 2021 13:50
PM : Decrypt Message
import pgpy
mainKey = keychainVal['NoneProtection']
IVsize = 16
def decryptWithMainKey(encrypted):
iv = encrypted[:IVsize]
cipher = AES.new(mainKey, AES.MODE_CTR, initial_value=iv, nonce=b'')
return cipher.decrypt(encrypted[IVsize:])
@xperylab
xperylab / PMDecryptWithMainKey.py
Created July 25, 2021 13:19
PM : Decrypting with Main key
mainKey = keychainVal['NoneProtection']
IVsize = 16
def decryptWithMainKey(encrypted):
iv = encrypted[:IVsize]
cipher = AES.new(mainKey, AES.MODE_CTR, initial_value=iv, nonce=b'')
return cipher.decrypt(encrypted[IVsize:])
@xperylab
xperylab / decrypt_ios_signal_dbs.py
Created January 2, 2021 16:52
Decrypt Signal databases
from Crypto.Cipher import AES
from struct import unpack
import os
import plistlib
from base64 import b64encode
signal_enc_db_name = 'signal.sqlite'
keychain_plist_path = 'keychain_decrypted.plist'
out_path = signal
@xperylab
xperylab / decrypt_ufed_keychain.py
Created December 30, 2020 11:27
UFED KeychainDump Decrypter
################################################################################################
# #
# UFED keychain decrypter #
# #
# Copyright Matthieu Regnery 2020 #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
@xperylab
xperylab / snapchat_object_content.proto
Created December 14, 2020 07:51
Snapchat CONTENT_OBJECT_TABLE protobuf
syntax = "proto2";
message root {
required string id = 2;
optional string key = 3;
optional string iv = 4;
required uint64 timestamp = 5;
optional chat_prop chat_props = 9;
required uint64 timestamp2 = 15;
required string timestamp3 = 20;
@xperylab
xperylab / decrypt_gallery_encrypteddb.py
Created December 12, 2020 23:23
gallery.encrypteddb decryption