This repository was archived by the owner on Apr 20, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 33# author: owefsad@huoxian.cn
44# datetime: 2021/10/22 下午2:26
55# project: DongTai-engine
6+
7+ from dongtai .models .project import IastProject
8+ from dongtai .models .strategy import IastStrategyModel
9+ from dongtai .utils import const
10+
11+
12+ def is_strategy_enable (vul_type , method_pool ):
13+ try :
14+ vul_strategy = IastStrategyModel .objects .filter (
15+ vul_type = vul_type ,
16+ state = const .STRATEGY_ENABLE ,
17+ user_id__in = (1 , method_pool .agent .user .id )
18+ ).first ()
19+ if vul_strategy is None :
20+ return False
21+ project_id = method_pool .agent .bind_project_id
22+ project = IastProject .objects .filter (id = project_id ).first ()
23+ if project is None :
24+ return False
25+ strategy_ids = project .scan .content
26+ if strategy_ids is None :
27+ return False
28+ if str (vul_strategy .id ) in strategy_ids .split (',' ):
29+ return True
30+ return False
31+ except Exception as e :
32+ return False
Original file line number Diff line number Diff line change 1313from dongtai .models .vulnerablity import IastVulnerabilityModel
1414from dongtai .utils import const
1515
16+ from core .plugins import is_strategy_enable
17+
1618
1719class FakeSocket ():
1820 def __init__ (self , response_str ):
@@ -82,6 +84,8 @@ def check_response_header(method_pool):
8284
8385
8486def save_vul (vul_type , method_pool , position = None , data = None ):
87+ if is_strategy_enable (vul_type , method_pool ) is False :
88+ return None
8589 vul_strategy = IastStrategyModel .objects .filter (
8690 vul_type = vul_type ,
8791 state = const .STRATEGY_ENABLE ,
You can’t perform that action at this time.
0 commit comments