Skip to content

Instantly share code, notes, and snippets.

View svc64's full-sized avatar
🎯

Asaf svc64

🎯
  • Israel
View GitHub Profile
SHA512SUM: 5d8f7548237878d002d66a3233769e3e901a6898a1ee7d3a8b9cfe26f124d480ba6adfdd643397e18af11d316846220fda262f1b9b61e749bbd77431648a87f7
@svc64
svc64 / hooks.cpp
Created December 15, 2021 15:27
very very unsafe hooking on macOS
/*
(c) svc64 - 2021
very very unsafe hooks.
don't use this in prod.
seriously.
write something better than this.
if you do use this, keep in mind that we're doing a bunch of syscalls and writing code to "restore" a function, this is NOT thread safe at all. your app WILL *eventually* crash if you do this on multiple threads (experience from nightmares in prod).
just don't fucking use this, do something smarter tnxbye.
*/
@svc64
svc64 / mac_mem_rw.cpp
Last active December 7, 2021 09:36
executable memory r/w on macOS
// (c) svc64 29/11/2021
// should, in theory, work on iOS <~14.4 or with the correct jailbreak modifications (and the correct breakpoint opcode in main() here)
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
mach_vm_size_t page_size;
uintptr_t get_rw_copy(uintptr_t src_address) {