Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our university uses Sonicwall to block certain sites and each student can log into the internet through it.

Its hard to download big files like a linux distribution iso in a single go and I don't want to stay up all night downloading a file. Is their some way by which I could automate this logging in process. Also we get disconnected after every three hours and must log in again.

More generally what scripting language or technique should I learn about so as to achieve this. I prefer ruby over others so if its possible in ruby then its an added bonus.

share|improve this question
You could, at least, try asking the Uni SysAdmins if they could download it for you rather than trying to find a work-around. – tombull89 Aug 31 '11 at 14:33
Is Sonicwall an actual program, or are you prompted to log in by your web browser? – Breakthrough Aug 31 '11 at 16:03
Welcome to Super User! Sorry, but bypassing policies set up by educational organizations is not what we want to discuss here. If you need to log in every three hours then there is probably a reason to that. Consider contacting your network administrator or finding an alternative way, unless you want them to get angry if they notice your high bandwidth use at one or another time. – Tom Wijsman Aug 31 '11 at 18:06
@Breakthrough: It's a hardware firewall, something people don't want to mess around with... :) – Tom Wijsman Aug 31 '11 at 18:07
@Tom Wijsman that's fine, but does it require a third-party utility to be installed on the computer to log into the firewall, or does it simply prompt you for a username and password when you fire up your web browser? – Breakthrough Aug 31 '11 at 18:17
up vote 1 down vote accepted

I have used python to write a code which logs in, this code does the job at my university,

# The selenium.webdriver module provides all the WebDriver implementations. get it online, [I got the module from here][1]
from selenium import webdriver
# The Keys class provide keys in the keyboard like RETURN, F1, ALT etc.
from selenium.webdriver.common.keys import Keys

# here, a instance of Firefox WebDriver is created. You can do it for various browsers
driver = webdriver.Firefox()
# The driver.get method will navigate to a page given by the URL.
#WebDriver will wait until the page has fully loaded (that is, the “onload” event has fired)
# before returning control to your test or script.
# It’s worth noting that if your page uses a lot of AJAX on load then WebDriver may not      know when it has completely loaded. so please be patient
# The next line is an assertion to confirm that title has “Sonic” word in it: (not really neccesary :p)
# This is used to confirm that the webpage is the right one
assert "Sonic" in driver.title
# we use the 'name' tag to get a handle to the username and password  this finds the appropriate box.
user = driver.find_element_by_name("userName")
passwd = driver.find_element_by_name("pwd")
# use the 'send_keys' function to set the "box's" values to your password and username
user.send_keys("<your username>")
passwd.send_keys("<your password>")
# we sumbit the form
# we close the window after logging in, the popup which takes care of the 3 hour windows remains open.

Now, there are a lot of points to address,

  1. as you might see i have used the url to which i navigate in order to log in as "" not "" this is as in my college they have set up a frame, basically i couldnt use the 'find_element_by_name' or any such functions in that site. This might vary from institute to institute, check it out by reading your institute's source code thoroughly

  2. also i have used 'userName' and 'pwd' as the name's of the form box's. This doesnt have to be true for you, check that out too.

Now this code will only log you in if you execute it. You can put it in a loop and put a time delay of 2.5 hours. I am planning to keep it running in the background and if the computer connects to a wifi, the script will be notified, (i could use some help here ) and the code could start with a request to the "authentication page" if there is a 404 error then break other wise run the code. (requests library can help with these things)

            #checks for 404 error
            if check.status_code==404:

Python is an awesome language, you can work on it further, but i don't think it will be tough to port it to ruby, as selenium is available in ruby too.

please dont hesitate to contact me, as i am working on porting this code and implementing more features to android etc.

share|improve this answer
Nice, +1. I'll accept this answer, can't test as I'm done with college. – nikhil Jul 21 '14 at 15:59

I know I'm a bit late, but I made a chrome extension for this. If anybody needs it ...

share|improve this answer
Can you give a more detailed description of the linked content, and explain how it relates to the question? This will help ensure that this answer remains useful in the event the link becomes invalid. In addition, please be careful posting links in answers of this nature—they could be seen by the community as spam, correctly or otherwise. See the help center for more information. – bwDraco Nov 25 '14 at 22:35
Well, the OP asked about "Automate logging in through Sonicwall" and I made an extension to do just that since my university uses the same system – Giacomo Tecya Pigani Nov 26 '14 at 10:10
You are too late for me, I have no way of testing this out. I'll +1 this, maybe it'll help someone else. Thanks for sharing it here. – nikhil Nov 26 '14 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .