Skip to content

Instantly share code, notes, and snippets.

@tsmolka
tsmolka / akuvox_phone_aes_decrypt.py
Last active August 11, 2023 12:35
Quick & dirty script for decrypting Akuvox passwords based on phone_aes_decrypt from libcfg.so
import argparse, base64, binascii
box_encr = b'\xfa\x9f\x9e\xd5\xb8\x3b\xb5\x5b\x1b\x24\x7e\xa0\x7f\x79\xc9\x8d\x0b\x4a\x11\x80\xfb\xbc\xce\xf4\xba\xdc\xef\x6e\xee\x0c\xec\xe8\xaa\x8a\xbe\x62\xc6\x73\xbd\xe1\x97\x3c\x81\x16\xb4\x49\xa3\xbf\x94\xb6\x3f\x8f\x71\x0d\x83\x2b\xe9\x72\x99\xd7\x7d\x85\xc0\x27\x10\x82\x89\xd6\xf1\x46\xb7\x8b\x84\x37\xa1\x36\x86\x43\xf5\x15\xf7\x34\xa4\x68\x42\x28\x95\x2c\x9a\x2d\x03\x17\xb3\xc3\x40\xc4\x41\xc8\x9b\x32\x0f\x50\xbb\x90\x87\x5c\xc7\x08\xa2\xc1\x1d\x96\xf0\xc2\xfe\x33\xea\x92\x5e\x88\xc5\x61\x9c\x74\x25\xd9\x35\x65\xa5\xcf\x98\xb1\x1e\x53\x44\xa6\xae\x09\xaf\x4c\xca\xcc\xe2\xb9\x8e\xdf\xe7\x76\x75\x45\xf9\x31\xa7\x9d\xa8\xcb\x6d\xda\x2f\x12\xa9\xcd\xd0\xd1\x19\x02\x6c\xd2\x0a\x1a\x13\xd3\xe6\xf6\x8c\x77\xd4\x69\xeb\x47\xb0\xe4\x78\x54\x7a\x1c\x1f\xe5\xf3\x4d\xf8\xab\x14\xd8\x63\x2e\xdb\xdd\xfc\xde\xed\x0e\x91\xe0\xfd\x18\x48\xe3\x7b\x30\x20\x2a\x21\x93\xac\xad\xb2\xf2\x6f\xff\x00\x64\x38\x01\x22\x04\x39\x05\x66\x23\x06\x4e\x29\x26\x3a\x3d\x3e\x5d\x07\x4b\x4f\x51\x52\x55
@tsmolka
tsmolka / kentico2john.py
Created March 12, 2018 14:15
Simple script for converting SHA2 password hashes from Kentico CMS to password file for John the Ripper.
#!/usr/bin/env python
"""kentico2john.py Simple script for converting SHA2 password hashes from Kentico CMS to password file for John the Ripper.
See https://docs.kentico.com/k11/securing-websites/designing-secure-websites/securing-user-accounts-and-passwords/setting-the-user-password-format
TODO: add command line parameter for global salt
[List.Generic:dynamic_1505]
Expression=sha256($p.$s) (Kentico CMS SHA2SALT)
Flag=MGF_INPUT_32_BYTE
Function Get-StringHash {
Param (
[Parameter(ValueFromPipeline)][String[]]$String,
[ValidateSet('MD5','RIPEMD160','SHA1','SHA256','SHA384','SHA512')]$HashName = 'SHA256'
)
Process {
$StringBuilder = New-Object System.Text.StringBuilder
[System.Security.Cryptography.HashAlgorithm]::Create($HashName).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String)) | %{
[Void]$StringBuilder.Append($_.ToString("x2"))
}
#!/bin/bash
CURRENT_DIR="$( dirname "${BASH_SOURCE[0]}" )"
export PATH=${PATH/$CURRENT_DIR}
args=()
for arg in "$@"; do
if [[ "$arg" =~ ^@.* ]]; then
file="${arg#@}"
if [ -f "$file" ]; then
for a in $(cat "$file"); do
args+=("$a")
@tsmolka
tsmolka / HpqPswdDecryptor.py
Created January 31, 2017 16:07
Quick & dirty script for decrypting HP Bios passwords created by HpqPswd.exe
import argparse, struct
from Crypto.Cipher import AES
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='HpqPswd Decryptor')
parser.add_argument('-f', '--file', required=True, help='Input file')
parser.add_argument('-k', '--key', default='4a14........................................................1e33')
args = parser.parse_args()
f = open(args.file, 'rb')
@tsmolka
tsmolka / otp.py
Created January 31, 2017 13:30
Derive current OTP-auth tokens from secret (e.g. as in Google Authenticator)
"""
Prerequisites (install using easy_install or pip):
otpauth argparse
Sample token: https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/user@host%3Fsecret%3DAAAAAAAAAAAAAAAA
Usage: python otp.py --secret AAAAAAAAAAAAAAAA
"""
import argparse, time
from otpauth import generate_totp
from base64 import b32decode
@tsmolka
tsmolka / pacman-curl-helper.sh
Last active May 31, 2017 12:07
Curl wrapper that can handle authenticated GET HTTP requests to S3 buckets, Azure blobs and Gitlab repositories
#!/bin/bash
if [ $# == 0 ] ; then
echo "Usage: $0 [options...] <url>" 1>&2
exit 1
fi
which echo date env curl openssl > /dev/null || exit 1
ARGS=("$@")
URL=${ARGS[-1]}
if [[ ${URL} =~ ^s3:\/\/.* ]]; then
if [ -z "${AWS_ACCESS_KEY_ID}" -o -z "${AWS_SECRET_ACCESS_KEY}" ]; then