Skip to content

Commit e72485c

Browse files
committed
vulnsummary support withoutrisklevel
1 parent ff0fa66 commit e72485c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

dongtai_sdk/base/DongTaiVuln.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Date: 2021-12-24 10:56:10
44
version:
55
LastEditors: 饕餮
6-
LastEditTime: 2021-12-27 18:34:21
6+
LastEditTime: 2021-12-27 18:55:58
77
Description: Vuln Object
88
'''
99
import json
@@ -39,8 +39,12 @@ def Id(self):
3939
return self.TryGetValue("level_id")
4040

4141
class VulnSummary(BaseObject):
42-
def __init__(self,jsonData):
42+
WithOutRiskLevel = ["无风险"]
43+
44+
def __init__(self,jsonData,withOutRiskLevel:list=None):
4345
self.ObjectData = jsonData
46+
if withOutRiskLevel is not None:
47+
self.WithOutRiskLevel = withOutRiskLevel
4448

4549
@property
4650
def Language(self) -> List[LanguageSummary]:
@@ -93,11 +97,19 @@ def LowRisk(self):
9397
else:
9498
return None
9599

100+
@property
101+
def TipsRisk(self):
102+
tmpData = [tmpLevel for tmpLevel in self.Level if tmpLevel.Level == "提示"]
103+
if len(tmpData) > 0:
104+
return tmpData[0]
105+
else:
106+
return None
107+
96108
@property
97109
def Count(self):
98110
tmpCount = 0
99111
for tmpLevel in self.Level:
100-
if tmpLevel.Level not in ["无风险","提示"]:
112+
if tmpLevel.Level not in self.WithOutRiskLevel:
101113
tmpCount += tmpLevel.Count
102114
return tmpCount
103115

0 commit comments

Comments
 (0)