This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <stdio.h> | |
#include <sys/mman.h> | |
#include <sys/types.h> | |
#include <fcntl.h> | |
int main() { | |
int fd = open("doesnotexist", O_CREAT); | |
assert(fd > 0); | |
void* map = mmap(NULL, 65536, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::Write; | |
use std::process::Command; | |
extern "C" { | |
fn mprotect(addr: *const u8, len: usize, prot: u32) -> u32; | |
} | |
fn main() { | |
let mut args = std::env::args(); | |
let _ = args.next(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0x00000000: 48895c2408 : mov qword [rsp + 0x8], rbx | |
0x00000005: 48896c2410 : mov qword [rsp + 0x10], rbp | |
0x0000000a: 4889742418 : mov qword [rsp + 0x18], rsi | |
0x0000000f: 57 : push rdi | |
0x00000010: 4154 : push r12 | |
0x00000012: 4155 : push r13 | |
0x00000014: 4883ec20 : sub rsp, 0x20 | |
0x00000018: 4885c9 : test rcx, rcx | |
0x0000001b: 0f844b040c00 : jz 0xc044b | |
0x00000021: f6410602 : test byte [rcx + 0x6], 0x2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
asn1=$(echo -e "\x30\x13\x02\x01\x05\x16\x0e\x41\x6e\x79\x62\x6f\x64\x79\x20\x74\x68\x65\x72\x65\x3f") | |
#asn2=$(echo -e "\x00\x01\x02\x03") | |
asn2="" | |
offset=0 | |
# while [ $offset -lt ${#asn1} ]; do | |
# curr=${asn1:offset:1} | |
# printf "$offset: %02x\n" \'$curr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* if you need more memory, add some to your program with this cool trick | |
*/ | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <inttypes.h> | |
#include <stddef.h> | |
#include <stdio.h> | |
#include <sys/mman.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Person { | |
fn greeting(&self) -> StateOfMind; | |
fn name(&self) -> &'static str; | |
} | |
struct Ixi { } | |
struct Katie { } | |
#[derive(Debug)] | |
enum StateOfMind { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <signal.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/ucontext.h> | |
#include <stdint.h> | |
void interpret(char op) { | |
printf("interpreting %02x\n", op); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Person { | |
fn greeting(&self) -> StateOfMind; | |
fn name(&self) -> &'static str; | |
} | |
struct Ixi { } | |
struct Katie { } | |
#[derive(Debug)] | |
enum StateOfMind { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; build and run: `nasm segment_heccery.asm -f bin -o img.bin && qemu-system-x86_64 img.bin -s -S` | |
[BITS 16] | |
[ORG 7c00h] | |
init: | |
cli | |
lgdt [gdtr] | |
mov eax, cr0 | |
or al, 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; assemble like `nasm bootloader.asm` (will produce a flat binary output by default) | |
; run like `qemu-system-x86_64 bootloader` | |
[BITS 16] | |
[ORG 7c00h] | |
init: | |
mov cx, 0xB800 | |
mov gs, cx | |
call clr_vga | |
mov si, HELLO |
NewerOlder