From 0142fb19905808101878148ca188161f016eba5e Mon Sep 17 00:00:00 2001 From: spacehen Date: Fri, 30 Dec 2022 12:05:55 +0200 Subject: CDL: Compact Detour Library Initial commit for the CDL x86_64 detour library. --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..225452d --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# cdl86 + +cdl86 - Compact Detour Library 86 + +# Abstract +cdl86 is a simple cross platform detours library written in C for Linux and Windows. + +It allows for the interception of x86 and x86_64 C/C++ functions in memory. + +[https://journal.lunar.sh/2022/linux-detours.html](https://journal.lunar.sh/2022/linux-detours.html) + +The library currently supports two types of function hooks: +* JMP patch - patches origin function with a JMP to detour. +* INT3 patch - places software breakpoint (SWBP) at origin address. Handles control flow to detour. + +This project makes use of an internal x86 instruction length disassembly engine. + +# API +```C +struct cdl_jmp_patch cdl_jmp_attach(void **target, void *detour); +struct cdl_swbp_patch cdl_swbp_attach(void **target, void *detour); +void cdl_jmp_detach(struct cdl_jmp_patch *jmp_patch); +void cdl_swbp_detach(struct cdl_swbp_patch *swbp_patch); +void cdl_jmp_dbg(struct cdl_jmp_patch *jmp_patch); +void cdl_swbp_dbg(struct cdl_swbp_patch *swbp_patch); +``` +The API is documented in more detail in the corresponding header and source +files. + +# Info +**cdl.c** - C source file for CDL.
+**cdl.h** - CDL header file to include. + +Folders: +* **/tests** - CDL test suite. Run `make all`. -- cgit v1.2.3-70-g09d2