/objdump-to-opcodes

takes a file containing the output of calling `objdump -d <asm file>` and returns only the op codes section.

Primary LanguageCommon Lisp

objdump-to-opcodes

takes a file containing the output of calling "objdump -d " and returns only the op codes section.

How to use

  • Install SBCL with whatever package manager you have:
    "emerge sbcl" on Gentoo
  • Take the output of objdump and put into a file:
  • 
    
    bash-asm:     file format elf64-x86-64
    
    
    Disassembly of section .text:
    
    00000000004000b0 <_start>:
      4000b0:	b8 3b 00 00 00       	mov    $0x3b,%eax
      4000b5:	48 bf c8 00 60 00 00 	movabs $0x6000c8,%rdi
      4000bc:	00 00 00 
      4000bf:	48 31 f6             	xor    %rsi,%rsi
      4000c2:	48 31 d2             	xor    %rdx,%rdx
      4000c5:	0f 05                	syscall 
    
    
    	
    
  • Now save this file op-codes.lisp into the same directory as your compiled assembly and make it executable
    
    chmod +x op-codes.lisp
    
    
  • then run it it with the file name you created a minute ago as the argument:
  • 
    ./op-codes.lisp bash-asm-op 
    
    \xb8\x3b\x00\x00\x00\x48\xbf\xc8\x00\x60\x00\x00\x00\x00\x00\x48\x31\xf6\x48\x31\xd2\x0f\x05