title: How do I provide stdin inputs from command line?
body: <p>I am trying to perform a buffer overflow attack on a program for a class assignment. Both the attack program as well as the vulnerable programme is written by me.</p>
  
  <p>The vulnerable code uses <code>scanf</code> to read data from stdin.</p>
  
  <p><code>./vulnerable &lt; malicious_payload_file.txt</code> works fine.
  <code>more malicious_payload | ./vulnerable</code> and <code>echo JUNK_JUNK_JUNK_JUNK | ./vulnerable</code> also works as expected.</p>
  
  <p>However, i would like to use the attack programme to keep supplying incrementally longer payloads till the programme crashes. So, I need to dynamically generate larger payloads of junks. I am using <code>system ("./vulnerable");</code> to repeatedly call and test for an abnormal exit.</p>
  
  <p>How do I specify such a payload?</p>
  
  <p>Is there a way to run <code>./vulnerable &lt; malicious_payload_binary</code> or in some manner such that I do not have to put the malicious payload in a file, but can specify it in the command line?</p>