Skip to content

Instantly share code, notes, and snippets.

View odudex's full-sized avatar

Odudex odudex

View GitHub Profile
import random
def pattern_detection(rolls, num_sides):
"""Calculate Shannon's entropy of roll derivatives to detect arithmetic progression patterns.
Args:
rolls (list of int): List of dice rolls.
num_sides (int): Number of sides on the dice.
Returns:
int: A percentage representing how much the sequence deviates from maximum entropy (0% is random, 100% is non-random).
"""
@odudex
odudex / krux_decrypt_lite.py
Created April 23, 2024 16:31
Decrypt a mnemonic from a Krux .json file or QR code
# The MIT License (MIT)
# Copyright (c) 2021-2023 Krux contributors
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@odudex
odudex / Krux_on_Windows.md
Last active January 29, 2024 16:44
Developing Krux on Windows

Motivation

Linux and Ubuntu are ideal for Krux development, but if you have a computer that lacks Linux support, with no drivers available for peripherals like the webcam (the webcam is integral to many Krux workflows), you can consider developing for Krux on Windows.

Development Environment Preparation

We will use the combo Window WSL(2), running Ubuntu and VS Code for simulation, code edition and compiling. To edit Krux source code, when preparation is finished, you’ll be able to open Ubuntu, navigate to Krux project and run: code . This will open VS Code on Windows, which will be editing the project inside Ubuntu.

Install WSL and VS Code and clone Krux

Open PowerShell and type the command:

@odudex
odudex / krux_decrypt.py
Last active November 18, 2023 21:53
Decrypt Krux encrypted mnemonics from QR codes or json files
# The MIT License (MIT)
# Copyright (c) 2021-2023 Krux contributors
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@odudex
odudex / krux_file_signer.py
Last active June 26, 2023 00:26
Sign files with Krux, airgapped and export openssl signature and public key
"""
This python script is aimed to help and teach how Krux can be used to sign files and create PEM public keys so openssl can be used to verify
Requirements:
- opencv, qrcode
pip install opencv-python qrcode
- This script also calls a openssl bash command, so it is required to have verification functionality
"""
import argparse
@odudex
odudex / krux_colors_generator.py
Created June 2, 2023 16:12
Krux color generator
"""
Create Krux colors from 8 bits RGB values
Type r g b arguments as 0-255 numbers
"""
import sys
def rgb888torgb565(color):
"""convert to gggbbbbbrrrrrggg to tuple"""
MASK5 = 0b11111
@odudex
odudex / python_encrypt_methods_tests.py
Last active April 17, 2023 15:27
Compare data lenghts for different encryption methods and mnemonic formats
from io import StringIO
import hashlib
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
import base64
from qrcode import QRCode
from embit.wordlists.bip39 import WORDLIST
from embit import bip39
MNEMONIC_ID = "test_ID"
@odudex
odudex / TinySeed.py
Last active March 27, 2023 12:00
Uses Embit to convert BIP39 seed words to Tiny Seed format.
"""Uses Embit to convert BIP39 seed words to Tiny Seed format.
Install Embit:
pip install embit
Exemple: python tiny_seed.py rail price fiction dice orphan have allow spatial share country mixed gasp
"""
import sys
from embit.wordlists.bip39 import WORDLIST
@odudex
odudex / seed_qr.py
Last active August 31, 2023 12:08
Uses Embit and qrcode modules generates ascii compact seed QR code.
"""Uses Embit and qrcode modules generates ascii compact seed QR code.
Install Embit:
pip install embit
Exemple: Words as input:
python seed_qr.py picture body actor coil end satoshi fish mom distance proof thank play fantasy friend dinner clump boring ozone review cart virtual toss foot infant
"""
import sys
from io import StringIO
@odudex
odudex / air_nostr.py
Last active February 21, 2023 19:55
Python nostr client for air-gapped shit posting
""" Python nostr client to for air-gapped shit posting
Requirements:
- python-nostr: On the same folder the air_nostr.py is, clone and rename it
git clone https://github.com/jeffthibault/python-nostr
mv python-nostr python_nostr
- opencv, embit, qrcode
pip install opencv-python embit qrcode