title: Write hex in GDB
body: <p>I'm in a software security class and we are currently learning about buffer overflows and how they are exploited.  I have a program that I know how to exploit, but I appear to be unable to do so because I have to write hex that it is not allowing me to write.</p>
  
  <p>I need to write the data generated from:</p>
  
  <pre><code>perl -e 'print "A"x48; print "\x1b\x88\x04\x08";'
  </code></pre>
  
  <p>However, I cannot redirect that output into the command line arguments because the program runs interactively.  Historically, I have used xclip to copy it to the clipboard and then paste it into the running application, but for some reason, this sequence of hex does not allow me to use xclip to copy it (it shows as nothing has been copied).</p>
  
  <p>For example:</p>
  
  <pre><code>perl -e 'print "A"x48; print "\x1b\x88\x04\x08";' | xclip -sel clip
  </code></pre>
  
  <p>If I ctrl+V after that, nothing gets pasted.  If I simply copy and paste the output from the terminal window, the wrong hex is pasted (I'm assuming this is because the hex isn't visible ASCII).</p>
  
  <p>My question is: does GDB have some way for me to insert generated text like this into an interactive, running program?</p>
  
  <p>I'm aware that if the exploitable program took command line arguments, I could do:</p>
  
  <pre><code>run $(perl -e 'print "A"x48; print "\x1b\x88\x04\x08";')
  </code></pre>
  
  <p>But since it doesn't run via cli arguments, this isn't usable.</p>
  
  <p>Any help would be awesome!</p>