Esempio n. 1
0
def build_role(account, role, key, add=True):
    '''build a request to add account to the role if add is True, if False
    build the request to remove account from the role'''
    if add:
        action = 'http://www.msn.com/webservices/AddressBook/AddMember'
        body = XmlManager.get('addmember', key, role, account)
    else:
        action = 'http://www.msn.com/webservices/AddressBook/DeleteMember'
        body = XmlManager.get('deletemember', key, role, account)

    return Request(action, 'omega.contacts.msn.com', 443,
        '/abservice/SharingService.asmx', body)
Esempio n. 2
0
def build_role(account, role, key, add=True):
    '''build a request to add account to the role if add is True, if False
    build the request to remove account from the role'''
    if add:
        action = 'http://www.msn.com/webservices/AddressBook/AddMember'
        body = XmlManager.get('addmember', key, role, account)
    else:
        action = 'http://www.msn.com/webservices/AddressBook/DeleteMember'
        body = XmlManager.get('deletemember', key, role, account)

    return Request(action, 'omega.contacts.msn.com', 443,
        '/abservice/SharingService.asmx', body)
Esempio n. 3
0
    def __init__(self, session, msg_queue, contact, message,
                  lockkey='', seq=1, first=True):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        me = session.contacts.me
        passport_id = session.extras['messengersecure.live.com']['security']
        nick = '=?%s?%s?=%s?=' % (
                'utf-8','B', me.display_name.encode('base64').strip())

        run_id = str(uuid4())

        content = message.encode('base64').strip()
        send_xml = XmlManager.get('sendoim', me.account, nick, common.MSNP_VER,
                                  common.BUILD_VER, contact, passport_id,
                                  challenge._PRODUCT_ID, str(lockkey),
                                  str(seq), run_id, str(seq), content)
        send_xml = send_xml.replace('\\r\\n', '\r\n')

        Requester.__init__(self, session,
          'http://messenger.live.com/ws/2006/09/oim/Store2',
          'ows.messenger.msn.com',443,'/OimWS/oim.asmx',
          send_xml.strip())

        self.contact = contact
        self.message = message
        self.oid = ''
        self.seq = seq
        self.first = first
        self.msg_queue = msg_queue

        log.debug('FROM:%s TO:%s' % (me.display_name, contact))
Esempio n. 4
0
    def __init__(self, session, msg_queue, contact, message,
                  lockkey='', seq=1, first=True):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        me = session.contacts.me
        passport_id = session.extras['messengersecure.live.com']['security']
        nick = '=?%s?%s?=%s?=' % (
                'utf-8','B', me.display_name.encode('base64').strip())

        run_id = str(uuid4())

        content = message.encode('base64').strip()
        send_xml = XmlManager.get('sendoim', me.account, nick, common.MSNP_VER,
                                  common.BUILD_VER, contact, passport_id,
                                  challenge._PRODUCT_ID, str(lockkey),
                                  str(seq), run_id, str(seq), content)
        send_xml = send_xml.replace('\\r\\n', '\r\n')

        Requester.__init__(self, session,
          'http://messenger.live.com/ws/2006/09/oim/Store2',
          'ows.messenger.msn.com',443,'/OimWS/oim.asmx',
          send_xml.strip())

        self.contact = contact
        self.message = message
        self.oid = ''
        self.seq = seq
        self.first = first
        self.msg_queue = msg_queue

        log.debug('FROM:%s TO:%s' % (me.display_name, contact))
Esempio n. 5
0
 def __init__(self, session, msg_queue):
     '''Return the mail data using soap if there are too many OIMs'''
     t, p = session.extras['messenger.msn.com']['security'][2:].split('&p=')
     xml_oim = XmlManager.get('getmaildata', t, p)
     Requester.__init__(
         self, session,
         'http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMetadata',
         'rsi.hotmail.com', 443, '/rsi/rsi.asmx', xml_oim)
     self.msg_queue = msg_queue
