This content on this page was written a long time ago. It might not be accurate or has opinions which have changed/evolved over time.

published on in computers fun IIIT internet
tags: bash curl firefox hack isas

Robot form submission – Part 2

Ankit wrote a nice post about using Java to fill up a form, which is a FCFS allocation (can’t they just *provide* a quantity of good courses?). However, filling up the form can be simply done by a Firefox extension, Autofill forms; but what I would really like to do is be sleeping while the course registration goes on. 😀

Ingredients: Firefox, bash, curl, a bit of common-sense

  1. First of all, install two Firefox extensions – Web Developer and Firebug.

  2. Fill up the form that you’re going to fill up. (don’t get lost in recursion here!)

  3. Follow the screenshot below and convert POST to GET.

  1. Now open up Firebug console (press F12), select the Net tab, and enable it.

  1. Now click on Submit:

Ignore the “Registration is currently closed”, look at the console, you’ll have a big url that corresponds to your choices, just copy it.

It will be of the form:

    <url>?<data>
  1. To simulate this form submission, you’ll need this command:
curl <url> -d <data> -k -L
  1. However, there is a problem, you have to authenticate first. No sweat:
curl https://isas/validate.php -d &#8216;StUdent=username&searchin=200&password=password&submit=Submit&#8217; -c cookies.txt -k -L

This will save the login cookies in a file named cookies.txt

  1. So now we finalize the script:
#!/bin/bash

while (( 1 ))

do

curl https://isas/validate.php -d ‘StUdent=username\&searchin=200\&password=pass\&submit=Submit’ -c cookies.txt -k -L \#Change username and pass accordingly

curl https://isas/registration/updateSpecialReg.php -d -k -L -b cookies.txt

sleep 5s \#We don’t wanna hammer the server down 🙂

done

While I sleep on. 🙂

PS0: If you can’t get this to work, read about HTTP 402.