예제 #1
0
파일: directim.py 프로젝트: sgricci/digsby
class ODCHeader(Packable):
    '''
    Sent over direct IM connections for text messages, typing notifications,
    and photos.
    '''

    # All DirectIM communication is preceded by these headers:

    fmt = strlist('''
        version    4s      # always ODC2
        hdrlen     H       # length of header
        one        H       # 1
        six        H       # 6
        zero       H       # 0
        cookie     Q       # sixteen byte rendezvous cookie
        null       Q
        length     I
        encoding   H
        subset     H
        flags      I
        zero       I
        screenname 16s
        null2      16s ''')

    @classmethod
    def make(cls, *a, **k):
        'Makes a packable with default values filled in.'

        k.update(
            dict(version='ODC2',
                 static=76,
                 one=1,
                 six=6,
                 zero=0,
                 null=0,
                 null2='\0' * 16))
        return cls(*a, **k)

    # for the "flags" field above.
    bitflags = lookup_table({
        0x01: 'autoresponse',
        0x02: 'typingpacket',  # has typing info
        0x04: 'typed',
        0x08: 'typing',
        0x20: 'confirmation',
        0x40: 'mac_confirmation',
    })

    invars = [
        lambda o: o.version == 'ODC2',
    ]
예제 #2
0
import oscar
from util import lookup_table
import time, struct

rendezvous_tlvs = lookup_table({
    0x000a: 'request_num',
    0x000f: 'mystery',
    0x000e: 'locale',
    0x000d: 'encoding',
    0x000c: 'user_message',
    0x0002: 'proxy_ip',
    0x0016: 'proxy_ip_check',
    0x0003: 'client_ip',
    0x0005: 'external_port',
    0x0017: 'port_check',
    0x0010: 'proxy_flag',
    0x2711: 'extended_data',
    0x2712: 'filename_encoding',
    0x0004: 'verified_ip',
})

# Rendezvous file transfer messages are either REQUEST, CANCEL, or ACCEPT.
rdv_types = rendezvous_message_types = lookup_table(
    dict(
        request=0,
        cancel=1,
        accept=2,
    ))


def oscarcookie():
예제 #3
0
commands = lookup_table(
    logon=1,
    logoff=2,
    isaway=3,
    isback=4,
    idle=5,
    message=6,
    idact=7,
    iddeact=8,
    mailstat=9,
    userstat=10,
    newmail=11,
    chatinvite=12,
    calendar=13,
    newpersonalmail=14,
    newcontact=15,
    addident=16,
    addignore=17,
    ping=18,
    gotgrouprename=19,  # < 1, 36(old)
    sysmessage=20,
    skinname=21,
    passthrough2=22,
    confinvite=24,
    conflogon=25,
    confdecline=26,
    conflogoff=27,
    confaddinvite=28,
    confmsg=29,
    chatlogon=30,
    chatlogoff=31,
    chatmsg=32,
    gamelogon=40,
    gamelogoff=41,
    gamemsg=42,
    filetransfer=70,
    voicechat=74,
    notify=75,
    verify=76,
    p2pfilexfer=77,
    peertopeer=79,
    webcam=80,
    authresp=84,
    list=85,
    auth=87,
    addbuddy=131,
    rembuddy=132,
    ignorecontact=133,  # > 1, 7, 13 < 1, 66, 13
    rejectcontact=134,
    grouprename=137,
    keepalive=138,
    chatonline=150,
    chatgoto=151,
    chatjoin=152,
    chatleave=153,
    chatexit=155,
    chataddinvite=157,
    chatlogout=160,
    chatping=161,
    comment=168,
    stealth_perm=185,
    stealth_session=186,
    avatar=188,
    picture_checksum=189,
    picture=190,
    picture_update=193,
    picture_upload=194,
    invisible=197,
    yahoo6_status_update=198,
    avatar_update=199,
    audible=208,
    send_buddylist=211,
    # send_checksum = 212, # ????
    listallow=214,
    peerrequest=220,
    peersetup=221,
    peerinit=222,
    yahoo360=225,
    yahoo360update=226,
    movebuddy=231,
    awaylogin=240,
    list15=241,
    msg_ack=251,
    weblogin=550,
    sms_message=746,
    sms_login=748,
)
예제 #4
0
from contextlib import contextmanager
import oscar.snac as snac
import oscar
import common
import struct
from oscar.ssi import item, OscarSSIs, SSIException, ssi_err_types
from util import gen_sequence, lookup_table, callsback
from oscar.ssi.SSIItem import tuple_key

from logging import getLogger

log = getLogger("oscar.ssis")