Esempio n. 6
0
    def do_passport_identification(self):
        '''do the passport identification and get our passport id'''
        hash_ = self.session.extras['hash'].split()[-1]
        template = XmlManager.get('passport',
            self.session.account.account, self.session.account.password)

        if '@msn.com' not in self.session.account.account:
            server = "login.live.com"
            url = "/RST.srf"
        else:
            server = "msnia.login.live.com"
            url = "/pp550/RST.srf"

        #create the headers
        headers = { \
          'Accept' :  'text/*',
          'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
          'Host' : server,
          'Content-Length' : str(len(template)),
          'Connection' : 'Keep-Alive',
          'Cache-Control' : 'no-cache'
        }

        succeeded = False

        for i in range(5):
            response = None

            # send the SOAP request
            for i in range(3):
                try:

                    conn = httplib.HTTPSConnection(server, 443)
                    conn.request('POST', url, template, headers)
                    response = conn.getresponse()
                    break
                except Exception, exception:
                    pass

            if response:
                data = response.read()
                dbg(data, 'worker', 3)
            else:
                self.session.add_event(e3.Event.EVENT_LOGIN_FAILED,
                 'Can\'t connect to HTTPS server: ' + str(exception))
                self._on_login_failed()

            if data.find('<faultcode>psf:Redirect</faultcode>') > 0:
                url = urlparse.urlparse(data.split('<psf:redirectUrl>')\
                    [1].split('</psf:redirectUrl>')[0])

                server = url[1]
                url = url[2]
            else:
                succeeded = True
                break
Esempio n. 7
0
 def __init__(self, session, oid, msg_queue):
     '''Delete a viewed oim'''
     t, p = session.extras['messenger.msn.com']['security'][2:].split('&p=')
     xml_del_oim = XmlManager.get('deleteoim', t, p, oid)
     Requester.__init__(
         self, session,
         'http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages',
         'rsi.hotmail.com', 443, '/rsi/rsi.asmx', xml_del_oim)
     self.msg_queue = msg_queue
     self.id = oid
Esempio n. 8
0
    def __init__(self, session, account):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/DeleteMember',
          'omega.contacts.msn.com', 443, '/abservice/SharingService.asmx',
          XmlManager.get('deletemember', get_key(session), 'Pending', account))

        self.account = account
Esempio n. 9
0
    def __init__(self, session, cid):
        '''constructor'''
        key = get_key(session, 'storage.msn.com', False)
        Requester.__init__(self, session,
            'http://www.msn.com/webservices/storage/w10/GetProfile',
            'storage.msn.com', 443, '/storageservice/SchematizedStore.asmx',
            XmlManager.get('getprofile', key, cid))

        self.session = session
        self.cid = cid
Esempio n. 10
0
    def __init__(self, session, cid):
        '''constructor'''
        key = get_key(session, 'storage.msn.com', False)
        Requester.__init__(self, session,
            'http://www.msn.com/webservices/storage/w10/GetProfile',
            'storage.msn.com', 443, '/storageservice/SchematizedStore.asmx',
            XmlManager.get('getprofile', key, cid))

        self.session = session
        self.cid = cid
Esempio n. 11
0
 def __init__(self, session, msg_queue):
     '''Return the mail data using soap if there are too many OIMs'''
     t, p = session.extras['messenger.msn.com']['security'][2:].split('&p=')
     xml_oim = XmlManager.get('getmaildata', t, p)
     Requester.__init__(self, session,
       'http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMetadata',
       'rsi.hotmail.com', 443 ,'/rsi/rsi.asmx',
       xml_oim
       )
     self.msg_queue = msg_queue
Esempio n. 12
0
    def __init__(self, session, account):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/DeleteMember',
          'omega.contacts.msn.com', 443, '/abservice/SharingService.asmx',
          XmlManager.get('deletemember', get_key(session), 'Pending', account))

        self.account = account
Esempio n. 13
0
    def __init__(self, session, gid, command_queue):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/ABGroupDelete', \
          'omega.contacts.msn.com', 443, '/abservice/abservice.asmx', \
          XmlManager.get('deletegroup', get_key(session), gid))

        self.gid = gid
        self.command_queue = command_queue
Esempio n. 14
0
    def __init__(self, session, name, command_queue):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/ABGroupAdd',
          'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
          XmlManager.get('addgroup', get_key(session), name))

        self.name = name
        self.command_queue = command_queue
