Skip to content

Instantly share code, notes, and snippets.

@7etsuo
7etsuo / ytdl.c
Created September 27, 2024 21:05
// all ytdl files and code.
/* argument_parsing.c */
#include "argument_parsing.h"
#include "help_display.h"
#include "directory_management.h"
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
@7etsuo
7etsuo / 7etsuo-printf.c
Created September 12, 2024 08:48
printf cheatsheet
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────
printf Format Specifiers
│ ┌──────────┬──────────────────────────────────────────────────┬───────────────────────────────────────┐ │/** printf format specifiers
│ │ SpecifierDescriptionExample Output │ │ * ███ ▄████████ ███ ▄████████ ███ █▄ ▄██████▄
│ ├──────────┼──────────────────────────────────────────────────┼───────────────────────────────────────┤ │ *▀█████████▄ ███ ███ ▀█████████▄ ███ ███ ███ ███ ███ ███
│ │ %dSigned decimal integerprintf("%d", 42); // 42 │ │
@7etsuo
7etsuo / lambda.c
Created September 8, 2024 09:43
lambdas in C
/** Lambdas in C. Compile with GCC!
* ███ ▄████████ ███ ▄████████ ███ █▄ ▄██████▄
*▀█████████▄ ███ ███ ▀█████████▄ ███ ███ ███ ███ ███ ███
* ▀███▀▀██ ███ █▀ ▀███▀▀██ ███ █▀ ███ ███ ███ ███
* ███ ▀ ▄███▄▄▄ ███ ▀ ███ ███ ███ ███ ███
* ███ ▀▀███▀▀▀ ███ ▀███████████ ███ ███ ███ ███
* ███ ███ █▄ ███ ███ ███ ███ ███ ███
* ███ ███ ███ ███ ▄█ ███ ███ ███ ███ ███
* ▄████▀ ██████████ ▄████▀ ▄████████▀ ████████▀ ▀██████▀
*
@7etsuo
7etsuo / stackframe cheatsheet
Created August 30, 2024 08:20
x86 stackframe cheetsheet
// ___ ___ ________ ________________ __
_start: // | \/ || ___| \/ | _ | ___ \ \ / /
push 30 ; Arg 3 // | . . || |__ | . . | | | | |_/ /\ V /
push 20 ; Arg 2 // | |\/| || __|| |\/| | | | | / \ /
push 10 ; Arg 1 // | | | || |___| | | \ \_/ / |\ \ | |
call fun
@7etsuo
7etsuo / 7etsuo_exploit.c
Created March 24, 2024 08:07
Exploitable program
/**
* ______ _______ _________ _______
* / ___ \ ( ____ \\__ __/( ____ \|\ /|
* \/ ) )| ( \/ ) ( | ( \/| ) ( |
* / / | (__ | | | (_____ | | | |
* / / | __) | | (_____ )| | | |
* / / | ( | | ) || | | |
* / / | (____/\ | | /\____) || (___) |
* \_/ (_______/ )_( \_______)(_______)
*
@7etsuo
7etsuo / attach_process.ps1
Created March 24, 2024 04:44
A PowerShell script to attach a debugger to a running process or a service.
<#
.SYNOPSIS
A PowerShell script to attach a debugger to a running process or a service.
.DESCRIPTION
This script allows you to attach a debugger (WinDBG) to a running process or a service, with optional commands executed at the start of the debugging session.
It can also start an executable specified by a file path and attach the debugger to it.
.PARAMETER service_name
The name of the service to restart and attach the debugger to (optional).
@7etsuo
7etsuo / ExportFunctionAddressFinder.ps
Last active March 21, 2024 02:56
The file contains pseudocode illustrating a method for finding the address of an exported function within a DLL (Dynamic Link Library) using the Export Directory Table's data structures, such as the Export Name Pointer Table and the Export Address Table.
# This pseudocode assumes the existence of data structures for the export directory table
# and functions to read from these structures based on Relative Virtual Addresses (RVA).
# Structure definitions (simplified)
struct ExportDirectoryTable {
NamePointerTable namePointerTable;
OrdinalTable ordinalTable;
ExportAddressTable exportAddressTable;
}
@7etsuo
7etsuo / PagedMemoryManagementSimulator.c
Created March 6, 2024 00:21
This code simulates a Memory Management Unit (MMU) for understanding the logical-to-physical address translation in a paged memory system. It features a simulation environment that includes 4K page sizes, 15-bit logical, and 24-bit physical addresses for two processes, each with their own page table. The implementation uses bitwise operations to…
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX_PAGES_PER_PROC 8
#define MAX_PROCS 2
#define PHYSICAL_ADDRESS_MASK 0xFFFFFF
#define LOGICAL_ADDRESS_MASK 0x00007fff
#define VALID_BIT_MASK 0x80000000 /* bit 32 */
#define OFFSET_MASK 0x0FFF
@7etsuo
7etsuo / remote_exploit_template.c
Created March 4, 2024 04:49
Template for a remote exploit written in C. Disables nagles algorithm
/*
@snowcra5h
This is a template for a remote exploit.
It is a skeleton that you can use to build your own exploit.
+------------------+ <- Higher Memory Addresses
| ... |
+------------------+
| Return Address | <- Overwritten with "\x04\x03\x02\x01"