I am participating in a cyber-sec course at the local uni. Our first project involves a web server that has a submission form and students scors reflected on it. You gain points by submitting the hash value of a secret word of a fellow student. For every point you gain, they lose a point.
One of the aspects of the project is automation. I noticed that if I just refresh the submission confirmed page, it resubmits my points. So, I wrote a simple java program that just access this page as fast as it can.
My question: Can any of you spot a way to make this faster? It seems it takes almost a second or two for each submission. Is the u.openStream(); waiting for a response? Is there a way to make it just submit, then ignore a response? Is this the most efficient way to be doing this?
URL I am submitting is as follows:
http://um.cyber.rose.edu/TNSubmissio...h=STUDENTSHASH
The code I have thus far is below.
Basically, start twenty (or more) threads, and in each thread loop the openStream().import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.io.IOException; import java.io.BufferedInputStream; class XThread extends Thread { XThread() { } XThread(String threadName) { super(threadName); // Initialize thread. //System.out.println(this); start(); } public void run() { //Display info about this particular thread URL u; BufferedInputStream is = null; String myNAME = new String("me"); String vNAME = new String("andrew"); String vHASH = new String("4252943e53d9677d1ef12f4fad9e026b");//me // int wall=1; try { u = new URL("http://um.cyber.rose.edu/TNSubmissionHandler.aspx?Name="+myNAME+"&Victim="+vNAME+"&VictimHash="+vHASH); for (int i = 0; i < 1000000; i++) { is = new BufferedInputStream(u.openStream()); System.out.println(i); is.close(); } } catch (MalformedURLException mue) { System.out.println("Ouch - a MalformedURLException happened."); mue.printStackTrace(); System.exit(1); } catch (IOException ioe) { System.out.println("Oops- an IOException happened."); ioe.printStackTrace(); System.exit(1); } finally { try { is.close(); } catch (IOException ioe) { // just going to ignore this one } } // end of 'finally' clause } } public class SingleUser { public static void main(String[] args) { Thread thread1 = new XThread(); Thread thread2 = new XThread(); Thread thread3 = new XThread(); Thread thread4 = new XThread(); Thread thread5 = new XThread(); Thread thread6 = new XThread(); Thread thread7 = new XThread(); Thread thread8 = new XThread(); Thread thread9 = new XThread(); Thread thread10 = new XThread(); Thread thread11 = new XThread(); Thread thread12 = new XThread(); Thread thread13 = new XThread(); Thread thread14 = new XThread(); Thread thread15 = new XThread(); Thread thread16 = new XThread(); Thread thread17 = new XThread(); Thread thread18 = new XThread(); Thread thread19 = new XThread(); Thread thread20 = new XThread(); //Start the threads thread1.start(); thread2.start(); thread3.start(); thread4.start(); thread5.start(); thread6.start(); thread7.start(); thread8.start(); thread9.start(); thread10.start(); thread11.start(); thread12.start(); thread13.start(); thread14.start(); thread15.start(); thread16.start(); thread17.start(); thread18.start(); thread19.start(); thread20.start(); }