Пример #1
0
class TDS_Token_EnvChange(Packet):
    name = "TDS Token ENVCHANGE"
    #	tds_type = TDS_TYPES_TABULAR_RESULT
    fields_desc = [
        #		ByteField("TokenType",0xE3),
        LEShortField("Length", 27),  #FIXME: make a dynamic count?
        ByteField("Type", 1),  # 1 = Database
        FieldLenField("NewValueLen", 6, fmt='B', length_of="NewValue"),
        StrLenField("NewValue",
                    "master".encode('utf16')[2:],
                    length_from=lambda x: x.NewValueLen),
        FieldLenField("OldValueLen", 6, fmt='B', length_of="OldValue"),
        StrLenField("OldValue",
                    "master".encode('utf16')[2:],
                    length_from=lambda x: x.OldValueLen),
    ]
Пример #2
0
class TDS_Token_Language(Packet):
    name = "TDS5 Token Language"
    fields_desc = [
        #		XByteField("TokenType", 0x21),
        FieldLenField("Length", None, fmt="<I", length_of="Language"),
        ByteField("Status", 0),
        StrLenField("Language", "", length_from=lambda x: x.Length),
    ]
Пример #3
0
class TDS_Token_Info(Packet):
    name = "TDS Token INFO"
    fields_desc = [
        #		ByteField("TokenType",0xAB),
        LEShortField("Length", 118),  #FIXME: make a dynamic count?
        LEIntField("Number", 5701),
        ByteField("State", 2),
        ByteField("Class", 1),
        FieldLenField("MessageTextLen", 37, fmt='<H', length_of="MessageText"),
        StrLenField(
            "MessageText",
            "Changed database context to 'master'.".encode('utf16')[2:],
            length_from=lambda x: x.MessageTextLen),
        FieldLenField("ServerNameLen", 15, fmt='B', length_of="ServerName"),
        StrLenField("ServerName",
                    "HOMEUSER-3AF6FE".encode('utf16')[2:],
                    length_from=lambda x: x.ServerNameLen),
        FieldLenField("ProcNameLen", 0, fmt='B', length_of="ProcName"),

        #StrLenField("ProName", "", length_from=lambda x:x.ProcName),
        #LEIntField("LineNumber",1),
    ]
Пример #4
0
class TDS_Token_LoginACK(Packet):
    name = "TDS Token LOGINACK"
    #	tds_type = TDS_TYPES_TABULAR_RESULT
    fields_desc = [
        #		ByteField("TokenType",0xad),
        LEShortField("Length", 54),  #FIXME: make a dynamic count?
        ByteField("Interface", 1),
        #IntField("TDSVersion",0x730a0003),
        IntField("TDSVersion", 0x04020000),
        FieldLenField("ProgNameLen", 22, fmt='B', length_of="ProgName"),
        StrLenField("ProgName",
                    "Microsoft SQL Server\0\0".encode('utf16')[2:],
                    length_from=lambda x: x.ProgNameLen),
        ByteField("MajorVer", 9),
        ByteField("MinorVer", 0),
        ByteField("BuildNumHi", 5),
        ByteField("BuildNumLow", 119),
    ]