# from functools import partial

property_tlv_types = lookup_table(alias=0x0131, email=0x0137, SMSnum=0x013A, comment=0x013C)


def _lowerstrip(s):
    return oscar._lowerstrip(s)


class SSIManager(object):
    def __init__(self, protocol):
        self.o = protocol
        self.ssis = OscarSSIs(self)
        self.ssi_edits_out = 0
        self.generated_ssi_ids = []

    #    @gen_sequence
    #    @callsback
예제 #5
0
import oscar
from util import lookup_table
import time, struct

rendezvous_tlvs = lookup_table({
    0x000a: 'request_num',
    0x000f: 'mystery',
    0x000e: 'locale',
    0x000d: 'encoding',
    0x000c: 'user_message',
    0x0002: 'proxy_ip',
    0x0016: 'proxy_ip_check',
    0x0003: 'client_ip',
    0x0005: 'external_port',
    0x0017: 'port_check',
    0x0010: 'proxy_flag',
    0x2711: 'extended_data',
    0x2712: 'filename_encoding',
    0x0004: 'verified_ip',
})

# Rendezvous file transfer messages are either REQUEST, CANCEL, or ACCEPT.
rdv_types = rendezvous_message_types = lookup_table(dict(
    request = 0,
    cancel  = 1,
    accept  = 2,
))


def oscarcookie():
    '''
예제 #6
0
commands = lookup_table(
    logon  =  1,
    logoff = 2,
    isaway = 3,
    isback = 4,
    idle = 5,
    message = 6,
    idact = 7,
    iddeact = 8,
    mailstat = 9,
    userstat = 10,
    newmail = 11,
    chatinvite = 12,
    calendar = 13,
    newpersonalmail = 14,
    newcontact = 15,
    addident = 16,
    addignore = 17,
    ping = 18,
    gotgrouprename = 19, # < 1, 36(old)
    sysmessage  = 20,
    skinname  = 21,
    passthrough2  = 22,
    confinvite  = 24,
    conflogon = 25,
    confdecline = 26,
    conflogoff = 27,
    confaddinvite = 28,
    confmsg = 29,
    chatlogon = 30,
    chatlogoff = 31,
    chatmsg  = 32,
    gamelogon  = 40,
    gamelogoff = 41,
    gamemsg  = 42,
    filetransfer  = 70,
    voicechat  = 74,
    notify = 75,
    verify = 76,
    p2pfilexfer = 77,
    peertopeer  = 79,
    webcam = 80,
    authresp  = 84,
    list = 85,
    auth  = 87,
    addbuddy  = 131,
    rembuddy = 132,
    ignorecontact = 133,    # > 1, 7, 13 < 1, 66, 13
    rejectcontact = 134,
    grouprename  = 137,
    keepalive    = 138,
    chatonline  = 150,
    chatgoto = 151,
    chatjoin = 152,
    chatleave = 153,
    chatexit  = 155,
    chataddinvite  = 157,
    chatlogout  = 160,
    chatping = 161,
    comment  = 168,
    stealth_perm = 185,
    stealth_session = 186,
    avatar  = 188,
    picture_checksum  = 189,
    picture  = 190,
    picture_update  = 193,
    picture_upload  = 194,
    invisible = 197,
    yahoo6_status_update  = 198,
    avatar_update  = 199,
    audible  = 208,
    send_buddylist = 211,
    # send_checksum = 212, # ????
    listallow = 214,

    peerrequest = 220,
    peersetup   = 221,
    peerinit    = 222,

    yahoo360 = 225,
    yahoo360update = 226,
    movebuddy = 231,
    awaylogin = 240,
    list15    = 241,
    msg_ack   = 251,
    weblogin  = 550,
    sms_message = 746,
    sms_login = 748,


)
예제 #7
0
from contextlib import contextmanager
import oscar.snac as snac
import oscar
import common
import struct
from oscar.ssi import item, OscarSSIs, SSIException, ssi_err_types
from util import gen_sequence, lookup_table, callsback
from oscar.ssi.SSIItem import tuple_key

from logging import getLogger
log = getLogger("oscar.ssis")

#from functools import partial

property_tlv_types = lookup_table(alias=0x0131,
                                  email=0x0137,
                                  SMSnum=0x013A,
                                  comment=0x013C)


def _lowerstrip(s):
    return oscar._lowerstrip(s)


class SSIManager(object):
    def __init__(self, protocol):
        self.o = protocol
        self.ssis = OscarSSIs(self)
        self.ssi_edits_out = 0
        self.generated_ssi_ids = []

#    @gen_sequence