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.
Prerequisite:
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)
'tls'
The code:
#!/usr/bin/env python # Find invisible gmail # Foundu.py # Author Hemanth.HM # Site : www.h3manth.com # Licensed under GNU GPL Version 3 import xmpp # Edit the below as per your need ID = "[email protected]" PASS = "password" Gserver = "gmail.com" # Get the jabber id of the user from his email id jabberId=xmpp.protocol.JID(ID) # Client instnace Node=xmpp.Client(jabberId.getDomain(),debug=[]) # 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/>. Node.sendInitPresence(requestRoster=1) # 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): pass
Recent blog posts
- watir-webdriver web inspector
- gem list to gemfile
- Packing ruby2.0 on debian.
- Made it into The Guinness Book!
- to_h in ruby 2.0
- Filter elements by pattern jQuery.
- Better HTML password fields for mobile ?
- Grayscale image when user offline
- nth-child CSS pseudo-class Christmas colors
- EventEmitter in nodejs