class TbFolderMap(Base): __tablename__ = 'tb_FolderMap' folder_id = Column(INTEGER, primary_key=True, nullable=False) folder_path = Column(NVARCHAR(450)) cm_guid = Column(CHAR(36), nullable=False) lastupdatetime = Column(DATETIME(36))
class TbWebSecurityLog(Base): __tablename__ = 'tb_WebSecurityLog' id = Column(INTEGER, primary_key=True, nullable=False) MsgLogID = Column(CHAR(36)) CLF_MsgLogType = Column(INTEGER) CLF_EntityID = Column(CHAR(36)) CLF_LogVersion = Column(INTEGER) CLF_LogMinorVersion = Column(VARCHAR(10)) CLF_ManagerID = Column(CHAR(36)) CLF_ComputerName = Column(NVARCHAR(128)) CLF_ProductType = Column(INTEGER) CLF_ProductVersion = Column(VARCHAR(21)) CLF_ProductPlatformCode = Column(INTEGER) CLF_ProductLanguageCode = Column(INTEGER) CLF_ServerityCode = Column(INTEGER) CLF_ComponentCode = Column(INTEGER) CLF_LogReplicatedFlag = Column(BIT) CLF_LogGenerationTime = Column(DATETIME) CLF_LogGenerationTimeZone = Column(VARCHAR(10)) CLF_LogReceivedTime = Column(DATETIME) CLF_LogReceivedUTCTime = Column(DATETIME) CLF_LogReceivedTimeZone = Column(VARCHAR(10)) CLF_IsDayLightSaving = Column(INTEGER) CLF_ReasonCode = Column(VARCHAR(64)) CLF_ReasonCodeSource = Column(INTEGER) CLF_ReasonCodeSymbol = Column(VARCHAR(64)) CLF_ReasonCodeDescription = Column(NVARCHAR(1024)) CLF_RedAlertID = Column(VARCHAR(36)) SLF_ObjectNameURL = Column(NVARCHAR(1024)) SLF_ClientIP = Column(VARCHAR(256)) SLF_ClientHostName = Column(VARCHAR(128)) SLF_FileName = Column(NVARCHAR(254)) SLF_BlockingType = Column(INTEGER) SLF_BlockingRule = Column(NVARCHAR(1024)) SLF_Direction = Column(INTEGER) SLF_Protocol = Column(INTEGER) SLF_ServerIP = Column(VARCHAR(256)) SLF_ServerPort = Column(INTEGER) SLF_ClientGuid = Column(CHAR(36)) SLF_LoginUser = Column(NVARCHAR(128)) SLF_UserAgentType = Column(INTEGER) SLF_DetectionType = Column(INTEGER) SLF_SeverityLevel = Column(INTEGER) SLF_CredibilityLevel = Column(INTEGER) SLF_RatingThreshold = Column(INTEGER) SLF_ReputationScore = Column(INTEGER) SLF_PolicyName = Column(NVARCHAR(256)) SLF_Action = Column(INTEGER) SLF_Reason = Column(NVARCHAR(1024)) AggregatedUTCDatetime = Column(DATETIME) AggregatedLocalDatetime = Column(DATETIME) AggregatedCount = Column(INTEGER) UserGroupName = Column(NVARCHAR(128)) SLF_Is_CCCA_Detection = Column(INTEGER) SLF_CCCA_DetectionSource = Column(INTEGER) SLF_CCCA_RiskLevel = Column(INTEGER) SLF_CCCA_Destination = Column(VARCHAR(2048)) SLF_CCCA_DestinationFormat = Column(INTEGER) SLF_ProcessName = Column(NVARCHAR(256)) SLF_UserMail = Column(NVARCHAR(450)) SLF_URLCorrelationKey = Column(VARCHAR(64)) CE_FilterID = Column(VARCHAR(35)) CLF_LogGenCMLocalTime = Column(DATETIME)
class TbADUserSyncJournal(Base): __tablename__ = 'tb_AD_UserSyncJournal' id = Column(INTEGER, primary_key=True, nullable=False) LUT = Column(DATETIME, nullable=False) Status = Column(INTEGER) Remark = Column(NVARCHAR(256))
class TbLogDataLossPrevention(Base): __tablename__ = 'tb_LogDataLossPrevention' CMGuid = Column(CHAR(36)) id = Column(INTEGER, primary_key=True, nullable=False) MsgLogID = Column(CHAR(36), nullable=False) LogReceivedTime = Column(DATETIME) LogReceivedUTCTime = Column(DATETIME) LogReceivedTimeZone = Column(VARCHAR(10)) SLF_ProductGUID = Column(CHAR(36), nullable=False) SLF_MsgType = Column(INTEGER) SLF_ClientGUID = Column(CHAR(36)) SLF_ProductID = Column(INTEGER) SLF_LogVersion = Column(INTEGER) SLF_LogMinorVersion = Column(INTEGER) SLF_ComputerName = Column(NVARCHAR(128)) SLF_LogGenUTCDatetime = Column(DATETIME) SLF_LogGenLocalDatetime = Column(DATETIME) SLF_TimeZoneInMins = Column(INTEGER) SLF_DaylightSavingInMins = Column(INTEGER) SLF_IPAddress = Column(VARCHAR(32)) SLF_MACAddressList = Column(VARCHAR(2048)) SLF_InfectedHostName = Column(NVARCHAR(64)) SLF_UserName = Column(NVARCHAR(64)) SLF_Recipient = Column(NVARCHAR(1024)) SLF_Subject = Column(NVARCHAR(1024)) SLF_FilePath = Column(NVARCHAR(256)) SLF_Filename = Column(NVARCHAR(256)) SLF_SourcePort = Column(INTEGER) SLF_DestinationIP = Column(VARCHAR(256)) SLF_DestinationPort = Column(INTEGER) SLF_UserDomain = Column(NVARCHAR(256)) SLF_ComputerDomain = Column(NVARCHAR(256)) SLF_UserDepartment = Column(NVARCHAR(256)) SLF_Sender = Column(NVARCHAR(256)) SLF_URL = Column(VARCHAR(1024)) SLF_FTPUserName = Column(NVARCHAR(256)) SLF_ProcessName = Column(NVARCHAR(256)) SLF_OfflineFlag = Column(INTEGER) SLF_ContentType = Column(INTEGER) SLF_ForensicCaptured = Column(INTEGER) SLF_ForensicFilePath = Column(NVARCHAR(260)) SLF_MatchedContent = Column(NVARCHAR(128)) SLF_Channel = Column(INTEGER) PolicyID = Column(UNIQUEIDENTIFIER) SLF_UserGuid = Column(CHAR(36)) ViolationID = Column(NVARCHAR(36)) ForensicDataFileHash = Column(VARCHAR(128)) RuleNames = Column(NVARCHAR) TemplateNames = Column(NVARCHAR) Actions = Column(NVARCHAR) Reason = Column(NVARCHAR(1024)) SeverityCode = Column(INTEGER) Status = Column(INTEGER) Description = Column(NVARCHAR(1024)) FileDownloadRetCode = Column(INTEGER) Destination = Column(NVARCHAR(1024)) SLF_FileSize = Column(BIGINT) CE_FilterID = Column(VARCHAR(35)) CLF_LogGenCMLocalTime = Column(DATETIME)
class TbRegTmpEntityInfo(Base): __tablename__ = 'tb_RegTmp_EntityInfo' id = Column(INTEGER, primary_key=True, nullable=False) EI_EntityID = Column(CHAR(36), nullable=False) EI_AgentID = Column(CHAR(36), nullable=False) EI_ParentID = Column(CHAR(36), nullable=False) EI_ManagerID = Column(CHAR(36), nullable=False) EI_State = Column(INTEGER) EI_Type = Column(INTEGER) EI_SerialNumber = Column(VARCHAR(60)) EI_ProductType = Column(INTEGER, nullable=False) EI_ProductVersion = Column(VARCHAR(19)) EI_ProductLanguage = Column(INTEGER) EI_SetupTime = Column(DATETIME) EI_LastRegistrationTime = Column(DATETIME) EI_LastLogonTime = Column(DATETIME) EI_LastLogoffTime = Column(DATETIME) EI_CacheToken = Column(VARCHAR(256)) EI_UpdateSourceID = Column(CHAR(36)) EI_MenuVersion = Column(VARCHAR(8)) EI_ProductBuildNumber = Column(VARCHAR(24)) EI_LastStartupTime = Column(DATETIME) EI_PatternNumber = Column(VARCHAR(19)) EI_PatternLastUpdateTime = Column(DATETIME) EI_SpamRuleNumber = Column(VARCHAR(8)) EI_SpamRuleLastUpdateTime = Column(DATETIME) EI_SpamRuleFilename1 = Column(VARCHAR(16)) EI_SpamRule1LastUpdateTime = Column(DATETIME) EI_SpamRuleFilename2 = Column(VARCHAR(16)) EI_SpamRule2LastUpdateTime = Column(DATETIME) EI_DCTNumber = Column(VARCHAR(19)) EI_DCTLastUpdateTime = Column(DATETIME) EI_OS_Name = Column(NVARCHAR(128)) EI_OS_Version = Column(VARCHAR(64)) EI_OS_SPVersion = Column(VARCHAR(32)) EI_OS_Language = Column(INTEGER) EI_OS_ContryCode = Column(VARCHAR(8)) EI_OS_MachineName = Column(NVARCHAR(64)) EI_IPAddressList = Column(VARCHAR(1024)) EI_MACAddressList = Column(VARCHAR(256)) EI_DomainName = Column(NVARCHAR(64)) EI_PrivateAttribute = Column(IMAGE) EI_Timezone = Column(VARCHAR(8)) EI_LastNotifyTime = Column(DATETIME) EI_AgentVersion = Column(VARCHAR(64)) EI_CAVRule = Column(VARCHAR(19)) EI_CAVRuleUpdateTime = Column(DATETIME) EI_Pattern2Version = Column(VARCHAR(19)) EI_Pattern2VersionUpdateTime = Column(DATETIME) EI_VATVersion = Column(VARCHAR(19)) EI_VATVersionUpdateTime = Column(DATETIME) EI_VIVersion = Column(VARCHAR(19)) EI_VIVersionUpdateTime = Column(DATETIME) EI_SpywareVersion = Column(VARCHAR(19)) EI_SpywareLastUpdateTime = Column(DATETIME) EI_CFWVersion = Column(VARCHAR(19)) EI_CFWLastUpdateTime = Column(DATETIME) EI_SpyCleanUpVersion = Column(VARCHAR(19)) EI_SpyCleanUpLastUpdateTime = Column(DATETIME) EI_GroupName = Column(NVARCHAR(64)) EI_ASpyVersion = Column(VARCHAR(19)) EI_ASpyLastUpdateTime = Column(DATETIME) EI_AgentBuild = Column(INTEGER)
class TbReportLabelScopeTmp(Base): __tablename__ = 'tb_ReportLabelScopeTmp' GUID = Column(CHAR(36), primary_key=True, nullable=False) ResourceType = Column(NVARCHAR(64))
class TbInventoryTagScope(Base): __tablename__ = 'tb_Inventory_TagScope' TagID = Column(VARCHAR(16)) ObjectID = Column(NVARCHAR(64), primary_key=True, nullable=False)
class TbApplicationControlEvent(Base): __tablename__ = 'tb_ApplicationControlEvent' CMGuid = Column(CHAR(36)) id = Column(INTEGER, primary_key=True, nullable=False) MsgLogID = Column(CHAR(36), nullable=False) LogReceivedTime = Column(DATETIME) LogReceivedUTCTime = Column(DATETIME) LogReceivedTimeZone = Column(VARCHAR(10)) SLF_ProductGUID = Column(CHAR(36), nullable=False) SLF_MsgType = Column(INTEGER) SLF_ClientGUID = Column(CHAR(36), nullable=False) SLF_ProductID = Column(SMALLINT) SLF_LogVersion = Column(SMALLINT, nullable=False) SLF_LogMinorVersion = Column(SMALLINT, nullable=False) SLF_ComputerName = Column(NVARCHAR(128)) SLF_LogGenUTCDatetime = Column(DATETIME, nullable=False) SLF_LogGenLocalDatetime = Column(DATETIME, nullable=False) SLF_TimeZoneInMins = Column(SMALLINT, nullable=False) SLF_DaylightSavingInMins = Column(SMALLINT, nullable=False) SLF_ClientHostName = Column(NVARCHAR(64)) SLF_ProductServerPatternVersion = Column(VARCHAR(64)) SLF_ClientUserGUID = Column(CHAR(36)) SLF_ClientUserName = Column(NVARCHAR(64)) SLF_ClientUserDomain = Column(NVARCHAR(256)) SLF_ClientUserDepartment = Column(NVARCHAR(256)) SLF_ClientIPAddressList = Column(VARCHAR(256)) SLF_ClientMachineArchitecture = Column(VARCHAR(64)) SLF_ClientNotficationMessage = Column(NVARCHAR(256)) SLF_ClientNotficationMessageUTCDatetime = Column(DATETIME) SLF_ClientSynchronizationUTCDatetime = Column(DATETIME(2)) SLF_ClientPolicyChangedUTCDatetime = Column(DATETIME) SLF_ClientStatus = Column(SMALLINT) SLF_ApplicationFileHash = Column(VARCHAR(64)) SLF_ApplicationFileName = Column(NVARCHAR(256)) SLF_ApplicationFileCreatedUTCDatetime = Column(DATETIME) SLF_ApplicationFileModifiedUTCDatetime = Column(DATETIME) SLF_ApplicationFileOwner = Column(NVARCHAR(256)) SLF_ApplicationPath = Column(NVARCHAR(512)) SLF_ApplicationDriveType = Column(SMALLINT) SLF_ApplicationProcessName = Column(NVARCHAR(256)) SLF_ApplicationProcessCommandline = Column(NVARCHAR(1024)) SLF_ApplicationProcessOwner = Column(NVARCHAR(256)) SLF_ApplicationExecutionEnvironment = Column(NVARCHAR(64)) SLF_ApplicationGRIDCategory = Column(NVARCHAR(256)) SLF_RuleContent = Column(NVARCHAR(256)) SLF_RuleName = Column(NVARCHAR(256)) SLF_RuleGUID = Column(CHAR(36)) SLF_RuleType = Column(SMALLINT) SLF_PolicyName = Column(NVARCHAR(256)) SLF_PolicyGUID = Column(CHAR(36)) SLF_PolicyInfo = Column(NVARCHAR(256)) SLF_PolicyAction = Column(SMALLINT) SLF_PolicyActionTriggerCount = Column(INTEGER) CE_FilterID = Column(VARCHAR(35)) CLF_LogGenCMLocalTime = Column(DATETIME) SLF_ApplicationFileHashType = Column(SMALLINT) SLF_MatchedRuleMethod = Column(SMALLINT) SLF_Signer = Column(NVARCHAR(128))
class TbADUserDistinctDepartment(Base): __tablename__ = 'tb_AD_UserDistinctDepartment' id = Column(INTEGER, primary_key=True, nullable=False) UEI_Dept = Column(NVARCHAR(64))
class TbAVVirusLog(Base): __tablename__ = 'tb_AVVirusLog' id = Column(INTEGER, primary_key=True, nullable=False) MsgLogID = Column(CHAR(36)) CLF_MsgLogType = Column(INTEGER) CLF_LogMinorVersion = Column(VARCHAR(10)) CLF_EntityID = Column(CHAR(36)) CLF_ManagerID = Column(CHAR(36)) CLF_LogVersion = Column(INTEGER) CLF_ProductType = Column(INTEGER) CLF_ProductVersion = Column(VARCHAR(21)) CLF_ProductLanguageCode = Column(INTEGER) CLF_LogGenerationTime = Column(DATETIME) CLF_LogGenerationTimeZone = Column(VARCHAR(10)) CLF_LogReceivedTime = Column(DATETIME) CLF_LogReceivedUTCTime = Column(DATETIME) CLF_LogReceivedTimeZone = Column(VARCHAR(10)) CLF_ServerityCode = Column(INTEGER) CLF_ComponentCode = Column(INTEGER) CLF_LogReplicatedFlag = Column(BIT) CLF_ComputerName = Column(NVARCHAR(128)) CLF_ProductPlatformCode = Column(INTEGER) CLF_IsDayLightSaving = Column(INTEGER) CLF_ReasonCode = Column(VARCHAR(64)) CLF_ReasonCodeSource = Column(INTEGER) VLF_VirusLogType = Column(INTEGER) VLF_VirusName = Column(NVARCHAR(64)) VLF_IsMoreThanOneVirus = Column(BIT) VLF_FunctionCode = Column(INTEGER) VLF_FirstAction = Column(INTEGER) VLF_SecondAction = Column(INTEGER) VLF_FirstActionResult = Column(INTEGER) VLF_SecondActionResult = Column(INTEGER) VLF_FileName = Column(NVARCHAR(254)) VLF_FilePath = Column(NVARCHAR(254)) VLF_FileNameInCompressedFile = Column(NVARCHAR(254)) VLF_InfectionSource = Column(NVARCHAR(254)) VLF_InfectionDestination = Column(NVARCHAR(254)) VLF_EngineType = Column(VARCHAR(19)) VLF_EngineVersion = Column(VARCHAR(19)) VLF_PatternType = Column(INTEGER) VLF_PatternNumber = Column(VARCHAR(19)) SIC_RuleName = Column(NVARCHAR(64)) MVL_Protocol = Column(VARCHAR(32)) MVL_DeliverTime = Column(DATETIME) MVL_StorageGroup = Column(NVARCHAR(64)) MVL_DataBaseName = Column(NVARCHAR(64)) MVL_FolderName = Column(NVARCHAR(256)) MVL_MessageID = Column(NVARCHAR(38)) DVL_ClientIPAddress = Column(VARCHAR(256)) DVL_ResultCode = Column(INTEGER) FVL_InfectTarget = Column(NVARCHAR(32)) FVL_LoginUser = Column(NVARCHAR(32)) MVL_Subject = Column(NVARCHAR(512)) DCS_JobID = Column(INTEGER) DCS_TaskID = Column(INTEGER) VLF_MajorVirusType = Column(INTEGER) VLF_SubVirusType = Column(INTEGER) VLF_PrivateAttribute = Column(IMAGE) VLF_ClientGUID = Column(CHAR(36)) AggregatedCount = Column(INTEGER) AggregatedLocalToTime = Column(DATETIME) AggregatedUTCToTime = Column(DATETIME) SourceIP = Column(VARCHAR(256)) DestIP = Column(VARCHAR(256)) UserGroupName = Column(NVARCHAR(128)) SLF_FileSHA1 = Column(VARCHAR(64)) SLF_CloudStorage = Column(INTEGER) CE_FilterID = Column(VARCHAR(35)) SLF_Channel = Column(INTEGER) CLF_LogGenCMLocalTime = Column(DATETIME)
class TbEntityPathInfo(Base): __tablename__ = 'tb_EntityPathInfo' EPI_EntityID = Column(CHAR(36), primary_key=True, nullable=False) EPI_FolderPath = Column(NVARCHAR(2048))
class TbUserDefinedMachineList(Base): __tablename__ = 'tb_UserDefinedMachineList' id = Column(INTEGER, primary_key=True, nullable=False) HostName = Column(NVARCHAR(128)) IPAddress = Column(VARCHAR(256))
class TbEntityInfo(Base): __tablename__ = 'tb_EntityInfo' id = Column(INTEGER, primary_key=True, nullable=False) EI_EntityID = Column(CHAR(36), nullable=False) EI_AgentID = Column(CHAR(36), nullable=False) EI_ParentID = Column(CHAR(36), nullable=False) EI_ManagerID = Column(CHAR(36), nullable=False) EI_State = Column(INTEGER) EI_Type = Column(INTEGER) EI_SerialNumber = Column(VARCHAR(60)) EI_ProductType = Column(INTEGER, nullable=False) EI_ProductVersion = Column(VARCHAR(19)) EI_ProductLanguage = Column(INTEGER) EI_SetupTime = Column(DATETIME) EI_LastRegistrationTime = Column(DATETIME) EI_LastLogonTime = Column(DATETIME) EI_LastLogoffTime = Column(DATETIME) EI_CacheToken = Column(VARCHAR(256)) EI_UpdateSourceID = Column(CHAR(36)) EI_MenuVersion = Column(VARCHAR(8)) EI_ProductBuildNumber = Column(VARCHAR(24)) EI_LastStartupTime = Column(DATETIME) EI_PatternNumber = Column(VARCHAR(19)) EI_PatternLastUpdateTime = Column(DATETIME) EI_SpamRuleNumber = Column(VARCHAR(8)) EI_SpamRuleLastUpdateTime = Column(DATETIME) EI_SpamRuleFilename1 = Column(VARCHAR(16)) EI_SpamRule1LastUpdateTime = Column(DATETIME) EI_SpamRuleFilename2 = Column(VARCHAR(16)) EI_SpamRule2LastUpdateTime = Column(DATETIME) EI_DCTNumber = Column(VARCHAR(19)) EI_DCTLastUpdateTime = Column(DATETIME) EI_OS_Name = Column(NVARCHAR(128)) EI_OS_Version = Column(VARCHAR(64)) EI_OS_SPVersion = Column(VARCHAR(32)) EI_OS_Language = Column(INTEGER) EI_OS_ContryCode = Column(VARCHAR(8)) EI_OS_MachineName = Column(NVARCHAR(64)) EI_IPAddressList = Column(VARCHAR(1024)) EI_MACAddressList = Column(VARCHAR(256)) EI_DomainName = Column(NVARCHAR(64)) EI_PrivateAttribute = Column(IMAGE) EI_Timezone = Column(VARCHAR(8)) EI_LastNotifyTime = Column(DATETIME) EI_AgentVersion = Column(VARCHAR(64)) EI_CAVRule = Column(VARCHAR(19)) EI_CAVRuleUpdateTime = Column(DATETIME) EI_Pattern2Version = Column(VARCHAR(19)) EI_Pattern2VersionUpdateTime = Column(DATETIME) EI_VATVersion = Column(VARCHAR(19)) EI_VATVersionUpdateTime = Column(DATETIME) EI_VIVersion = Column(VARCHAR(19)) EI_VIVersionUpdateTime = Column(DATETIME) EI_SpywareVersion = Column(VARCHAR(19)) EI_SpywareLastUpdateTime = Column(DATETIME) EI_CFWVersion = Column(VARCHAR(19)) EI_CFWLastUpdateTime = Column(DATETIME) EI_SpyCleanUpVersion = Column(VARCHAR(19)) EI_SpyCleanUpLastUpdateTime = Column(DATETIME) EI_GroupName = Column(NVARCHAR(64)) EI_ASpyVersion = Column(VARCHAR(19)) EI_ASpyLastUpdateTime = Column(DATETIME) EI_AgentBuild = Column(INTEGER) EI_CloudScanMode = Column(SMALLINT) EI_CloudScanMethod = Column(SMALLINT) LUTonTMCM = Column(DATETIME) ADDomainID = Column(INTEGER) EI_ADObjectGuid = Column(UNIQUEIDENTIFIER) EI_ClientTreePath = Column(NVARCHAR(1000)) EI_RealParentGuid = Column(CHAR(36)) LogReceivedTime = Column(DATETIME) EI_PATTERN_TMA_SSA = Column(VARCHAR(19)) EI_PATTERN_TMA_SSALastUpdateTime = Column(DATETIME) EI_UpdateAgentType = Column(INTEGER) EI_FQDN = Column(VARCHAR(80)) EI_PolicyID = Column(UNIQUEIDENTIFIER) EI_PolicyFlag = Column(INTEGER) RTSSetting = Column(SMALLINT) PFWSetting = Column(SMALLINT) LastScheduleScanUTC = Column(DATETIME) LastManualScanUTC = Column(DATETIME) LastScanNowScanUTC = Column(DATETIME) EI_OS_Type = Column(VARCHAR(16)) EI_Platform_Type = Column(VARCHAR(16)) EI_MachineID = Column(CHAR(36)) EI_UserGuid = Column(VARCHAR(36)) EI_UserAccount = Column(NVARCHAR(32)) EI_UserDomain = Column(NVARCHAR(256)) EI_UserMail = Column(NVARCHAR(450)) EI_SystemModel = Column(SMALLINT) EI_AD_DomainName = Column(NVARCHAR(64)) EI_NetworkQuarantineSetting = Column(SMALLINT) EI_NetworkQuarantineAction = Column(SMALLINT) EI_NetworkQuarantineActionStatus = Column(SMALLINT) EI_NetworkQuarantineSettingResult = Column(SMALLINT) EI_IsOffPremise = Column(SMALLINT) EI_LastCompliantState = Column(BIGINT) EI_IsSaaSMode = Column(SMALLINT) EI_IsCoExist = Column(SMALLINT) EI_ServerCommunicationPort_HTTP = Column(INTEGER) EI_ServerCommunicationPort_HTTPS = Column(INTEGER) @classmethod def find_by_entityid(cls, entityid): return cm_session.query(cls).filter( cls.EI_EntityID == entityid).first() @classmethod def _get_server_type(cls, category, symbolic1, symbolic2, guid): statement = 'SELECT EI_EntityID FROM tb_EntityInfo WITH(NOLOCK) where EI_ProductType > (SELECT idmap FROM ' \ 'L10NTMCM WHERE category = {0} AND symbolic = \'{1}\') and EI_ProductType < (SELECT idmap FROM ' \ 'L10NTMCM WHERE category = {0} AND symbolic = \'{2}\') and EI_Type < 2 and EI_EntityID = \'{3}\'' return cm_session.execute( statement.format(category, symbolic1, symbolic2, guid)).fetchone() @classmethod def is_wsi_server(cls, guid): server = cls._get_server_type('196', 'SLF_PRODUCT_START', 'SLF_PRODUCT_END', guid) return True if server else False @classmethod def is_saas_server(cls, guid): server = cls._get_server_type('195', 'SLF_PRODUCT_SCOSTART', 'SLF_PRODUCT_SCOEND', guid) return True if server else False @classmethod def find_by_machine_name(cls, name): return cm_session.query(cls).filter( cls.EI_OS_MachineName == name).first()
class TbSingleSignOnUserInfo(Base): __tablename__ = 'tb_SingleSignOnUserInfo' id = Column(INTEGER, primary_key=True, nullable=False) ProductType = Column(INTEGER, nullable=False) SingleSignOnUserID = Column(NVARCHAR(64), nullable=False)
dbEngine = create_engine( 'mssql+pyodbc://sa:1111@DESKTOP-FTVU75K/NORTHWND?driver=SQL Server Native Client 11.0' ) print(dbEngine) #要一條連接(具有Open) connection = dbEngine.connect() print(connection) #sqlalchemy.engine.base.Connection #建立MetaData 應對資料庫資料表Table Schema customersMetaData = MetaData() #可以設定到兩個Table結構以上 #設定MetaData應對資料結構物件(Table)(table name->field Name attribute) customersTB = Table( 'Customers', customersMetaData, Column('CustomerID', NCHAR(5), nullable=False, primary_key=True), Column('CompanyName', NVARCHAR(40), nullable=False), Column('Address', NVARCHAR(60)), Column('Country', NVARCHAR(15))) print(customersTB) #準備一下建立前端Python具有虛擬物件導向資料庫(Persistence--持久層) customersMetaData.create_all(dbEngine) print(customersMetaData) #操作新增作業(針對前端Python Persistence Table進行新增--同步更新到資料庫去) #不會立即執行語法(Statement-SQL) 並非是直接新增一個物件(Entity class尚未設定) ts = customersTB.insert().values(CustomerID='A8889', CompanyName='中華電信', Address='高雄市林森路', Country='中華民國') print(ts) #尚未完成參數值設定 #Sync資料庫去正式維護 result = connection.execute(ts) #Connection 執行了Native SQL
class TbDirectoryInfo(Base): __tablename__ = 'tb_DirectoryInfo' AccountGuid = Column(CHAR(36), primary_key=True, nullable=False) ObjectGuid = Column(NVARCHAR(256), nullable=False) Domain = Column(NVARCHAR(256)) BaseDN = Column(NVARCHAR(256))
class TbDataLossPreventionSeverityLocalizationMapping(Base): __tablename__ = 'tb_DataLossPreventionSeverityLocalizationMapping' Language = Column(VARCHAR(10), primary_key=True, nullable=False) Severity = Column(NVARCHAR(32), primary_key=True, nullable=False) Code = Column(INTEGER, nullable=False)
) as mock_pyodbc_rows_to_tuples: data = [(1, "foo")] with mock.patch.object(BaseEngineSpec, "fetch_data", return_value=data): result = MssqlEngineSpec.fetch_data(None, 0) mock_pyodbc_rows_to_tuples.assert_called_once_with(data) assert result == "converted" @pytest.mark.parametrize( "original,expected", [ (DATE(), "DATE"), (VARCHAR(length=255), "VARCHAR(255)"), (VARCHAR(length=255, collation="utf8_general_ci"), "VARCHAR(255)"), (NVARCHAR(length=128), "NVARCHAR(128)"), (TEXT(), "TEXT"), (NTEXT(collation="utf8_general_ci"), "NTEXT"), ], ) def test_column_datatype_to_string(app_context: AppContext, original: TypeEngine, expected: str) -> None: from superset.db_engine_specs.mssql import MssqlEngineSpec actual = MssqlEngineSpec.column_datatype_to_string(original, mssql.dialect()) assert actual == expected @pytest.mark.parametrize(
class Netdev(Base): __tablename__ = "netdev" id = Column(Integer, primary_key=True) ADDRESS1 = Column('ADDRESS1', NVARCHAR(40)) ADDRESS2 = Column('ADDRESS2', NVARCHAR(40)) ADDRESS3 = Column('ADDRESS3', NVARCHAR(40)) ADDRNAME1 = Column('ADDRNAME1', NVARCHAR(40)) ADDRNAME2 = Column('ADDRNAME2', NVARCHAR(40)) ADDRNAME3 = Column('ADDRNAME3', NVARCHAR(40)) ADDRSTYLE = Column('ADDRSTYLE', NVARCHAR(40)) BAUDRATE = Column('BAUDRATE', NVARCHAR(40)) CTSYSNAME = Column('CTSYSNAME', NVARCHAR(40)) DESCRIPTOR = Column('DESCRIPTOR', NVARCHAR(40)) DNS = Column('DNS', NVARCHAR(40)) DWG_NAME = Column('DWG_NAME', NVARCHAR(40)) FLNTYPE = Column('FLNTYPE', NVARCHAR(40)) INSTANCE = Column('INSTANCE', NVARCHAR(40)) MACADDRESS = Column('MACADDRESS', NVARCHAR(40)) NAME = Column('NAME', NVARCHAR(40)) NETDEVID = Column('NETDEVID', NVARCHAR(40)) NODEADDR = Column('NODEADDR', NVARCHAR(40)) ONETOFOUR = Column('ONETOFOUR', NVARCHAR(40)) PARENTID = Column('PARENTID', NVARCHAR(40)) PARTNO = Column('PARTNO', NVARCHAR(40)) REFERNAME = Column('REFERNAME', NVARCHAR(40)) SITENAME = Column('SITENAME', NVARCHAR(40)) STARTADDR = Column('STARTADDR', NUMERIC(19,5)) SUBTYPE = Column('SUBTYPE', NVARCHAR(40)) TBLOCKID = Column('TBLOCKID', NUMERIC(19,5)) TYPE = Column('TYPE', NVARCHAR(40)) # Relationships customer_id = Column(Integer, ForeignKey('customers.id')) customer = relationship('Customers', back_populates='netdev') def __repr__(self): return "<netdev(name='%s', 'id='%s')>"\ % (self.NETDEVID, self.id)
class TbSecurityLog(Base): __tablename__ = 'tb_SecurityLog' id = Column(INTEGER, primary_key=True, nullable=False) MsgLogID = Column(CHAR(36)) CLF_MsgLogType = Column(INTEGER) CLF_LogMinorVersion = Column(VARCHAR(10)) CLF_EntityID = Column(CHAR(36)) CLF_ManagerID = Column(CHAR(36)) CLF_LogVersion = Column(INTEGER) CLF_ProductType = Column(INTEGER) CLF_ProductVersion = Column(VARCHAR(21)) CLF_ProductLanguageCode = Column(INTEGER) CLF_LogGenerationTime = Column(DATETIME) CLF_LogGenerationTimeZone = Column(VARCHAR(10)) CLF_LogReceivedTime = Column(DATETIME) CLF_LogReceivedUTCTime = Column(DATETIME) CLF_LogReceivedTimeZone = Column(VARCHAR(10)) CLF_ServerityCode = Column(INTEGER) CLF_ComponentCode = Column(INTEGER) CLF_LogReplicatedFlag = Column(BIT) CLF_ComputerName = Column(NVARCHAR(128)) CLF_ProductPlatformCode = Column(INTEGER) CLF_IsDayLightSaving = Column(INTEGER) CLF_ReasonCode = Column(VARCHAR(64)) CLF_ReasonCodeSource = Column(INTEGER) SL_FilterAction = Column(INTEGER) SL_FilterActionResult = Column(INTEGER) SL_MessageAction = Column(INTEGER) SL_FileName = Column(NVARCHAR) SL_Sender = Column(NVARCHAR(254)) SL_Recipient = Column(NVARCHAR) SL_Subject = Column(NVARCHAR(254)) SL_Q_Area_PathName = Column(NVARCHAR(254)) SL_Q_Area_EntityName = Column(NVARCHAR(254)) SL_PolicyName = Column(NVARCHAR(254)) SL_PolicyContent = Column(NVARCHAR(254)) SL_Protocol_Name = Column(NVARCHAR(254)) SL_DeliveryTimeInElapsedSec = Column(VARCHAR(5)) SL_MailID = Column(VARCHAR(256)) SL_QuarantineAreaName = Column(NVARCHAR(254)) SL_FilterType = Column(INTEGER) SL_FilterName = Column(NVARCHAR(254)) SL_SubFilterType = Column(INTEGER) SL_FilterContent = Column(NVARCHAR(254)) SL_ViolationDescription = Column(NVARCHAR(254)) SL_LogType = Column(INTEGER) SLF_MessageProtocol = Column(INTEGER) SLF_URLProtocol = Column(INTEGER) SLF_FullPathURL = Column(NVARCHAR(1024)) SLF_RatingThreshold = Column(INTEGER) SLF_ReputationScore = Column(INTEGER) SLF_RedAlertID = Column(CHAR(36)) AggregatedCount = Column(INTEGER) AggregatedLocalToTime = Column(DATETIME) AggregatedUTCToTime = Column(DATETIME) SourceIP = Column(VARCHAR(256)) DestIP = Column(VARCHAR(256)) URL = Column(VARCHAR(2048)) RiskLevel = Column(INTEGER) SLF_Is_CCCA_Detection = Column(INTEGER) SLF_CCCA_DetectionSource = Column(INTEGER) SLF_CCCA_RiskLevel = Column(INTEGER) SLF_MessageDirection = Column(INTEGER) SLF_CCCA_DetectedPart = Column(INTEGER) SLF_CCCA_Destination = Column(NVARCHAR(2048)) SLF_CCCA_Initiator = Column(NVARCHAR(2048)) SLF_Composed_URL = Column(NVARCHAR) SLF_MsgRecvTimeUTC = Column(DATETIME) SLF_Instance_ID = Column(VARCHAR(256)) SLF_Composed_Message_Action = Column(VARCHAR(254)) SLF_Attachement_Type = Column(VARCHAR(2048)) SLF_VirusName = Column(VARCHAR(2048)) ThreatType = Column(INTEGER) SeverityLevel = Column(INTEGER) SLF_Url_Macth_Count = Column(INTEGER) SLF_File_Match_Count = Column(INTEGER) SLF_Country = Column(VARCHAR(128)) SLF_City = Column(VARCHAR(128)) SLF_CategoryIDList = Column(VARCHAR(64)) SLF_URLCorrelationKey = Column(VARCHAR(64)) CE_FilterID = Column(VARCHAR(35)) SLF_SNAP_DetectionName = Column(VARCHAR(128)) CLF_LogGenCMLocalTime = Column(DATETIME)
class Points(Base): __tablename__ = "points" id = Column(Integer, primary_key=True) POINTID = Column('POINTID', NUMERIC(19,5), nullable=False) # DEVICEHI = Column('DEVICEHI', NUMERIC(19,5)) # DEVICELO = Column('DEVICELO', NUMERIC(19,5)) # SIGNALHI = Column('SIGNALHI', NUMERIC(19,5)) # SIGNALLO = Column('SIGNALLO', NUMERIC(19,5)) # NUMBERWIRE = Column('NUMBERWIRE', NUMERIC(19,5)) # WIRELENGTH = Column('WIRELENGTH', NUMERIC(19,5)) # WIRESIZE = Column('WIRESIZE', NUMERIC(19,5)) # PROOFDELAY = Column('PROOFDELAY', NUMERIC(19,5)) # NORMCLOSE = Column('NORMCLOSE', BIT()) # INVERTED = Column('INVERTED', BIT()) # PROOFPRSNT = Column('PROOFPRSNT', BIT()) # VIRTUAL = Column('VIRTUAL', BIT()) # TMEMBER = Column('TMEMBER', BIT()) # ADDRESSEXT = Column('ADDRESSEXT', NVARCHAR(20)) # ALARMHIGH = Column('ALARMHIGH', NVARCHAR(30)) # ALARMLOW = Column('ALARMLOW', NVARCHAR(30)) # ALARMTYPE = Column('ALARMTYPE', NVARCHAR(30)) # COMBOID = Column('COMBOID', NVARCHAR(30)) # CONTRLTYPE = Column('CONTRLTYPE', NVARCHAR(10)) # CS = Column('CS', NVARCHAR(30)) # CTSENSTYPE = Column('CTSENSTYPE', NVARCHAR(15)) # CTSYSNAME = Column('CTSYSNAME', NVARCHAR(30)) # DESCRIPTOR = Column('DESCRIPTOR', NVARCHAR(30)) DEVNUMBER = Column('DEVNUMBER', NVARCHAR(30)) # DEVUNITS = Column('DEVUNITS', NVARCHAR(10)) # DROP = Column('DROP', NVARCHAR(3)) # FUNCTION = Column('FUNCTION', NVARCHAR(10)) # INITVALUE = Column('INITVALUE', NVARCHAR(16)) # INTERCEPT = Column('INTERCEPT', NVARCHAR(30)) # LAN = Column('LAN', NVARCHAR(3)) # NAME = Column('NAME', NVARCHAR(30), nullable=False) # NETDEVID = Column('NETDEVID', NVARCHAR(30)) # POINT = Column('POINT', NVARCHAR(30)) # POINTACTUAL = Column('POINTACTUAL', NVARCHAR(30)) # POWER = Column('POWER', NVARCHAR(8)) # S1000TYPE = Column('S1000TYPE', NVARCHAR(10)) # SENSORTYPE = Column('SENSORTYPE', NVARCHAR(30)) # SIGUNITS = Column('SIGUNITS', NVARCHAR(6)) # SLOPE = Column('SLOPE', NVARCHAR(16)) # SYSTEM = Column('SYSTEM', NVARCHAR(30)) # TYPE = Column('TYPE', NVARCHAR(5)) # UNITSTYPE = Column('UNITSTYPE', NVARCHAR(3)) # Relationships customer_id = Column(Integer, ForeignKey('customers.id'), nullable=False) customer = relationship('Customers',back_populates='') # Many points are grouped under one label group_id = Column(Integer, ForeignKey('labeling.id'), nullable=True) group = relationship('Labeling', back_populates='points') def __repr__(self): return "<points(name='%s', type='%s', 'id='%s')>"\ % (self.NAME, self.TYPE, self.POINTID)
class TbLogDataLossPreventionTemplateCasStorage(Base): __tablename__ = 'tb_LogDataLossPreventionTemplate_CasStorage' id = Column(INTEGER, primary_key=True, nullable=False) MsgLogID = Column(CHAR(36), nullable=False) SLF_PolicyName = Column(NVARCHAR(256)) SLF_Template = Column(NVARCHAR(256))
class TbTempEntityPath(Base): __tablename__ = 'tb_TempEntityPath' GUID = Column(CHAR(36), primary_key=True, nullable=False) Token = Column(VARCHAR(255), nullable=False) Path = Column(NVARCHAR(255), nullable=False)
class TbLogDataLossPreventionMatchedContentInfo(Base): __tablename__ = 'tb_LogDataLossPreventionMatchedContentInfo' id = Column(INTEGER, primary_key=True, nullable=False) MsgLogID = Column(CHAR(36), nullable=False) MatchedContent = Column(NVARCHAR(128), nullable=False) MatchedInfo = Column(VARCHAR(256), nullable=False)
class TbADOuTreeA(Base): __tablename__ = 'tb_AD_OuTree_A' Guid = Column(CHAR(36), primary_key=True, nullable=False) LeftIndex = Column(INTEGER) RightIndex = Column(INTEGER) RootDomain = Column(NVARCHAR(256))
class TbADBiosNameMapB(Base): __tablename__ = 'tb_AD_BiosNameMap_B' Domain = Column(NVARCHAR(256), primary_key=True, nullable=False) DiosName = Column(NVARCHAR(256), primary_key=True)
class TbMessageDetectionSNAPInfo(Base): __tablename__ = 'tb_MessageDetectionSNAPInfo' id = Column(BIGINT, primary_key=True, nullable=False) SLF_Instance_ID = Column(VARCHAR(256)) SLF_SNAP_FeatureID = Column(INTEGER) SLF_SNAP_DetectionEntityValue = Column(NVARCHAR(2560))
class TbReportTempTable(Base): __tablename__ = 'tb_ReportTempTable' EntityID = Column(CHAR(36), primary_key=True) EntityName = Column(NVARCHAR(256))
class TbLogGeneral(Base): __tablename__ = 'tb_LogGeneral' id = Column(BIGINT, primary_key=True, nullable=False) CMGuid = Column(CHAR(36)) LogReferenceID = Column(INTEGER) Authentication = Column(INTEGER) ConstraintType = Column(INTEGER) ComputerName = Column(NVARCHAR(128)) DaylightSavingInMins = Column(INTEGER) Description = Column(VARCHAR(256)) DetectedBy = Column(INTEGER) DetectionName = Column(VARCHAR(64)) LogGenLocalDatetime = Column(DATETIME, nullable=False) LogGenUTCDatetime = Column(DATETIME, nullable=False) LogMinorVersion = Column(SMALLINT) LogVersion = Column(SMALLINT) MsgType = Column(INTEGER, nullable=False) PotentialRisk = Column(INTEGER) ProductGUID = Column(CHAR(36), nullable=False) ProductID = Column(INTEGER, nullable=False) Protocol = Column(INTEGER) ProtocolGroup = Column(INTEGER) RiskType = Column(VARCHAR(32)) RiskTypeGroup = Column(INTEGER) RuleID = Column(INTEGER) ScanDirection = Column(INTEGER) TimeZoneInMins = Column(SMALLINT) VLANId = Column(INTEGER) CLF_LogReceivedTime = Column(DATETIME) CollaborationID = Column(UNIQUEIDENTIFIER) Severity = Column(INTEGER) SLF_InterestedIP = Column(VARCHAR(256)) SLF_PeerIP = Column(VARCHAR(256)) SLF_Is_CCCA_Detection = Column(INTEGER) SLF_CCCA_DetectionSource = Column(INTEGER) SLF_CCCA_Destination = Column(VARCHAR(2048)) SLF_CCCA_RiskLevel = Column(INTEGER) SLF_CCCA_DestinationFormat = Column(INTEGER) MsgLogID = Column(CHAR(36)) ThreatType = Column(SMALLINT) IsBlocked = Column(TINYINT) InterestedGroupName = Column(NVARCHAR(128)) DetectionType = Column(SMALLINT) EventTotalCount = Column(INTEGER) EventAggregatedCount = Column(INTEGER) ECE_SeverityCode = Column(SMALLINT) AttackPhase = Column(SMALLINT) DetectedByVA = Column(TINYINT) LogNativeID = Column(BIGINT) DCEHash1 = Column(BIGINT) DCEHash2 = Column(BIGINT) Remarks = Column(NVARCHAR(2176)) CC_Server = Column(NVARCHAR(2138)) CC_ServerType = Column(SMALLINT) MalwareType = Column(VARCHAR(256)) Event_Class = Column(SMALLINT) Event_SubClass = Column(SMALLINT) HeurFlag = Column(SMALLINT) CommonThreatFamily = Column(VARCHAR(256)) SLF_URLCorrelationKey = Column(VARCHAR(64)) VADetectionName = Column(NVARCHAR(2048)) ThreatCharacteristics = Column(NVARCHAR(128)) CE_FilterID = Column(VARCHAR(35)) CLF_LogGenCMLocalTime = Column(DATETIME)