title: Shell script password bruteforcing
body: <p>Hi first of all apologies if this is poorly worded, will try to explain clearly.</p>
  
  <p>I have a binary named testpassword, usage is probably fairly explanatory.  goes as follows</p>
  
  <pre><code>./testpassword hello
  </code></pre>
  
  <p>if hello is <strong>correct</strong> password then output will be</p>
  
  <pre><code>pass=correct
  </code></pre>
  
  <p>if hello is <strong>incorrect</strong> password, output will be</p>
  
  <pre><code>pass=incorrect
  </code></pre>
  
  <p>I'm a complete beginner at Linux and shell scripting but made a very crude + simple script called bruteforce.sh. to perform a 'brute force' attack with a list of words. contents is as follows</p>
  
  <pre><code>./testpassword hello
  ./testpassword jelly
  ./testpassword watermelon
  ./testpassword anotherword  
  etc..
  </code></pre>
  
  <p>I ran the following in a new script after quite a bit of goggling for a very rough way to notify me when it's successful</p>
  
  <pre><code>./bruteforce.sh 2 2&gt;&amp;1 &gt;/dev/null | grep -n pass=correct
  </code></pre>
  
  <p>the output will be something like <code>12: pass=correct</code>. where 12 is the line number in bruteforce.sh </p>
  
  <p>when I see this on screen I can ctrl-c and run</p>
  
  <pre><code>awk 'NR==12' bruteforce.sh
  </code></pre>
  
  <p>to get the correct pass corresponding to the line number. I was just wondering if there is an easier or cleaner way to do any part of this </p>
  
  <p>Thanks in advance for any suggestions</p>