home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 October / maximum-cd-2011-10.iso / DiscContents / digsby_setup.exe / lib / yahoo / yahoosip.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-06-22  |  2.4 KB  |  61 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import uuid
  5. import socket
  6. server_ip_port = '98.138.26.129:443'
  7.  
  8. def send():
  9.     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  10.     (host, port) = server_ip_port.split(':')
  11.     port = int(port)
  12.     print 'connecting to', (host, port)
  13.     s.connect((host, port))
  14.     packet = register('digsby01')
  15.     print 'sending packet'
  16.     s.sendall(packet)
  17.     print 'receiving data'
  18.     print s.recv(50)
  19.     s.close()
  20.  
  21.  
  22. def register(yahoo_username, branch = None, call_id = None):
  23.     if branch is None:
  24.         branch = uuid.uuid4()
  25.     
  26.     if call_id is None:
  27.         call_id = uuid.uuid4()
  28.     
  29.     random_tag = uuid.uuid4().hex[:8]
  30.     local_port_ip = '127.0.0.1:5061'
  31.     my_contact_ip = '127.0.0.1:443'
  32.     contact_id = '<sip:%s@%s;transport=tcp>' % (yahoo_username, my_contact_ip)
  33.     to_id = '<sip:%s@%s;transport=tcp>' % (yahoo_username, server_ip_port)
  34.     from_id = '<sip:%s@%s>;tag=%s' % (yahoo_username, server_ip_port, random_tag)
  35.     call_id = 'f3e9ee72-6270-42d8-a058-a6c3f34cfce2'
  36.     lines = [
  37.         ('Via', 'SIP/2.0/TCP %s;branch=%s' % (local_port_ip, branch)),
  38.         ('Max-Forwards', '70'),
  39.         ('Contact', contact_id),
  40.         ('To', to_id),
  41.         ('From', from_id),
  42.         ('Call-ID', call_id),
  43.         ('CSeq', '1 REGISTER'),
  44.         ('Expires', '3600'),
  45.         ('User-Agent', 'Yahoo Voice,2.0'),
  46.         ('Content-Length', '0'),
  47.         ('Y-User-Agent', 'intl=us; os-version=w-2-6-1; internet-connection=lan; cpu-speed=2653; pstn-call-enable=true; appid=10.0.0.1270')]
  48.     verb = 'REGISTER'
  49.     action = '%s sip:%s;transport=tcp SIP/2.0' % (verb, server_ip_port)
  50.     header_lines = [ '%s: %s' % (k, v) for k, v in lines ]
  51.     return '\r\n'.join([
  52.         action] + header_lines) + '\r\n'
  53.  
  54.  
  55. def main():
  56.     send()
  57.  
  58. if __name__ == '__main__':
  59.     main()
  60.  
  61.