Esempio n. 15
0
 def __init__(self, session, oid, msg_queue):
     '''Delete a viewed oim'''
     t, p = session.extras['messenger.msn.com']['security'][2:].split('&p=')
     xml_del_oim = XmlManager.get('deleteoim', t, p, oid)
     Requester.__init__(self, session,
       'http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages',
       'rsi.hotmail.com', 443 ,'/rsi/rsi.asmx',
       xml_del_oim
       )
     self.msg_queue = msg_queue
     self.id = oid
Esempio n. 16
0
    def __init__(self, session, gid, command_queue):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/ABGroupDelete', \
          'omega.contacts.msn.com', 443, '/abservice/abservice.asmx', \
          XmlManager.get('deletegroup', get_key(session), gid))

        self.gid = gid
        self.command_queue = command_queue
Esempio n. 17
0
    def __init__(self, session, name, command_queue):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/ABGroupAdd',
          'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
          XmlManager.get('addgroup', get_key(session), name))

        self.name = name
        self.command_queue = command_queue
Esempio n. 18
0
    def __init__(self, session, cid, account, alias, command_queue):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/ABContactUpdate',
          'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
          XmlManager.get('renamecontact', get_key(session), cid, alias))

        self.alias = alias
        self.account = account
        self.command_queue = command_queue
Esempio n. 19
0
    def do_passport_identification(self):
        '''do the passport identification and get our passport id'''
        hash_ = self.session.extras['hash'].split()[-1]
        template = XmlManager.get('passport', self.session.account.account,
                                  self.session.account.password)

        server = "login.live.com"
        url = "/RST.srf"

        #create the headers
        headers = { \
          'Accept' :  'text/*',
          'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
          'Host' : server,
          'Content-Length' : str(len(template)),
          'Connection' : 'Keep-Alive',
          'Cache-Control' : 'no-cache'
        }

        succeeded = False

        for i in range(5):
            response = None

            # send the SOAP request
            for i in range(3):
                try:

                    conn = httplib.HTTPSConnection(server, 443)
                    conn.request('POST', url, template, headers)
                    response = conn.getresponse()
                    break
                except Exception, exception:
                    pass

            if response:
                data = response.read()
                log.debug(data)
            else:
                self.session.add_event(
                    e3.Event.EVENT_LOGIN_FAILED,
                    'Can\'t connect to HTTPS server: ' + str(exception))
                self._on_login_failed()

            if data.find('<faultcode>psf:Redirect</faultcode>') > 0:
                url = urlparse.urlparse(data.split('<psf:redirectUrl>')\
                    [1].split('</psf:redirectUrl>')[0])

                server = url[1]
                url = url[2]
            else:
                succeeded = True
                break
Esempio n. 20
0
    def __init__(self, session, cid, account, alias, command_queue):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to
        send'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/ABContactUpdate',
          'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
          XmlManager.get('renamecontact', get_key(session), cid, alias))

        self.alias = alias
        self.account = account
        self.command_queue = command_queue
Esempio n. 21
0
 def __init__(self, session, oim_data, msg_queue):
     '''command_queue is a reference to a queue that is used
     by the worker to get commands that other threads need to
     send'''
     t, p = session.extras['messenger.msn.com']['security'][2:].split('&p=')
     xml_oim = XmlManager.get('getoim', t, p, oim_data['id'])
     Requester.__init__(
         self, session,
         'http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage',
         'rsi.hotmail.com', 443, '/rsi/rsi.asmx', xml_oim)
     self.msg_queue = msg_queue
     self.oim_data = oim_data
Esempio n. 22
0
    def __init__(self, session, nick, message):
        '''constructor'''
        key = get_key(session, 'storage.msn.com', False)
        cache_key = session.extras["CacheKey"]
        rid = session.extras["ResourceID"]
        self.nick = nick
        self.message = message
        Requester.__init__(self, session,
            'http://www.msn.com/webservices/storage/w10/UpdateProfile',
            'storage.msn.com', 443, '/storageservice/SchematizedStore.asmx',
            XmlManager.get('updateprofile', cache_key, key, rid, nick, message))

        self.session = session
