File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 33Date: 2021-12-23 15:10:01
44version:
55LastEditors: 饕餮
6- LastEditTime: 2021-12-25 15:51:12
6+ LastEditTime: 2021-12-25 16:09:46
77Description: Main
88'''
99from .base .DongTaiProject import DongTaiProject ,DongTaiProjectVersion
@@ -81,6 +81,17 @@ def SearchProject(self,projectId):
8181 errorObject = DongTaiError (errorMsg )
8282 return errorObject
8383
84+ def GetProjectDetail (self ,projectId ):
85+ repData = self .dongTaiApi .GetProjectDetail (projectId )
86+ if repData ["status" ] == 201 :
87+ tmpObject = DongTaiProject (repData ["data" ])
88+ #TODO:通过参数判断是否加载完整Agent信息
89+ return tmpObject
90+ else :
91+ errorMsg = {"status" :repData ["status" ],"msg" :repData ["msg" ]}
92+ errorObject = DongTaiError (errorMsg )
93+ return errorObject
94+
8495 #[Agent Function]
8596 def DeleteAgent (self ,agentId ):
8697 repData = self .dongTaiApi .DeleteAgent (agentId )
Original file line number Diff line number Diff line change 33Date: 2021-12-23 14:50:44
44version:
55LastEditors: 饕餮
6- LastEditTime: 2021-12-24 10:49:49
6+ LastEditTime: 2021-12-25 16:06:03
77Description: 动态项目对象
88'''
99from .BaseObejct import BaseObject
@@ -24,6 +24,18 @@ def Total(self):
2424 def Name (self ):
2525 return self .TryGetValue ("name" )
2626
27+ class AgentBaseInfo (BaseObject ):
28+ def __init__ (self ,jsonData ):
29+ self .ObjectData = jsonData
30+
31+ @property
32+ def Id (self ):
33+ return self .TryGetValue ("id" )
34+
35+ @property
36+ def Name (self ):
37+ return self .TryGetValue ("name" )
38+
2739class LevelCount (BaseObject ):
2840 def __init__ (self ,jsonData ):
2941 self .ObjectData = jsonData
@@ -168,4 +180,17 @@ def TypeSummary(self):
168180 tmpObject = TypeSummary (tmpData )
169181 returnData .append (tmpObject )
170182 return returnData
183+
184+ @property
185+ def ScanId (self ):
186+ return self .TryGetValue ("scan_id" )
171187
188+ #通过参数判断是否要加载完整的Agent信息
189+ @property
190+ def Agents (self ):
191+ tmpDataList = self .TryGetValue ("agents" )
192+ returnData = []
193+ for tmpData in tmpDataList :
194+ tmpObject = AgentBaseInfo (tmpData )
195+ returnData .append (tmpObject )
196+ return returnData
You can’t perform that action at this time.
0 commit comments