Skip to content

Instantly share code, notes, and snippets.

View NWPlayer123's full-sized avatar

NWPlayer123 NWPlayer123

View GitHub Profile
@NWPlayer123
NWPlayer123 / parse_icn.py
Created April 18, 2018 22:05
For use with the 48x48 raw ICN files in 3DS DLC (00000000/icons)
from struct import unpack
from PIL import Image
import sys
class ColorConversion:
def __init__(self):
self.Bits3To8 = self.MakeDepthConversionTable(3, 8)
self.Bits8To3 = self.MakeDepthConversionTable(8, 3)
self.Bits4To8 = self.MakeDepthConversionTable(4, 8)
@NWPlayer123
NWPlayer123 / extract_wad.py
Created May 23, 2018 04:46
This took way too fucking long, not entirely tested, seems to be working tho
from struct import unpack
from binascii import hexlify, unhexlify
from io import BytesIO
from Crypto.Cipher import AES
import sys
common_key = unhexlify("EBE42A225E8593E448D9C5457381AAF7")
def decrypt_title_key(cetk):
cetk.seek(0x1DC)
@NWPlayer123
NWPlayer123 / split_app.py
Created May 24, 2018 21:29
for use with extract_wad.py
from struct import unpack
import sys
with open(sys.argv[1], "rb") as f:
f.seek(0, 2)
fsize = f.tell()
f.seek(0, 0)
data = unpack(">4I", f.read(16))
assert data[0] == 0x10 #header size
with open(sys.argv[1][:-4] + ".00.app", "wb") as o:
@NWPlayer123
NWPlayer123 / rlwinm_gen.py
Created September 16, 2018 03:43
rlwinm simplified mnemonics
switch = 0
if switch == 0:
with open("rlwinm.txt", "wb") as o:
#extlwi
for n in range(1, 32): #cannot extract 0 bits
for b in range(1, 32):
if n != b and (n+b < 32):
o.write("rlwinm %d,%d,%d\textlwi %d,%d\n" % (b, 0, n - 1, n, b))
#extrwi
for n in range(1, 32): #cannot extract 0 bits
@NWPlayer123
NWPlayer123 / parse_bnr.py
Created October 10, 2018 03:31
GameCube Banner Parser
from PIL import Image
from struct import unpack
from math import ceil
import sys
class RGB5A3_Texture:
def __init__(self, height, width, color):
self.image = Image.new("RGBA", (width, height))
self.img = self.image.load()
self.width = width
@NWPlayer123
NWPlayer123 / parse_bti.py
Created October 22, 2018 03:34
Python 2, BTI extractor
from PIL import Image
from struct import unpack
from math import ceil
import sys
class I4_Texture:
def __init__(self, height, width, color):
self.image = Image.new("RGB", (width, height))
self.img = self.image.load()
self.width = width
@NWPlayer123
NWPlayer123 / do_strings.py
Last active May 13, 2025 00:47
IDAPython script to create strings the way I like, just do W at the base of a string, only tested on IDA7
# Press W, creates string there, creates align/word, renames to a non-conflicting name
import idaapi, idc, inspect
from io import BytesIO
def get_selected_bytes():
#BOOL multiple, start, end
selected = idaapi.read_selection()
curr_ea = idc.get_screen_ea()
return [selected, curr_ea]
@NWPlayer123
NWPlayer123 / extract_nut.py
Created November 19, 2018 03:23
NUT converter for Donkey Konga 2 (and others?)
from PIL import Image
from struct import unpack
from math import ceil
import sys
class I4_Texture:
def __init__(self, height, width, color):
self.image = Image.new("RGB", (width, height))
self.img = self.image.load()
self.width = width
@NWPlayer123
NWPlayer123 / pac_extract1.py
Created November 19, 2018 04:44
Donkey Konga 3 .pac archives, extremely terrible format (reading til "end" entry)
from struct import unpack
from os import mkdir
from os.path import exists
import sys
def half(f):
return unpack(">H", f.read(2))[0]
def full(f):
return unpack(">I", f.read(4))[0]
@NWPlayer123
NWPlayer123 / extract_sgarc.py
Created March 22, 2019 04:04
Python 2, for "sgarc" files, found in Wii U Mii Maker (and probably others, might need to edit unpack() endian, ">" -> "<")
from struct import unpack
from os.path import exists
from os import makedirs
import sys
def half(f):
return unpack(">H", f.read(2))[0]
def full(f):
return unpack(">I", f.read(4))[0]