Skip to content

Instantly share code, notes, and snippets.

@UserUnknownFactor
UserUnknownFactor / exe_strings_tool.py
Last active June 27, 2025 05:04
Python tool to translate x86 exe strings by replacing their references to a newly created .trans PE section
import struct
import pefile
import re
import capstone
from tqdm import tqdm
CACHE_DIR = "__pycache__"
cache = None
ENABLE_CACHE = True
try:
@UserUnknownFactor
UserUnknownFactor / xna5_tool.py
Created June 27, 2025 04:44
Tool to unpack/repack XNA game framework XNB images (5 version only; Color/Bgr565 formats only; skips non-image data)
#!/usr/bin/env python3
"""
XNA Texture Extractor/Repacker
Extracts XNB files to PNG and repacks PNG files to XNB format.
"""
import os, sys, struct, argparse, logging, re
from pathlib import Path
from enum import IntEnum
from PIL import Image
@UserUnknownFactor
UserUnknownFactor / bruns_tool.py
Last active June 7, 2025 08:17
Tool to decrypt and re-encrypt Bruns engine game files (images and scripts)
import os
import struct
import argparse
import numpy as np
import zlib
def generate_xor_key(size):
"""Generate the XOR key based on the size value"""
xor_key = np.array([
size & 0xFF,
@UserUnknownFactor
UserUnknownFactor / il2cpp_str_tool.py
Last active June 27, 2025 05:01
Tool for extracting and modifying strings in Unity IL2CPP global-metadata.dat file to variable length strings; can keep overall string table size the same by trimming/padding disposable strings (with 1 in the 4th csv column)
#!/usr/bin/env python3
import argparse
import json
import os
import shutil
import sys
from filetranslate.service_fn import read_csv_list, write_csv_list
@UserUnknownFactor
UserUnknownFactor / key_xor_files_by_ext.py
Created May 2, 2025 08:39
Tool to xor multiple files with multi-byte key at once by extension
import os
import numpy as np
import re
def xor_files(key_string, extension=".txt", prefix="dec_", bytes_required=6):
key_bytes = bytes([int(x, 16) for x in key_string.split()])
#assert len(key_bytes) == bytes_required, f"Key must be exactly {bytes_required} bytes"
# Get all files in the current directory
all_files = [f for f in os.listdir() if f.lower().endswith(extension)]
@UserUnknownFactor
UserUnknownFactor / ccd2iso.py
Created April 11, 2025 09:29
CCD to ISO legacy CD image converter
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
"""Tool to convert CloneCD .img files to ISO 9660 .iso files."""
from typing import Any
from io import BytesIO
import contextlib
import os
@UserUnknownFactor
UserUnknownFactor / srpg_dts.ksy
Last active March 15, 2025 14:18
SRPG extractor tool
meta:
id: srpg_studio_dts
file-extension: dts
endian: le
title: SRPG Studio Data Format
application: SRPG Studio
license: MIT
encoding: UTF-16LE
doc: |
@UserUnknownFactor
UserUnknownFactor / searchgists.md
Last active December 6, 2024 08:26
How to search gists (enter this in the search box along with your search terms)
  • Get all gists from the user UserUnknownFactor: user:UserUnknownFactor
  • Find all gists with a .yml extension: extension:yml
  • Find all gists with HTML files: language:html
  • Find all gists with a ".bash_profile" file: filename:.bash_profile
  • Excludes all results containing your search term. : NOT
  • Find gists with greater than 100 stars. : stars:>100
  • Include anonymous gists in your search. : anon:true
  • Search all forked gists for results. : fork:only
  • Find gists containing a file size larger than 1000kbs. : size:>1000
  • Find all gists with the word "fetch" by UserUnknownFactor updated or created recently. :
@UserUnknownFactor
UserUnknownFactor / pycryptojs.py
Last active August 27, 2024 15:28
Tool to decrypt/encrypt CryptoJS encrypted files in Python
# Tool to decrypt/encrypt CryptoJS encrypted files in Python
import os, base64, glob
from hashlib import md5
from Crypto.Cipher import AES # requires: pip install pycryptodome
from Crypto import Random
STREAM_PREFIX = b"Salted__"
def pad(s):
@UserUnknownFactor
UserUnknownFactor / animate_pngs.py
Last active August 22, 2024 15:37
Tool to find images named prefix_NN_postfix.png and convert them to APNGs
import os, re, glob
import numpy as np
from PIL import Image, ImageChops
from collections import defaultdict
# Finds sequences of images with common name part+_<frame#>_etc.png
# and merges them into a single animated PNG.
INITIAL_SPEED = 20
TYPE2 = True