Skip to content

Instantly share code, notes, and snippets.

@w4kfu
w4kfu / adp_converter.py
Last active January 17, 2024 09:47
Stupid Invaders ADP to WAV
import struct
import wave
import argparse
amplitude_lookuptable = [
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x0010,
0x0011, 0x0013, 0x0015, 0x0017, 0x0019, 0x001C, 0x001F, 0x0022,
0x0025, 0x0029, 0x002D, 0x0032, 0x0037, 0x003C, 0x0042, 0x0049,
0x0050, 0x0058, 0x0061, 0x006B, 0x0076, 0x0082, 0x008F, 0x009D,
@w4kfu
w4kfu / solve_marsanalytica.py
Created May 24, 2018 13:56
MarsAnalytica z3 solver
from z3 import *
def display_model(m):
block = {}
for x in m:
if str(x)[0] == "p":
block[int(str(x)[1:])] = int(str(m[x]))
password = "".join(map(chr, block.values()))
print password
@w4kfu
w4kfu / bcrypt_rsapublic.py
Created April 25, 2018 13:25
BCRYPT_RSAPUBLIC_BLOB
import ctypes
def convert_bytes_to_structure(st, byte):
ctypes.memmove(ctypes.addressof(st), byte, ctypes.sizeof(st))
def s2n(s):
if not len(s):
return 0
return int(s.encode("hex"), 16)
@w4kfu
w4kfu / fdia.py
Last active April 5, 2018 14:40
fuck DIA
import argparse
import ctypes
import os
HANDLE = ctypes.c_void_p
HMODULE = HANDLE
DWORD = ctypes.c_uint
DWORD64 = ctypes.c_uint64
PVOID = ctypes.c_void_p
BOOL = ctypes.c_bool
@w4kfu
w4kfu / idapythonrc.py
Last active November 7, 2019 15:59
IDA user initialisation script
import idc
import idautils
import idaapi
import struct
# > copy idapythonrc.py %APPDATA%\Hex-Rays\IDA Pro\idapythonrc.py
def myreload():
"""
@echo off
cls
set IDA_PATH="UDPATE THE PATH TO IDA TEXT INTERFACE .exe"
set arg1=%1
set idc_file=%tmp%\moo.idc
echo #include ^<idc.idc^>>%idc_file%
echo static main()>>%idc_file%
@w4kfu
w4kfu / sdshow.py
Created July 20, 2017 13:27
sdshow readable
import subprocess
import sys
ACE_TYPE = {
"A" : "ACCESS_ALLOWED_ACE_TYPE",
"D" : "ACCESS_DENIED_ACE_TYPE",
"OA" : "ACCESS_ALLOWED_OBJECT_ACE_TYPE",
"OD" : "ACCESS_DENIED_OBJECT_ACE_TYPE",
"AU" : "SYSTEM_AUDIT_ACE_TYPE",
"AL" : "SYSTEM_ALARM_ACE_TYPE",
@w4kfu
w4kfu / clear_output.py
Last active September 18, 2020 07:14
Clear IDA output window
def is_ida69():
major, minor = map(int, idaapi.get_kernel_version().split("."))
return (major == 6 and minor >= 9)
def clear_output_window():
# IDA 6.9 drop PySide in favor of PyQt5
if is_ida69():
from PyQt5 import QtGui, QtCore, QtWidgets
form = idaapi.find_tform("Output window")
w = idaapi.PluginForm.FormToPyQtWidget(form)
@w4kfu
w4kfu / rao_bash.py
Last active May 25, 2017 17:37
rao_bash nsec2k17
from z3 import *
init(PATH_TO_Z3)
# >rao_bash.py
# 4sM1s:1f3_Fl4gzZ
# 4sM1s 1f3_Fl4gzZ
# 4sM1s 1f3(Fl4gzZ
# 4sM1s:1f3(Fl4gzZ
# 4sM1s@1f3_Fl4gzZ
@w4kfu
w4kfu / dllinjshim.cpp
Last active June 2, 2023 03:58
DLL Injection via Shim
/*
-------- dllinjshim.cpp --------
> cl /Fe:dllinjshim.exe dllinjshim.cpp
> dllinjshim.exe
> sdbinst moo.sdb
/!\ On Windows 10 there is a new function `SdbIsKnownShimDll` called
in `SdbGetDllPath` which will check the DLL name against the following list: