Skip to content

Instantly share code, notes, and snippets.

@lab313ru
lab313ru / mmc_uboot_dump.py
Last active April 16, 2024 10:15
Dump ext2 filesystem via U-Boot mmc menu
import os.path
import re
import sys
import struct
import serial
from tqdm import tqdm
import re
DIR_R = re.compile(r'^<DIR>[ \t]+(\d+)[ \t]+(.+)$')
@lab313ru
lab313ru / password.bin
Last active April 1, 2024 22:56
USB Password fuse generator for Amlogic A113X (AXG)
password12345678
@lab313ru
lab313ru / gen_unscramble_key.py
Created September 4, 2023 18:56
Generate Mediatek (MTK) NAND scrambling key
SEEDS = [
0x576A, 0x05E8, 0x629D, 0x45A3, 0x649C, 0x4BF0, 0x2342, 0x272E,
0x7358, 0x4FF3, 0x73EC, 0x5F70, 0x7A60, 0x1AD8, 0x3472, 0x3612,
0x224F, 0x0454, 0x030E, 0x70A5, 0x7809, 0x2521, 0x48F4, 0x5A2D,
0x492A, 0x043D, 0x7F61, 0x3969, 0x517A, 0x3B42, 0x769D, 0x0647,
0x7E2A, 0x1383, 0x49D9, 0x07B8, 0x2578, 0x4EEC, 0x4423, 0x352F,
0x5B22, 0x72B9, 0x367B, 0x24B6, 0x7E8E, 0x2318, 0x6BD0, 0x5519,
0x1783, 0x18A7, 0x7B6E, 0x7602, 0x4B7F, 0x3648, 0x2C53, 0x6B99,
0x0C23, 0x67CF, 0x7E0E, 0x4D8C, 0x5079, 0x209D, 0x244A, 0x747B,
0x350B, 0x0E4D, 0x7004, 0x6AC3, 0x7F3E, 0x21F5, 0x7A15, 0x2379,
@lab313ru
lab313ru / apply_sym.py
Created April 5, 2023 21:42
Applies sym file information to idb
import re
import idc
import ida_nalt
import ida_kernwin
import ida_name
MODULE = re.compile(r'^MODULE \w+ \w+ \w+ .+$')
INFO = re.compile(r'^INFO CODE_ID \w+ .+$')
FILE = re.compile(r'^FILE (\d+) (.+)$')
@lab313ru
lab313ru / unp64.c
Created August 30, 2022 19:26
TitanEngine unp64
#include <windows.h>
#include <stdio.h>
#include <psapi.h>
#include "inc\TitanEngine.h"
PROCESS_INFORMATION* fdProcessInfo;
LPVOID lpBaseOfImage;
char szDumpName[MAX_PATH] = "";
static void log(const char* format, ...)
@lab313ru
lab313ru / pack_cel.py
Last active May 22, 2021 16:45
Casper Sega Saturn PX compression
import sys
import struct
TAG = '>2s HHHH'
BLOCK_HDR = '>HH'
MIN_REPEAT = 3
MAX_BLOCK = 0x81
@lab313ru
lab313ru / tcfg_offsets.txt
Created May 1, 2021 21:10
Tecmo Cup Footbal Game (Captain Tsubasa) compressed data offsets
3B400
3C1B3
3C6C8
3D22D
3E311
3E6D2
3ED0B
3F608
3FC1C
4068F
@lab313ru
lab313ru / snow_bros_keygen.py
Created April 4, 2021 20:16
Generates level passwords for Snow Bros, Sega
import random
import sys
rand_part = [
(19, 24),
(20, 26),
(25, 20),
(26, 24),
(24, 19),
(1, 16),
@lab313ru
lab313ru / mark_fdizzy_sega.py
Created March 23, 2021 16:04
Mark all imp! archives in IDA
import re
names = '''
Exploded at: 0144A8 (005C -> 021C bytes)
Exploded at: 015DFC (085E -> 1196 bytes)
Exploded at: 01665A (05AE -> 08E6 bytes)
Exploded at: 0191D8 (0D72 -> 1D00 bytes)
Exploded at: 01B204 (1000 -> 2322 bytes)
Exploded at: 01C204 (0F4A -> 22E2 bytes)
Exploded at: 01D1F6 (0246 -> 05FA bytes)
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file defines all of the flags. It is separated into different section,
// for Debug, Release, Logging and Profiling, etc. To add a new flag, find the
// correct section, and use one of the DEFINE_ macros, without a trailing ';'.
//
// This include does not have a guard, because it is a template-style include,
// which can be included multiple times in different modes. It expects to have