├── C └── Disassemble.c ├── ELF-injection ├── ELF-injection.py └── README.MD ├── Python-Ghidra └── PyGhidra.py └── README.md /C/Disassemble.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define ANSI_COLOR_RED "\x1b[31m" 7 | #define ANSI_COLOR_GREEN "\x1b[32m" 8 | #define ANSI_COLOR_RESET "\x1b[0m" 9 | 10 | int main() 11 | { 12 | csh handle; // API of capstone 13 | cs_insn *insn; // points to all memory 14 | size_t count; // count instructions 15 | if(cs_open(CS_ARCH_X86, CS_MODE_64, &handle) != CS_ERR_OK){ 16 | fprintf(stderr, "Error initializing capstone\n"); 17 | } 18 | FILE *file = fopen("register", "rb"); // change the file 19 | if(!file){ 20 | fprintf(stderr, "Error opening file\n"); 21 | cs_close(&handle); 22 | return 1; 23 | } 24 | fseek(file,0,SEEK_END); // set position 25 | long int file_size = ftell(file); // size of the file 26 | rewind(file); // reset the file position 27 | 28 | unsigned char *buffer = malloc(file_size); // allocate the memory 29 | fread(buffer, 1, file_size,file); // read 1 byte of file_size 30 | fclose(file); // close the file 31 | 32 | count = cs_disasm(handle, buffer, file_size, 0x1000, 0, &insn); 33 | if(count > 0){ 34 | for(size_t i = 0; i