Skip to content

Instantly share code, notes, and snippets.

@hasherezade
hasherezade / talk_claude.py
Created December 5, 2025 23:36
A simple hello world script to talk with Claude AI via API
#!/usr/bin/env python3
import os
import requests
import json
API_KEY = os.getenv("ANTHROPIC_API_KEY")
if not API_KEY:
raise ValueError("Please set the ANTHROPIC_API_KEY environment variable.")
@hasherezade
hasherezade / ida_disasm_curr.py
Created September 29, 2025 22:53
IDA script - disasm current function
# Walk current function and print its disassembly
import ida_funcs
import ida_kernwin
import idautils
import ida_lines
import idc
def print_func_disasm(ea=None):
"""
Walks from the beginning to the end of the function containing `ea`
@hasherezade
hasherezade / params.txt
Created June 5, 2025 16:03
Extended params for Tiny Tracer
kernel32;LoadLibraryW;1
kernel32;LoadLibraryA;1
kernel32;GetProcAddress;2
advapi32;RegQueryValueW;3
advapi32;RegOpenKeyExW;5
advapi32;RegQueryValueExW;6
kernel32;CreateFileW;6
kernel32;VirtualProtect;4
wininet;InternetCrackUrlA;4
wininet;InternetOpenA;5
@hasherezade
hasherezade / delta_patch.py
Created October 30, 2024 14:53 — forked from wumb0/delta_patch.py
a script for applying MS patch deltas
import base64
import hashlib
import zlib
from ctypes import (
CDLL,
POINTER,
LittleEndianStructure,
c_size_t,
c_ubyte,
c_uint64,
@hasherezade
hasherezade / aplib_decompress.py
Created August 23, 2024 13:42
Decompressor for headless APLib blobs
#!/usr/bin/env python3
import malduck
import sys
import argparse
def main():
parser = argparse.ArgumentParser(description="APLib unpacker")
parser.add_argument('--inpath', dest="inpath", default=None, help="APLib compressed blob",
required=True)
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "ntdll.lib")
#define SystemBigPoolInformation 0x42
#define ThreadNameInformation 0x26
#define DATA_TO_COPY "AAAAAAAAAAAAABBBBBBBBBBBBBBBCCCCCCCCCCCCCCCDDDDDDDDDDDDDDD"
@hasherezade
hasherezade / gui_threads.cpp
Last active May 14, 2024 15:45
Find GUI thread
HANDLE find_thread(HANDLE hProcess, DWORD thAccess, bool guiOnly)
{
DWORD targetPid = GetProcessId(hProcess);
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
THREADENTRY32 thEntry = { sizeof(THREADENTRY32) };
GUITHREADINFO gui = { 0 };
gui.cbSize = sizeof(GUITHREADINFO);
bool isGUIProcess = false;
@hasherezade
hasherezade / PesieveLdr.go
Last active January 6, 2023 02:11
PE-sieve scan in Golang
package main
import (
"fmt"
"syscall"
"unsafe"
)
var (
peSieveDll = syscall.NewLazyDLL("pe-sieve64.dll")
#include <iostream>
#include <Windows.h>
#pragma comment(lib,"LZ32.lib")
bool decompress(LPSTR infile, LPSTR outfile)
{
INT hin, hout = 0;
OFSTRUCT ofin = { 0 };
OFSTRUCT ofout = { 0 };
#!/usr/bin/env python3
import sys, os, subprocess
import pefile
from pathlib import Path
def mal_unp_res_to_str(returncode):
if returncode == (-1):
return "ERROR"
if returncode == 0: