#!/usr/bin/env python#This is a simple script to connect to a wireless network.#Replace all instances of "device" with your device, in my case my wireless device is an Atheros device at ath0.import osfrom subprocess import Popenfrom sys import exit, stdoutfrom shutil import rmtreefrom time import sleepprint "________________________"print "Make sure that you are running this script using 'sudo' or as root."sleep(3)print "________________________"print "Make sure that you have edited the script for your hardware and network info before using. Connection will continue if CTRL-D is not pressed in the next 5 seconds."print "________________________"sleep(5)input1=1print input1if input1==1: command = Popen("ifconfig device down", shell = True) command = Popen("dhclient -r device", shell = True) command = Popen("ifconfig device up", shell = True) #Replace "essid" with your essid, must be in single quotes command = Popen("iwconfig device essid 'essid'", shell = True) ##Use only one if the following two according to your needs ##Replace "1234567890" with your key #command = Popen("iwconfig device key 1234567890", shell = True) ##OR, if you do not use a key (replacs "pass" with your password) #command = Popen("iwconfig device key s:pass", shell = True) command = Popen("iwconfig device mode Managed", shell = True) command = Popen("dhclient device", shell = True) sleep(10) print "______________________" print "You are connected." print "______________________" exit2=2 if exit2==2: exit else: exitelse: print "Please configure the script." exit