예제 #1
0
 def setUp(self):
     self.sqllist = commen.PutsqlNum()
     self.ruler_name = commen.PutsqlName("db2_")
     LOG.info("规则名称:%s" % self.ruler_name)
     LOG.info("SQL语句:%s" % self.sqllist)
     self.sensql = SensitiveSql(self.ruler_name, GlobalConfig.db_type_['DB2'],
                                dbservice.select_dbservice_byname(gp.run_db["db2"]))
     self.sensitiveway = SensitiveWay()
예제 #2
0
 def setUp(self):
     self.dbtable = commen.PutsqlName("dbtable_")
     self.sqllist = "SELECT * FROM " + self.dbtable
     self.ruler_name = commen.PutsqlName("dm_")
     LOG.info("规则名称:%s" % self.ruler_name)
     LOG.info("SQL语句:%s" % self.sqllist)
     self.sensql = SensitiveSql(
         self.ruler_name, GlobalConfig.db_type_['dm'],
         dbservice.select_dbservice_byname(gp.run_db['dm']))
     self.sensitiveway = SensitiveWay()
예제 #3
0
 def setUp(self):
     self.dbtable = commen.PutsqlName("dbtable_")
     sql_execute.db2_create_table('db2', self.dbtable)
     self.sqllist = "SELECT * FROM " + self.dbtable
     self.ruler_name = commen.PutsqlName("db2_")
     LOG.info("规则名称:%s" % self.ruler_name)
     LOG.info("SQL语句:%s" % self.sqllist)
     self.sensql = SensitiveSql(
         self.ruler_name, GlobalConfig.db_type_['DB2'],
         dbservice.select_dbservice_byname(gp.run_db["db2"]))
     self.sensitiveway = SensitiveWay()
예제 #4
0
class DmSqlReOff(unittest.TestCase):
    def setUp(self):
        self.dbtable = commen.PutsqlName("dbtable_")
        self.sqllist = "SELECT * FROM " + self.dbtable
        self.ruler_name = commen.PutsqlName("dm_")
        LOG.info("规则名称:%s" % self.ruler_name)
        LOG.info("SQL语句:%s" % self.sqllist)
        self.sensql = SensitiveSql(
            self.ruler_name, GlobalConfig.db_type_['dm'],
            dbservice.select_dbservice_byname(gp.run_db['dm']))
        self.sensitiveway = SensitiveWay()

    @logger('敏感dm类型低风险禁用')
    def test_dm_re_off_risk1(self):
        '''敏感dm类型低风险禁用'''
        self.sensql.sqlrisk_re_off(gp.risk_level['risk_low'], self.sqllist)

    @logger('敏感dm类型中风险禁用')
    def test_dm_re_off_risk2(self):
        '''敏感dm类型中风险禁用'''
        self.sensql.sqlrisk_re_off(gp.risk_level['risk_mid'], self.sqllist)

    @logger('敏感dm类型高风险禁用')
    def test_dm_re_off_risk3(self):
        '''敏感dm类型高风险禁用'''
        self.sensql.sqlrisk_re_off(gp.risk_level['risk_high'], self.sqllist)

    @logger('敏感dm类型极高风险禁用')
    def test_dm_re_off_risk4(self):
        '''敏感dm类型极高风险禁用'''
        self.sensql.sqlrisk_re_off(gp.risk_level['risk_higher'], self.sqllist)

    def tearDown(self):
        LOG.info("删除新增sql规则")
        self.sensitiveway.del_ruler(self.ruler_name)
예제 #5
0
class MysqlSqlReOff(unittest.TestCase):
    def setUp(self):
        self.sqllist = commen.PutsqlNum()
        self.ruler_name = commen.PutsqlName("mysql_")
        LOG.info("规则名称:%s" % self.ruler_name)
        LOG.info("SQL语句:%s" % self.sqllist)
        self.sensql = SensitiveSql(
            self.ruler_name, GlobalConfig.db_type_['mysql'],
            dbservice.select_dbservice_byname(gp.run_db["mysql"]),
            GlobalConfig.db_type_['oracle'])
        self.sensitiveway = SensitiveWay()

    @logger('敏感mysql类型低风险禁用')
    def test_mysql_re_off_risk1(self):
        '''敏感mysql类型低风险禁用'''
        self.sensql.sqlrisk_re_off(gp.risk_level['risk_low'], self.sqllist)

    @logger('敏感mysql类型中风险禁用')
    def test_mysql_re_off_risk2(self):
        '''敏感mysql类型中风险禁用'''
        self.sensql.sqlrisk_re_off(gp.risk_level['risk_mid'], self.sqllist)

    @logger('敏感mysql类型高风险禁用')
    def test_mysql_re_off_risk3(self):
        '''敏感mysql类型高风险禁用'''
        self.sensql.sqlrisk_re_off(gp.risk_level['risk_high'], self.sqllist)

    @logger('敏感mysql类型极高风险禁用')
    def test_mysql_re_off_risk4(self):
        '''敏感mysql类型极高风险禁用'''
        self.sensql.sqlrisk_re_off(gp.risk_level['risk_higher'], self.sqllist)

    def tearDown(self):
        LOG.info("删除新增sql规则")
        self.sensitiveway.del_ruler(self.ruler_name)
예제 #6
0
class DB2SqlRe(unittest.TestCase):
    def setUp(self):
        self.sqllist = commen.PutsqlNum()
        self.ruler_name = commen.PutsqlName("db2_")
        LOG.info("规则名称:%s" % self.ruler_name)
        LOG.info("SQL语句:%s" % self.sqllist)
        self.sensql = SensitiveSql(self.ruler_name, GlobalConfig.db_type_['DB2'],
                                   dbservice.select_dbservice_byname(gp.run_db["db2"]))
        self.sensitiveway = SensitiveWay()

    @logger('敏感db2类型低风险')
    def test_db2_re_risk1(self):
        '''敏感db2类型低风险'''
        self.sensql.sqlrisk_re(gp.risk_level['risk_low'], self.sqllist, gp.risk_info[1])

    @logger('敏感db2类型中风险')
    def test_db2_re_risk2(self):
        '''敏感db2类型中风险'''
        self.sensql.sqlrisk_re(gp.risk_level['risk_mid'], self.sqllist, gp.risk_info[2])

    @logger('敏感db2类型高风险')
    def test_db2_re_risk3(self):
        '''敏感db2类型高风险'''
        self.sensql.sqlrisk_re(gp.risk_level['risk_high'], self.sqllist, gp.risk_info[3])

    @logger('敏感db2类型极高风险')
    def test_db2_re_risk4(self):
        '''敏感db2类型极高风险'''
        self.sensql.sqlrisk_re(gp.risk_level['risk_higher'], self.sqllist, gp.risk_info[4])

    def tearDown(self):
        LOG.info("删除新增sql规则")
        self.sensitiveway.del_ruler(self.ruler_name)