Find your invisible friends on Gmail

After google news in terminal i was much interested in playing with XMPP Extensible Messaging and Presence Protocol, my first mistake using it, gave me an idea of finding gmail friends who stay invisible, as i used to stay invisible most of the time, the idea made me learn many more steps and experiment more on it.

The below is the code that might help you to catch your hidden friends, but there is no program yet to make them reply!

The xmpp-py-docs gives the clear picture of what is used in the code below.
xmpp.Client(jid.getDomain(), debug=[]) the debug parameter, helps to switch to the debug mode.


sudo aptitude install python-xmpp python-dnspython

The few extra details :

>>> dir(node)

>>> ['DBG', 'DEBUG', 'DisconnectHandler', 'Namespace', 'Port', 'RegisterDisconnectHandler', 'Server', 'UnregisterDisconnectHandler', '_DEBUG', '__doc__', '__init__', '__module__', '_owner', '_registered_name', '_route', 'auth', 'connect', 'connected', 'debug_flags', 'defaultNamespace', 'disconnect_handlers', 'disconnected', 'event', 'getRoster', 'isConnected', 'reconnectAndReauth', 'sendInitPresence', 'sendPresence']

# One success
>>> Node.connect((Gserver,5222))
tcpsock._sslObj = socket.ssl(tcpsock._sock, None, None)

The code:

#!/usr/bin/env python
# Find invisible gmail
# Author Hemanth.HM
# Site :
# Licensed under GNU GPL Version 3

import xmpp
# Edit the below as per your need
ID = "[email protected]"
PASS = "password"
Gserver = ""

# Get the jabber id of the user from his email id 

# Client instnace 
# Check connection
if not Node.connect((Gserver,5222)):
    print "Could not connect to",Gserver

# Authentication of the user
if not Node.auth(jabberId.getNode(),PASS):
    print "Please check your password"

# Send roster request and initial <presence/>. 

# Handler  
def isVisible(con, event):
   if event.getType() == 'unavailable':
     print event.getFrom().getStripped()

# Register the defined handler.
# Register user callback as stanzas handler of declared type.
Node.RegisterHandler('presence', isVisible)

while Node.Process(1):
Share this