Skip to content

Instantly share code, notes, and snippets.

View Unam3dd's full-sized avatar
🌑
Passionate about Cyber-Sécurity

sam0verfl0w Unam3dd

🌑
Passionate about Cyber-Sécurity
View GitHub Profile
@Unam3dd
Unam3dd / ft_atoi_and_incrementation_trol.c
Created October 27, 2022 10:06
Trol Incrementation and ft_atoi
#include <stdio.h>
int ft_atoi(char *str)
{
long long to_dec = 0;
int neg = 1;
while (!(*str ^ ' ') || (*str >= '\t' && *str <= '\r'))
str = (char *)-~(unsigned long long)str; // Wtff dude
while ((!(*str ^ '+') || !(*str ^ '-')))
@lancejpollard
lancejpollard / x86-assembly-notes.md
Created January 27, 2021 22:45 — forked from mikesmullin/x86-assembly-notes.md
Notes on x86-64 Assembly and Machine Code

Mike's x86-64 Assembly (ASM) Notes

Assembling Binary Machine Code

Operating Modes:

These determine the assumed/default size of instruction operands, and restricts which opcodes are available, and how they are used.

Modern operating systems, booted inside Real mode,

@colematt
colematt / .Adding-Sections-to-Elf-Binaries.md
Last active March 1, 2024 20:04
[Add a section to an ELF binary] #llvm

Adding Sections to ELF Binaries

Suppose you need to add a section to an ELF binary to contain information gathered at compile time, but to be used at link time or run time. Here's how to add a section named .okdata and either populate it with data either after or before emitting the ELF binary.

Adding a Section After Emitting

In this case, you'll add file’s contents to an already existing binary. objcopy copies and translates object files, such that adding a new section is a matter of writing that new section’s contents into the ELF file.

(Optional) Create a simple program’s object file.

ELF

ELF Header

The first portion of any ELF file is the ELF header. This generally provides offsets to other headers (program headers and section headers) within an ELF.

typedef struct {
  unsigned char e_ident[EI_NIDENT];
 uint16_t e_type;
@baoilleach
baoilleach / zlib_mingw.txt
Created July 11, 2013 13:47
Compile zlib statically with mingw
> set PATH=C:\MinGW\bin;%PATH%
C:\Tools\zlib\zlib-1.2.8> C:\MinGW\bin\mingw32-make.exe -fwin32/Makefile.gcc
gcc -O3 -Wall -c -o adler32.o adler32.c
gcc -O3 -Wall -c -o compress.o compress.c
gcc -O3 -Wall -c -o crc32.o crc32.c
gcc -O3 -Wall -c -o deflate.o deflate.c
gcc -O3 -Wall -c -o gzclose.o gzclose.c
gcc -O3 -Wall -c -o gzlib.o gzlib.c
gcc -O3 -Wall -c -o gzread.o gzread.c