Tuesday, August 18, 2009

Automaticall reconnect the internet on disconnection

Due to certain problems with my ISP my net often gets disconnected. As you can guess there is nothing more frustrating then trying to do something and see that your internet is not working and then manually reconnecting the network. In order to fix this i wrote a simple script to monitor my network at an interval of one minute
Command:

vi ~/monitor.sh
Script:
#!/bin/bash
export DISPLAY=:0
pingout=`ping www.google.com -q -c 5 -W 2`;
pingstatus=$?;
total=`echo $pingout| grep transmitted | sed "s/.*\([[:digit:]]\) received.*/\1/"`;
if [[ $total -lt 4 || $pingstatus -ne '0' || $total -eq '' ]]
then
logger "Internet connection not working.$total/5 pings. Reconnecting..."
notify-send -i modem "Reconnecting" "$total/5 pings failed. Reconnecting..."
poff -a;
pon dsl-provider;
else
logger "Internet connection working properly"
fi
The script pings google.com and if less then four pings are successful in five attempts(60%) then a reconnection is performed.
To execute it periodically every minute i just added it to cron by simply executing
crontab -e

in a terminal and adding the following line at the end of the file
* * * * * ~/monitor.sh >/dev/null 2>&1

Sunday, April 29, 2007

Still using YM, AOL or Gtalk? Think again

Before starting on what are the disadvantages of using these let me give you a brief intro on how the internet works. The internet is a group of small networks which are connected together into the internet. Whenever we send data the data passes through various routers (controlled by different organizations and individuals) to reach the destination.
internet topologyINTERNET TOPOLOGY

The messengers we use don't provide any support for encryption. The initial login details used are encrypted to some extent but the rest of the data is not encrypted at all. People who have access to the routers can simply use a packet sniffer like wireshark to see the data. As an example let us see what appears in the sniffer after i have sent the string "How are you :)" on yahoo messenger.

PACKET SNIFFING

Clearly, a user who cares about his privacy would not like this kind of stuff to happen as this allows other people to steal the private data which users are careless enough to share on these messengers.

The alternative to this would be use third party encryption addons to these softwares like rocksyahoo , aim encryption . However, there are several problems with these approach. Two of the main problems are.
  1. You would have to seperate a seperate plugin for each of the seperate messengers you use.
  2. These types of plugins are not available for all the messengers (eg. gtalk).
The alternative would be to you use a simple, multi-protocol, multi-platform and very famous open source messenger known as Pidgin along with the encryption plugin. This extension adds a secure encrypted layer over all the protocols supported by pidgin. Thus a user can communicate with other people securely. There are various other benefits of using this messenger which a person comes to know after using it. You would also like to add the guification plugin which is a must have for it.

Notes:
  1. You might have to enable the encryption plugin through the plugin menu. Click Tools -> Plugins -> Pidgin-encryption to do that.
  2. Whenever chatting simply click the little lock on the upper right corner of the window to enable encryption.
  3. If the other user doesn't have the plugin he will see the following message ” *** Encrypted :: Send Key”. You would have to disable encryption at that time.