Tag Archives: XMPP

XMPP, Pidgin and Openfire: Capturing a message packet

This weekend Pritam sir and I sat again to nail the problem of hacking chat messages from Openfire server. As expected, we started afresh (our failing memories :D). Here are the takeaways:

  • Our pidgin client (version 2.10) could not connect (error: Not authorized). Add your buddy carefully. Username/ password, domain (IP address of hosting Openfire server) and in advanced setting, enter connect server (IP address of hosting Openfire server) and port 5222/5223 (Check Openfire admin console for confirmation)
  • If still you see the above problem, restart the server.

$ ./bin/openfire stop
$ ./bin/openfire start

  • It is straightforward and easy to create a plugin to play around with Openfire. Our experiment is centred around motd and contentFIlter plugins.
  • We found Interface PacketInterceptor (used in contentFilter) and we plan to exploit it for our devellish purpose.

To Do

  1. Enabling debug messages in Openfire
  2. Learning life cycle of PacketInterceptor

If you wish to refer Part-I: XMPP, Openfire and Pidgin: A weekend buffet.


XMPP, Openfire and Pidgin: A weekend buffet

My friend Pritam and I have embarked on a small walk to chat-world. The objects are XMPP based Openfire, and Pidgin. Our objective is to create a XMPP based private chat server that we would later host on a private IP. We plan to develop a plugin for customized behavior of server towards a client.


Because it is widely used standard for message-oriented communication. XMPP wiki is here.

Why Openfire? Because it is popular, free and open.

Our first day

– Installing Openfire is simple and so is configuring, adding users, and going online. In your local network, it is advisable to turn-off firewall. Read more here about cryptic Openfire parameters.

– Installing Pidgin is simple. You should be able to connect to your local chat server in an hour.

– We wanted our server to interact with all users and we found “Message of the Day” plugin. This plugin is part of Openfire sources. Code is in Java. We played with the code of this plugin and enjoyed different behaviors.

– Building Openfire sources requires Apache ANT and JRE 1.5 or higher. You can find more details here.

After downloading the Openfire sources, you would find “plugin” directory that has sources for “Message of the Day”. We have to build it. A build for plugin is as following which builds all plugins:

xyz@localhost:~/Downloads/openfire/src/openfire_src/build> ~/apps/netbeans-6.9.1/java/ant/bin/ant plugins

– This run will build all plugins. Our plugin is created as “motd.jar”. Check if the “JAR” is created.

xyz@localhost:~/Downloads/openfire/src/openfire_src/build> ll ../target/openfire/plugins/motd.jar

– Now we have your plugin ready and we deploy it in our Openfire instance. Deployment is trivial. We have to copy the new JAR file to plugins directory of Openfire. It will automatically create the necessary directory structure for our plugin.

xyz@localhost:~/Downloads/openfire/src/openfire_src/build> cp ../target/openfire/plugins/motd.jar ~/Downloads/openfire/plugins/
xyz@localhost:~/Downloads/openfire/src/openfire_src/build> ll !$
ll ~/Downloads/openfire/plugins/
total 60
drwxr-xr-x 3 xyz users 4096 2011-10-02 03:22 admin
drwxr-xr-x 5 xyz users 4096 2012-05-06 20:16 motd
-rw-r--r-- 1 xyz users 12621 2012-05-06 20:28 motd.jar
xyz@localhost:~/Downloads/openfire/src/openfire_src/build> ll ~/Downloads/openfire/plugins/
total 60
drwxr-xr-x 3 xyz users 4096 2011-10-02 03:22 admin
drwxr-xr-x 5 xyz users 4096 2012-05-06 20:28 motd
-rw-r--r-- 1 xyz users 12621 2012-05-06 20:28 motd.jar

– We played with different type of messages that we can send to a newly joined client. Then we dissected the Session type, hostname and many other useful attributes including Packets, Messages. One example is that the message of the day now tells the user his name 😛

(8:30:27 PM) localhost: vishal@localhost/59b71259

This is the message from the Openfire server to a client as soon as the client creates a session.

– You should keep Openfire API handy with you.

– We have planned to do a few more experiments in coming weeks to understand:

  • How XMPP server processes client connections?
  • How to receive and send packet to a client?
  • Could it be possible to get a slimmer Openfire 😉