예제 #1
0
파일: services.py 프로젝트: sgricci/digsby
    def serviceHeaders(self, client, to = None, **k):
        PC = Schema.GED(MSNS.HMNS.RSI, "PassportCookie").pyclass()
        ticket = client.get_ticket(self.SSO_Domain)

        token_parts = util.fmt_to_dict('&', '=')(ticket.token)

        PC.T = token_parts.get('t', '')
        PC.P = token_parts.get('p', '')

        return PC,
예제 #2
0
파일: login2.py 프로젝트: sgricci/digsby
    return '@\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00' + pack_pstr(
            '\x00' + pack_pstr(password) +\
            '\x00\x03\x00\x01' +\
            '\x00\x05UTF-8' +\
            '\x00\x02' +\
            '\x00\x02en' +\
            '\x00\x03' +\
            '\x00\x02US')


import socket, ssl
from struct import pack

from util import fmt_to_dict

SiteState = fmt_to_dict('|', ':')


def do_https(v):
    s = socket.SocketType()
    s.connect(('kdc.uas.aol.com', 443))
    s = ssl.wrap_socket(s)
    s.write(v)
    return s


def make_packet(un, password):
    #i0 are two "random bytes", not sure what the restrictions here are
    n = top3 + 'i0' + middle
    n += pack_pstr(un)
    n += m2
예제 #3
0
from urllib2 import urlopen, quote, unquote, Request, HTTPError, URLError

from hashlib import sha1
from hmac import HMAC

import logging

log = logging.getLogger('mail.passport')

import util
import util.xml_tag
import util.packable as packable
import util.primitives.bits as bits
import util.primitives.funcs as funcs

csd_to_dict = util.fmt_to_dict(',', '=')


def escape(s):
    return s.encode('xml').replace("'", ''')


def unescape(s):
    return s.decode('xml')


class SecurityTokenRequest(object):
    def __init__(self, id, domain, policyref):
        id = 'RST%d' % id
        util.autoassign(self, locals())
        self.__gotdata = False
예제 #4
0
def base64_decode(s):
    return s.decode('base64')

def utf16_encode(str):
    try:
        return unicode(str, 'utf-16')
    except TypeError:
        if isinstance(str, unicode):
            return str.encode('utf-16')
        else:
            return fuzzydecode(s, 'utf-8').encode('utf-16')

def utf16_decode(str):
    return str.decode('utf-16')

mime_to_dict = fmt_to_dict(';','=')
csd_to_dict  = fmt_to_dict(',','=')

def mime_to_storage(str):
    '''
    turn mime headers into a storage object
    '''
    info = mime_to_dict(str)
    for k in info.keys():
        info[pythonize(k)] = info[k]

    return to_storage(info)

def csd_to_storage(str):
    '''
    turn mime headers into a storage object
예제 #5
0
from urllib2 import urlopen, quote, unquote, Request, HTTPError, URLError

from hashlib import sha1
from hmac import HMAC

import logging
log = logging.getLogger('mail.passport')

import util
import util.xml_tag
import util.packable as packable
import util.primitives.bits as bits
import util.primitives.funcs as funcs

csd_to_dict = util.fmt_to_dict(',','=')

def escape(s):
    return s.encode('xml').replace("'", ''')

def unescape(s):
    return s.decode('xml')

class SecurityTokenRequest(object):
    def __init__(self, id, domain, policyref):
        id = 'RST%d'%id
        util.autoassign(self, locals())
        self.__gotdata = False
        self._received = None

    def _set_received(self, val):
        self._received = val
예제 #6
0
파일: login2.py 프로젝트: AlexUlrich/digsby
def make_remainder(password):
    return '@\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00' + pack_pstr(
            '\x00' + pack_pstr(password) +\
            '\x00\x03\x00\x01' +\
            '\x00\x05UTF-8' +\
            '\x00\x02' +\
            '\x00\x02en' +\
            '\x00\x03' +\
            '\x00\x02US')

import socket, ssl
from struct import pack

from util import fmt_to_dict

SiteState = fmt_to_dict('|',':')

def do_https(v):
    s = socket.SocketType()
    s.connect(('kdc.uas.aol.com', 443))
    s = ssl.wrap_socket(s)
    s.write(v)
    return s

def make_packet(un, password):
    #i0 are two "random bytes", not sure what the restrictions here are
    n = top3 + 'i0' + middle
    n += pack_pstr(un)
    n += m2
    r = make_remainder(password)
    n += pack('!H', len(r))
예제 #7
0
    def get_ticket(self, key=None):
        if key is None:
            return self.ticket

        else:
            return fmt_to_dict('&','=')(self.ticket)[key]
예제 #8
0
파일: MSNUtil.py 프로젝트: sgricci/digsby
def utf16_encode(str):
    try:
        return unicode(str, 'utf-16')
    except TypeError:
        if isinstance(str, unicode):
            return str.encode('utf-16')
        else:
            return fuzzydecode(s, 'utf-8').encode('utf-16')


def utf16_decode(str):
    return str.decode('utf-16')


mime_to_dict = fmt_to_dict(';', '=')
csd_to_dict = fmt_to_dict(',', '=')


def mime_to_storage(str):
    '''
    turn mime headers into a storage object
    '''
    info = mime_to_dict(str)
    for k in info.keys():
        info[pythonize(k)] = info[k]

    return to_storage(info)


def csd_to_storage(str):