
Xlink Kai Ubuntu Client SSID Script
By: a guest on
Jun 13th, 2010 | syntax:
Bash | size: 1.86 KB | hits: 195 | expires: Never
#!/bin/bash
# shutdown handler
shutdown()
{
# start network-manager
start network-manager > /dev/null
# shutdown follower
exit 0
}
# add shutdown handler
trap shutdown SIGINT
# clear screen
clear
# display credits
echo "KAI SSID Client Tool for Ubuntu Linux 10.04 by Coldbird"
# stop network-manager
stop network-manager > /dev/null
# bring down cable interface
ifconfig eth0 down
# bring down wlan interface
ifconfig wlan0 down
# bring up cable network (internet)
ifconfig eth0 up
# connect cable network (internet)
dhclient eth0 2> /dev/null
# switch wlan device into adhoc mode
iwconfig wlan0 mode ad-hoc
# repeat till it works
while [ $? != 0 ]; do
iwconfig wlan0 mode ad-hoc
done
# switch to channel 1
iwconfig wlan0 channel 1
# repeat till it works
while [ $? != 0 ]; do
iwconfig wlan0 channel 1
done
# start wlan device
ifconfig wlan0 up
# current playstation ssid
CURSSID="NOTHING"
# initial ssid loop start
while [ "$CURSSID" = "NOTHING" ]; do
# get playstation ssid
NEWSSID=`iwlist wlan0 scan 2> /dev/null | grep PSP_ | cut -d : -f 2 | cut -d \" -f 2 | cut -d \" -f 1`
# new playstation ssid start
if [ "$CURSSID" != "$NEWSSID" -a -n "$NEWSSID" ]; then
# connect to network
iwconfig wlan0 essid $NEWSSID
# set link local
ifconfig wlan0 169.254.34.2
# save playstation ssid
CURSSID=$NEWSSID
# display change
echo Switched to $NEWSSID.
# new playstation ssid end
fi
# delay polling
sleep 3
# initial ssid loop end
done
# ssid change loop
while true; do
# output message
echo Paste the Host-Key \(PSP_AULES12345_L_hOsTkEy\) to switch SSID.
# read host key
read HOSTKEY
# connect to network
iwconfig wlan0 essid $CURSSID$HOSTKEY
# set link local
ifconfig wlan0 169.254.34.2
# display change
echo Switched to $CURSSID$HOSTKEY.
# ssid change loop end
done