Skip to main content

Hi, I'm Mariano Guerra, below is my blog, if you want to learn more about me and what I do check a summary here: marianoguerra.github.io or find me on twitter @warianoguerra or mastodon @marianoguerra@vis.social

msn gateway

este blog esta cada vez mas geek pero como no lo lee nadie posteo lo que se me da la gana

escribi esta clase (no terminada) para poder conectarse al messenger mediante el puerto
80 mandando request http (como hace el gaim), osea que si tenes un proxy por el puerto 80 estas hecho, probablemente sea la unica implementacion para proxy en el emesene (la parte de proxy no esta implementada todavia :P).


import httplib
import urllib
import urllib2

#terminar
class Proxy:

def __init__( self , host , port , user , password ):

self.host = str( host )
self.port = port
self.user = str( user )
self.password = str( password )

class HttpMethod:

def __init__( self , host , port , path, proxy = None ):
self.host = str( host )
self.path = str( path )
self.port = port
self.proxy = proxy

self.response = ""
self.data = ""
self.headers = {}
self.headers[ "Accept" ] = "*/*"
self.headers[ "Accept-Language" ] = "en-us"
self.headers[ "Accept-Encoding" ] = "gzip, deflate"
self.headers[ "User-Agent" ] = "MSMSGS"
self.headers[ "Host" ] = "gateway.messenger.hotmail.com"
self.headers[ "Proxy-Connection" ] = "Keep-Alive"
self.headers[ "Connection" ] = "Keep-Alive"
self.headers[ "Pragma" ] = "no-cache"
self.headers[ "Content-Type" ] = "application/x-msn-messenger"
self.headers[ "Content-Length" ] = "18"

self.request = None
self.connection = httplib.HTTPConnection( self.host + ":" + str( self.port ) )

def send( self , message ):
self.headers[ "Content-Length" ] = str( len( message ) )
self.connection.request( "POST" , self.path , message , self.headers )

def recv( self ):
response = self.connection.getresponse()
self.response = response.read()

return self.response

if __name__ == "__main__":
h = HttpMethod( "gateway.messenger.hotmail.com" , 80 , "/gateway/gateway.dll?Action=open&Server=NS&IP=messenger.hotmail.com" )
h.send( "VER 1 MSNP9 CVR0\r\n" )
print h.recv()

Comments

Comments powered by Disqus