Esempio n. 23
0
    def __init__(self, session, command_queue, on_login, started_from_cache):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to be
        sent, if on_login is true, then some commands need to be
        sent in order to inform the server about our contacts'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/ABFindAll',
          'contacts.msn.com', 443, '/abservice/abservice.asmx',
          XmlManager.get('dynamicitems', get_key(session)))

        self.command_queue = command_queue
        self.on_login = on_login
        self.started_from_cache = started_from_cache
Esempio n. 24
0
    def __init__(self, session, command_queue, on_login, started_from_cache):
        '''command_queue is a reference to a queue that is used
        by the worker to get commands that other threads need to be
        sent, if on_login is true, then some commands need to be
        sent in order to inform the server about our contacts'''
        Requester.__init__(self, session,
          'http://www.msn.com/webservices/AddressBook/ABFindAll',
          'contacts.msn.com', 443, '/abservice/abservice.asmx',
          XmlManager.get('dynamicitems', get_key(session)))

        self.command_queue = command_queue
        self.on_login = on_login
        self.started_from_cache = started_from_cache
Esempio n. 25
0
    def __init__(self, session, cid, account, src_gid, dest_gid, command_queue):
        TwoStageRequester.__init__(self, session, command_queue,
            Request(\
              'http://www.msn.com/webservices/AddressBook/ABGroupContactAdd',
              'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
              XmlManager.get('moveusertogroup', get_key(session), dest_gid,
                 cid)),
            Request(\
              'http://www.msn.com/webservices/AddressBook/ABGroupContactDelete',
              'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
              XmlManager.get('deleteuserfromgroup', get_key(session), cid,
                src_gid)),
            Request(\
              'http://www.msn.com/webservices/AddressBook/ABGroupContactDelete',
              'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
              XmlManager.get('deleteuserfromgroup', get_key(session), cid,
                dest_gid)))

        self.src_gid = src_gid
        self.dest_gid = dest_gid
        self.cid = cid
        self.account = account
Esempio n. 26
0
    def __init__(self, session, nick, message):
        '''constructor'''
        key = get_key(session, 'storage.msn.com', False)
        cache_key = session.extras["CacheKey"]
        rid = session.extras["ResourceID"]
        self.nick = nick
        self.message = message
        Requester.__init__(self, session,
            'http://www.msn.com/webservices/storage/w10/UpdateProfile',
            'storage.msn.com', 443, '/storageservice/SchematizedStore.asmx',
            XmlManager.get('updateprofile', cache_key, key, rid, nick, message))

        self.session = session
Esempio n. 27
0
 def __init__(self, session, oim_data, msg_queue):
     '''command_queue is a reference to a queue that is used
     by the worker to get commands that other threads need to
     send'''
     t, p = session.extras['messenger.msn.com']['security'][2:].split('&p=')
     xml_oim = XmlManager.get('getoim', t, p, oim_data['id'])
     Requester.__init__(self, session,
       'http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage',
       'rsi.hotmail.com', 443 ,'/rsi/rsi.asmx',
       xml_oim
       )
     self.msg_queue = msg_queue
     self.oim_data = oim_data
Esempio n. 28
0
    def __init__(self, session, cid, account, src_gid, dest_gid, command_queue):
        TwoStageRequester.__init__(self, session, command_queue,
            Request(\
              'http://www.msn.com/webservices/AddressBook/ABGroupContactAdd',
              'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
              XmlManager.get('moveusertogroup', get_key(session), dest_gid,
                 cid)),
            Request(\
              'http://www.msn.com/webservices/AddressBook/ABGroupContactDelete',
              'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
              XmlManager.get('deleteuserfromgroup', get_key(session), cid,
                src_gid)),
            Request(\
              'http://www.msn.com/webservices/AddressBook/ABGroupContactDelete',
              'omega.contacts.msn.com', 443, '/abservice/abservice.asmx',
              XmlManager.get('deleteuserfromgroup', get_key(session), cid,
                dest_gid)))

        self.src_gid = src_gid
        self.dest_gid = dest_gid
        self.cid = cid
        self.account = account