Send Instant Messages (Notifies) By XMPP (Jabber/Google Talk) From Linux Command Line

sendxmpp is a perl-script to send xmpp (jabber), similar to what mail does for mail. Sendxmpp was written by Dirk-Jan C. Binnema, and is available under the terms of the GNU GPLv2. The hard work is done by Ryan Eatmon's Net::XMPP-modules, and you need to have them installed for Sendxmpp to work. Obviously, to use sendxmpp , you need a jabber account; they are freely available at jabber.org, but you can also run your own server. The good news is, instant messaging between the Google Talk servers and its clients uses an open protocol, XMPP, allowing users of other XMPP/Jabber clients to communicate with Google Talk users. For more information visit Sendxmpp Web Site.

This tutorial shows how you can compile and install SendXMPP on CentOS 5.5 server.

I do not issue any guarantee that this will work for you!

 

Install XMPP Perl Module

Net::XMPP provides a Perl user with access to the Extensible Messaging and Presence Protocol (XMPP).

perl -MCPAN -e shell
o conf prerequisites_policy follow
o conf commit
install Net::XMPP IO::Socket::SSL exit

 

Install SendXMPP

sendxmpp is a perl-script to send xmpp (jabber), similar to what mail does for mail. Google Talk servers and its clients uses an open protocol, XMPP, allowing users of other XMPP/Jabber clients to communicate with Google Talk users.

cd /tmp
wget http://sendxmpp.platon.sk/sendxmpp-0.0.8.tar.gz
tar -xvf sendxmpp-0.0.8.tar.gz
cd sendxmpp-0.0.8

NOTE!!! : Patch SendXMPP to work with Google Talk (GTalk)!

wget 'http://platon.sk/cvs/cvs.php/___checkout___/sendxmpp/sendxmpp?rev=1.22&content-type=text/plain' -O sendxmpp.orig
mv -f sendxmpp.orig sendxmpp
perl Makefile.PL
make
make install

NOTE1: this will install under /usr/local/. If you want to install somewhere else you could do : perl Makefile.PL PREFIX=/usr.

 

Create Sendxmpprc file

echo "# my account" > ~/.sendxmpprc
echo "[email protected];talk.google.com mygmailpassword" >> ~/.sendxmpprc
chmod 700 ~/.sendxmpprc
cp -v ~/.sendxmpprc /etc/sendxmpprc

 

Sendxmpp Examples

echo "This is a test IM" | sendxmpp -t -u mygmailuser -o gmail.com -p mygmailpassword [email protected]

The above example sends a "This is a test IM" text message from [email protected] account to the [email protected] account.

echo "This is a test IM" | sendxmpp -t -u mygmailuser -o gmail.com -p mygmailpassword [email protected] [email protected]

The above example sends a "This is a test IM" text message from [email protected] account to the [email protected] and [email protected] accounts.

echo "This is a test IM" | sendxmpp -t -u user1 -p pass1 -j jabber.org [email protected]

The above example sends a "This is a test IM" text message from [email protected] account to the [email protected] account.

echo "This is a test IM" | sendxmpp -f /etc/sendxmpprc -t -u mygmailuser -o gmail.com -p mygmailpassword [email protected]

The above example sends a "This is a test IM" text message from [email protected] account to the [email protected] account.

cd
vim .bashrc
echo "Logged into "$(hostname)" at "$(date) | sendxmpp -f /etc/sendxmpprc -t -u mygmailuser -o gmail.com -p mygmailpassword [email protected]

The above example sends an IM message when a user logs into the server.

 

Jabber IM Clients

1- Psi is a free instant messaging application designed for the Jabber IM network (including Google Talk). Fast and lightweight, Psi is fully open-source and compatible with Windows, Linux, and Mac OS X.
2- Pidgin, the universal chat client.
3- See more software clients on xmpp.org.

 

Jabber/XMPP Server List

See the followig link to find out which service provider(s) is good for you.

http://www.jabberes.org/servers/

 

SendXMPP Web Site: http://sendxmpp.platon.sk/
Iran Honeynet Project: http://www.honeynet.ir/
CentOS: http://www.centos.org/

Share this page:

4 Comment(s)

Add comment

Comments

From: Anonymous at: 2011-04-06 08:08:14

You can easilly raise: sudo apt-get install libio-socket-ssl-perl libnet-xmpp-perl

From: Anonymous at: 2011-11-27 16:45:53

Thanks for the hint. on Ubuntu Lucid Lynx (10.04) you can even proceed with

> sudo apt-get install sendxmpp

 

From: at: 2011-10-28 13:49:09

sendxmpp needs ca_root_nss

for FreeBSD it is:

/usr/ports/security/ca_root_nss

 

do not forget to add symlink

ln -s /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem

From: Lubomir Host at: 2012-10-27 21:04:09

Google Talk account in sendxmpp can be configured as follows:
echo "[email protected] your-secure-password gmail.com" > ~/.sendxmpprc
The latest version of sendxmpp can be installed very simply:
cd /tmp git clone https://github.com/lhost/sendxmpp.git cp sendxmpp/sendxmpp /usr/local/bin/ chmod 755 /usr/local/bin/sendxmpp
and then send test message using your google account:
echo "test `date`" | sendxmpp --tls [email protected]
With talk.google.com server you must use "--tls" or "-t" parameter.