title: How to turn hex code into x86 instructions
body: <p>I'm trying to make a script or program that will take given bytes (given in hexadecimal), and convert them into a x86 instructions (For example c3 -> retq)</p>
  
  <p>I've tried doing it by calling <code>gcc -c</code> on an assembly file just containing</p>
  
  <pre><code>retq
  retq
  </code></pre>
  
  <p>and then using a script to insert bytes where it says "c3 c3", then using <code>objdump -d</code> to see what it says now. But it seems that it messes up the format of the file unless I only pass an instruction of the same size as the original instruction bytes.</p>
  
  <p>I'm running it on a Raspbian Pi (A linux based operating system) using SSH, BASH terminal. I'm using BASH shell scripts and python, as well as the tools listed here, and gdb.</p>