コード例 #1
0
ファイル: packets.py プロジェクト: phibos/dionaea
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'')
    ]
コード例 #2
0
ファイル: tds.py プロジェクト: phibos/dionaea
class TDS_Prelogin_Request(Packet):
    name = "TDS Prelogin Request"
    tds_type = TDS_TYPES_PRE_LOGIN
    fields_desc = [
        PacketField("VersionToken", TDS_Value(), TDS_Value),
        PacketField("EncryptionToken", TDS_Value(), TDS_Value),
        PacketField("InstanceToken", TDS_Value(), TDS_Value),
        PacketField("ThreadIDToken", TDS_Value(), TDS_Value),

        # Multiple Active Result Sets (MARS) has introduced in MSSQL Server 2005
        # To determine the existence of MARS TokenType
        # 0x04 is MARSToken
        # 0xFF is Terminator
        XByteField("MARSTokenOrTerminator", 0),
        ConditionalField(ShortField("MARSOffset", 0),
                         lambda x: x.MARSTokenOrTerminator == 0x04),
        ConditionalField(ShortField("MARSLen", 0),
                         lambda x: x.MARSTokenOrTerminator == 0x04),
        ConditionalField(XByteField("Terminator", 0),
                         lambda x: x.MARSTokenOrTerminator == 0x04),
        LEIntField("Version", 0),
        LEShortField("SubBuild", 0x0),
        ByteField("Encryption", 0),
        StrFixedLenField("InstanceOpt",
                         b'',
                         length_from=lambda x: x.InstanceToken.Len),
        LEIntField("ThreadID", 0),
        ConditionalField(ByteField("MARS", 0),
                         lambda x: x.MARSTokenOrTerminator == 0x04),
    ]
コード例 #3
0
ファイル: packets.py プロジェクト: phibos/dionaea
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)
    ]
コード例 #4
0
ファイル: packets.py プロジェクト: phibos/dionaea
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"")
    ]
コード例 #5
0
ファイル: tds.py プロジェクト: phibos/dionaea
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", ""),
    ]
コード例 #6
0
ファイル: tds.py プロジェクト: phibos/dionaea
class TDS_PreTDS7_Login_Request(Packet):
    name = "TDS Login PreTDS7 Request"
    fields_desc = [
        StrFixedLenField("ClientHostName", "", 30),
        ByteField("ClientHostNameLen", 0),
        StrFixedLenField("Username", "", 30),
        ByteField("UsernameLen", 0),
        StrFixedLenField("Password", "", 30),
        ByteField("PasswordLen", 0),
        StrFixedLenField("Junk", "", 31),
        StrFixedLenField("Magic", "", 16),
        StrFixedLenField("AppName", "", 30),
        ByteField("AppNameLen", 0),
        StrFixedLenField("ServerName", "", 30),
        ByteField("ServerNameLen", 0),
        StrFixedLenField("Password2", "", 256),
        XLEShortField("Version", 0),
        XLEShortField("UnusedProtocolField", 0),
        StrFixedLenField("LoginLibrary", "", 11),
        XLEIntField("ProgramVersion", 0),
        StrFixedLenField("Magic2", "", 3),
        StrFixedLenField("Language", "", 31),
        StrFixedLenField("Magic3", "", 3),
        StrFixedLenField("Charset", "", 31),
        StrFixedLenField("BlockSize", "", 6),
    ]