Hi,
ich nutze Whatsapp recht intensiv. Was liegt daher näher als Whatsapp auch auf der Box nutzbar zu machen? Dankenswerterweise hat mich noox darauf aufmerksam gemacht, dass es ein OpenSource Projekt für Linux gibt.
Wir legen mal los ...
Auf folgendem Blogeintrag beschreibt aleperno, dass man mittels Python auf den Whatsapp-Service zugreifen kann: Klick
Zitat: "Everything is made through yowsup (see requirementes) from Tarek Galal which within few simple steps we get a working client."
Python haben wir ja auf der Box. Bestens.
Ferner wird noch python-dateutil gebraucht. Falls es nicht auf dem Feed liegt, sollte es beim Imagehersteller angefragt werden.
Whatsapp ist für den Betrieb auf Smartphones gedacht und daher braucht man auch ein solches, um Whatsapp auf der Box zu nutzen.
Man braucht:
- IMEI, es wird als Beispiel "YYYYYYYYYYYYYYY" verwendet
- Handynummer, es wird als Beispiel "491234567890" verwendet
Das Ganze muss in den Config-File eingetragen werden:
root@:/tmp/yowsup/src# cat /home/root/my_whatsapp_config.txt
phone=491234567890
id=YYYYYYYYYYYYYYY
password=
root@:/tmp/yowsup/src#
=> man muss die eigene Handynummer ohne "+" oder "00" eintragen, jedoch muss der Nummer der Ländercode vorangestellt werden und die führende "0" der Hanynummer muss man weglassen. Wenn man also die Handynummer 01234567890 hätte und aus Deutschland kommt, dann sieht es wie oben angegeben.
=> die IMEI kann man fast immer auf dem Aufkleber im Handyakkufach ablesen oder bei Android im Settingsmenu (z.B. bei Cyanogenmod-ROMs unter "System Settings" => "About Phone" => "Status").
=> das "password" bekommt man erst im nächsten Schritt. Das bleibt daher frei.
Wenn man diese beiden Infos eingetragen hat, dann muss man sich bei Whatsapp registrieren. Das geht bequemerweise auch mit yowsup.
Registrierung:
Kurz und bündig geht das so:
Man erhält nun eine SMS auf sein Handy mit einem 6-stelligen Code.
Diesen Code muss man an Whatsapp zurück kommunizieren. Das geht so:
XXX-YYY steht für den Code, den man per SMS erhalten hat.
Nun gibt yowsup das hier aus:
status: ok
kind: free
pw: XXXXXXXXXXXXXXXXXX
price: EUR
price_expiration: 1361070419
currency: EUR
expiration: 1389574419
login: 491234567890
type: new
Man nimmt nun das Passwort und trägt es in den File /home/root/my_whatsapp_config.txt ein:
root@:/tmp/yowsup/src# cat /home/root/my_whatsapp_config.txt
phone=491234567890
id=YYYYYYYYYYYYYYY
password=XXXXXXXXXXXXXXXXXX
root@:/tmp/yowsup/src#
Einloggen:
Führt zu:
Wenn man sich nun eine Message senden läßt, dann kommt:
Q.e.d. => Whatsapp läuft.
Für den genehmen Leser hier die Kommandozeilen-Parameter von yowsup:
root@:/tmp/yowsup/src# python yowsup-cli
usage: yowsup-cli [-h] [-l | -s <phone> <message> | -i <phone>] [-w] [-a] [-k]
[-r (sms|voice) | -R code | -e]
[--generatepassword input | --decodestring encoded_array]
[--help-config] [--v1] [-c file] [-D] [-d] [-v]
yowsup-cli Command line options
optional arguments:
-h, --help show this help message and exit
--help-config Display info about configuration format
--v1 If specified, it will force usage of old API in
registration calls. Also password field in config will
be ignored and will attempt to generate password from
specified identity (IMEI/MAC)
-c file, --config file
Path to config file containing authentication info.
For more info about config format use --help-config
-D, --dbus Start DBUS interface
-d, --debug Enable debug messages
-v, --version Print version info and exit
Client options:
-l, --listen Listen to messages
-s <phone> <message>, --send <phone> <message>
Send message to phone number and close connection.
Phone is full number including country code, without
'+' or '00'
-i <phone>, --interactive <phone>
Start an interactive conversation with a contact.
Phone is full number including country code, without
'+' or '00'
-w, --wait If used with -s, then connection will not close until
server confirms reception of the message
-a, --autoack If used with -l or -i, then a message received ack
would be automatically sent for received messages
-k, --keepalive When used with -l or -i, Yowsup will automatically
respond to server's ping requests to keep connection
alive
Registration options:
-r (sms|voice), --requestcode (sms|voice)
Request the 3 digit registration code from Whatsapp.
-R code, --register code
Register account on Whatsapp using the provided 3
digit code
-e, --exists Check if account credentials are valid. WARNING:
Whatsapp now changes your password everytime you use
this. Make sure you update your config file if the
output informs about a password change
Debug tools:
--generatepassword input
Generate password from given string in same way
Whatsapp generates it from a given IMEI or MAC Address
--decodestring encoded_array
Decode byte arrays found in decompiled version of
Whatsapp. Tested with S40 version. Input should be
comma separated without the enclosing brackets.
Example: ./yowsup-cli --decodestring
112,61,100,123,114,103,96,114,99,99,61,125,118,103
root@:/tmp/yowsup/src#
Alles anzeigen
So, das sieht brauchbar aus:
root@:/var/lib/opkg# opkg install /tmp/python-yowsub-cli_0.1-pre0_all.ipk
Installing python-yowsub-cli (0.1-pre0) to root...
Installing python-dateutil (1.4.1-r1) to root...
Downloading python-dateutil_1.4.1-r1_mipsel.ipk
Configuring python-yowsub-cli
Configuring python-dateutil
root@:/var/lib/opkg#
Mamba