From f38b4e28b3a061c70a92f09e0d92e015d84813f6 Mon Sep 17 00:00:00 2001 From: gaailiunas Date: Fri, 25 Jul 2025 19:35:34 +0300 Subject: [PATCH] initial commit --- .gitignore | 1 + CMakeLists.txt | 6 ++++++ src/disasm.c | 5 +++++ src/disasm.h | 8 ++++++++ src/main.c | 25 +++++++++++++++++++++++++ 5 files changed, 45 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 src/disasm.c create mode 100644 src/disasm.h create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6cecc8b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.10) +project(disasm) +add_executable(disasm + src/main.c + src/disasm.c +) diff --git a/src/disasm.c b/src/disasm.c new file mode 100644 index 0000000..c209fca --- /dev/null +++ b/src/disasm.c @@ -0,0 +1,5 @@ +#include "disasm.h" + +void disasm(const unsigned char *instructions, size_t len) +{ +} diff --git a/src/disasm.h b/src/disasm.h new file mode 100644 index 0000000..50b3105 --- /dev/null +++ b/src/disasm.h @@ -0,0 +1,8 @@ +#ifndef DISASM_H +#define DISASM_H + +#include + +void disasm(const unsigned char *instructions, size_t len); + +#endif // DISASM_H diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..527c8c9 --- /dev/null +++ b/src/main.c @@ -0,0 +1,25 @@ +#include +#include "disasm.h" + +int main(void) +{ + const unsigned char instructions[] = { + 0x55, // push rbp + 0x48, 0x89, 0xe5, // mov rbp, rsp + 0x48, 0x83, 0xec, 0x10, // sub rsp, 0x10 + 0xe8, 0xe8, 0xff, 0xff, 0xff, // call 1139 + 0x89, 0x45, 0xfc, // mov [rbp-0x4], eax + 0x8b, 0x45, 0xfc, // mov eax, [rbp-0x4] + 0x48, 0x8d, 0x15, 0xa6, 0x0e, 0x00, 0x00, // lea rdx, [rip+0xea6] + 0x89, 0xc6, // mov esi, eax + 0x48, 0x89, 0xd7, // mov rdi, rdx + 0xb8, 0x00, 0x00, 0x00, 0x00, // mov eax, 0x0 + 0xe8, 0xc3, 0xfe, 0xff, 0xff, // call 1030 + 0xb8, 0x00, 0x00, 0x00, 0x00, // mov eax, 0x0 + 0xc9, // leave + 0xc3 // ret + }; + + disasm(instructions, sizeof(instructions)); + return 0; +}