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), ]
class TDS_Token_ColMetaData(Packet): name = "TDS Token COLMETADATA" # tds_type = TDS_TYPES_TABULAR_RESULT fields_desc = [ # ByteField("TokenType",0x81), LEShortField("Count", 1), # SQL Server 2005 is LEIntField # SQL Server 2000 is LEShortField LEShortField("UserType", 0), FlagsField("Status", 0x1, -16, TDS_ColMetaData_Flags), # TypeInfo section # the value obtained with MS SQLServer 2005 client and server ByteField("Type", 0x38), # 0x38 = INT4TYPE ByteField("ColNameLength", 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), ]
class MySQL_Result_Field(Packet): name = "MySQL Result Field" fields_desc = [ LengthCodedBinaryField("Catalog", None), LengthCodedBinaryField("Database", None), LengthCodedBinaryField("Table", None), LengthCodedBinaryField("ORGTable", None), LengthCodedBinaryField("Name", None), LengthCodedBinaryField("ORGName", None), ByteField("Filler", 0xc), LEShortField("CharSet", 0), LEIntField("Length", 0), XByteEnumField("Type", 0, MySQL_Field_Types), FlagsField("Flags", 0, -16, MySQL_Field_Flags), ByteField("Decimals", 0), LEShortField("Filler2", 0), LengthCodedBinaryField("Default", None), ]
class MySQL_Result_Error(Packet): name = "MySQL Result Error" fields_desc = [ ByteField("ResultMarker", 0xff), LEShortField("Errno", 0), StrFixedLenField("SQLStateMarker", b'#', 1), StrFixedLenField("SQLState", b' ' * 5, 5), StrField("Message", b'') ]
class MySQL_Server_Greeting(Packet): name = "MySQL Server Greeting" fields_desc = [ ByteField("ProtocolVersion", 10), StrNullField("ServerVersion", "5.0.54"), IntField("ThreadID", 4711), StrFixedLenField("ScrambleBuffer", "a" * 8, 8), ByteField("Filler0", 0), FlagsField( "ServerCapabilities", CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB | CLIENT_COMPRESS | CLIENT_PROTOCOL_41 | CLIENT_TRANSACTIONS | CLIENT_SECURE_CONNECTION, -16, MySQL_Capabilities), ByteField("ServerLanguage", 33), LEShortEnumField("ServerStatus", SERVER_STATUS_AUTOCOMMIT, MySQL_Server_Status), StrFixedLenField("Unused", b"", 13), StrNullField("Salt", " " * 12) ]
class MySQL_Result_OK(Packet): name = "MySQL Result OK" fields_desc = [ ByteField("ResultMarker", 0x00), LengthCodedIntField("AffectedRows", 0), LengthCodedIntField("InsertID", 0), LEShortEnumField("ServerStatus", SERVER_STATUS_AUTOCOMMIT, MySQL_Server_Status), LEShortField("WarningCount", 0), StrField("Message", b'') ]
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), ]
class MySQL_Client_Authentication(Packet): name = "MySQL Client Authentication" fields_desc = [ FlagsField("ClientCapabilities", 0, -16, MySQL_Capabilities), FlagsField("ClientExCapabilities", 0, -16, MySQL_Extended_Capabilities), LEIntField("MaxPacketSize", 0), ByteField("CharSetNumber", 0), StrFixedLenField("Filler", b"", 23), StrNullField("User", "bob"), LengthCodedBinaryField("ScrambleBuffer", b""), StrNullField("DatabaseName", b"") ]
class TDS_Login7_Request(Packet): name = "TDS Login7 Request" fields_desc = [ LEIntField("Length", 0), LEIntField("TDSVersion", 0), LEIntField("PacketSize", 0), LEIntField("ClientProgVer", 0), LEIntField("ClientPID", 0), LEIntField("PID", 0), FlagsField("OptionFlags1", 0, -8, TDS_OptionFlags1), FlagsField("OptionFlags2", 0, -8, TDS_OptionFlags2), FlagsField("TypesFlags", 0, -8, TDS_TypesFlags), FlagsField("OptionFlags3", 0, -8, TDS_OptionFlags3), LEIntField("ClientTimeZone", 0), # start of ClientLCID field LEShortField("LCID", 0x0), FlagsField("ColFlags", 0, -8, TDS_ColFlags), ByteField("Version", 0x0), # end of ClientLCID field # start of OffsetLength field LEShortField("ibHostName", 0), LEShortField("cchHostName", 0), LEShortField("ibUserName", 0), LEShortField("cchUserName", 0), LEShortField("ibPassword", 0), LEShortField("cchPassword", 0), LEShortField("ibAppName", 0), LEShortField("cchAppName", 0), LEShortField("ibServerName", 0), LEShortField("cchServerName", 0), LEShortField("ibUnused", 0), LEShortField("cbUnused", 0), LEShortField("ibCltIntName", 0), LEShortField("cchCltIntName", 0), LEShortField("ibLanguage", 0), LEShortField("cchLanguage", 0), LEShortField("ibDatabase", 0), LEShortField("cchDatabase", 0), StrFixedLenField("ClientID", "012345", 6), LEShortField("ibSSPI", 0), LEShortField("cbSSPI", 0), LEShortField("ibAtchDBFile", 0), LEShortField("cchAtchDBFile", 0), #LEShortField("ibChangePassword",0), # introduce in TDS 7.2 #LEShortField("ibChangePassword",0), # introduce in TDS 7.2 #LEIntField("cbSSPILong",0), # introduce in TDS 7.2 # end of OffsetLength field StrField("Payload", ""), ]
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), ]