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:

5 Comment(s)