I bring you here a small (yet useful
piece of software). You probably have read something about having whatsapp on
your computer using the Yowsup libraries. Buliding upon that I’ve created a
small program to work as a remote communication method with your computer or
server. I’m using it with my raspberry (because the daemon is
super-lightweight) but it will run on any *nix system. (Please tell me if you
run it on a mac os).
Whatsapp is a messenger service,
which links to a phone number, and sends unlimited messages, pictures, etc…
(for a yearly fee). If you didn’t know this you probably don’t know what
internet is either (no, I don’t mean the net inside your swimming pants). It is
meant to be used on your phone overriding it’s sms’ capabilities. There are
official “whatsapp clients” for android, ios, windows phone, Blackberry,
Symbian (is someone still using this!!!) and Nokia S40 (WOW!!). There are a few
unofficial clients out there (like wazapp for the nokia N9, also based on
yowsup).
Afaik the yearly payment is based on
the usage of the official client, so no fee for the unofficial ones :).
Yowsup are a set of libraries
developed by Tarek Galal in Python.
Yowsup allows the use of the whatsapp messenger service on any computer with
python capabilities (mostly anything). Right now yowsup is under heavy
development.
Python is Monty Python-inspired (//en.wikipedia.org/wiki/Python_programming_language) programming language. It “is a
widely used general-purpose, high-level programming language” (according to Wikipedia(www.wikipedia.com).
Seriously? You seriously expect me
to write this…
Yowsup-daemon:
Yowsup is centered on using whatsapp
on your computer like you would in your phone
Yowsup-daemon is a small program
which (using yowsup) allows you to communicate with your computer. There are a
few uses that I can think of:
1 – Tell your computer to do something:
for example download a file, start a backup, check if some service is still
running… This could include checking your home temperature (given that you have
a temperature probe attached (extremely unexpensive)) and turn on your heating
(maybe some arduino is needed here).
1 – For your computer to tell you something: like
some task was finished, someone has connected to your computer, some download
just finished…
Features:
- Since it is server-based there is no need to open ports on your router.
- The security is blindlessly handed to the sever side (is this good? I don’t think anyone is going to hack your servers through whatsapp in the near future).
- It doesn’t establish a link. It just sends messages. This is really good for me because on my long (underground train) commute my connection drops every 5 mins. And my tasks don’t get stopped (and I save myself the nohup hassle).
- It works as a daemon so if you make it run at startup you can forget about it.
- Impress your friends or clients. Your (technologically impaired) client might not want to connect through ssh to check the status of his server but he will be pleased if the same can be achieved through whatsapp. Since it is fully open source you can check the code and be sure it will not harm your system.
Could the same thing be achieved with email? Yes, but the security would
be worse and it would be way uncooler.
Getting started:
1. First you have to download yowsup from Tagal's github.
2. You need to register your phone
number into whatsapp…
3. Get it running, check Tagal's instructions. Ask me for help if you run into trouble here.
4. Download things from my github.
3. Get it running, check Tagal's instructions. Ask me for help if you run into trouble here.
4. Download things from my github.
3. Create your config file; start with
the template:
- Every line starting with # (or empty) is ignored.
- Allow_direct_shell: if this keyword is present shell orders will be accepted; for example: “Shell: whoami”. Notice: the colon and the space.
- Allowed phone numbers: put as many as you want (I only tried 3 or 4). Remember complete phone number with country code.
- #Command dictionary: after this line the commands are defined. First keyword, then colon and then the command to execute. Anything that is command-line-acceptable is acceptable here. If you want to call a script remember to call it with full path. I give you a few examples working for me.
Start it with: ./yowdaemon.py start
#This is the config file
#Read the instructions, read my blog www.pisasuavemente.blogspot.com/, tweet me @treadsoftblog
#Your computer's (Whatsapp) phone number.
phone number:"Your phone number, with cc"
#Your whatsapp password.
password:"Your password goes here"
#Uncomment the following line to allow direct shell commands.
allow_direct_shell
#Uncomment the following line to send a message to the allowed1 number.
send_message_startup:Yow-daemon started.
#Uncomment the following line to reply to groups.
answer_to_group
#Message to answer when the order was not understood.
not_understood: No te he entendido.
#Uncomment the next line to activate guest mode.
guest_mode
#allowed phone numbers
allowed1:"Dont forget these"
allowed2:
allowed3:
#uncomment the following line to log.
logging
#Command dictionary
Bluetoothon:service bluetooth start
Bluetoothoff:service bluetooth stop
Bluetooth:service bluetooth status
Music play:mpc play
Music: mpc
Music_stop: mpc stop
Say: fortune
Di algo: fortune
Hi: Hi
Correo:python /home/pi/Documents/a.py
Reload_dlna: service minidlna force-reload
Free:
Cputemp:/opt/vc/bin/vcgencmd measure_temp
Cput: /home/pi/meteo/check_Temp
Temp: /home/pi/meteo/temp
Pres: /home/pi/meteo/bmp.py
No comments:
Post a Comment