agents api and interfaces (#92)
taylor_socfortress committed
Sep 1, 2023 at 12:36 UTC
3c20dfefe1a30898bb473bf81861be5d54b8ed8d
3 files changed
+51
-1
src/api/agents.ts
+27
-1
@@ -1,9 +1,35 @@
1
import { FlaskBaseResponse } from "@/types/flask"
2
import { HttpClient } from "./httpClient"
3
-import { Agents } from "@/types/agents"
3
+import { Agents, AgentVulnerabilities, OutdatedWazuhAgents, OutdatedVelociraptorAgents } from "@/types/agents" // Import the new types
4
5
export default {
6
getAgents() {
7
return HttpClient.get<FlaskBaseResponse & { agents: Agents[] }>("/agents")
8
+ },
9
+ getAgent(id: string) {
10
+ return HttpClient.get<FlaskBaseResponse & { agent: Agents }>(`/agents/${id}`) // Should be Agents, not Agents[]
11
+ },
12
+ markCritical(id: string) {
13
+ return HttpClient.post<FlaskBaseResponse>(`/agents/${id}/critical`)
14
+ },
15
+ markNonCritical(id: string) {
16
+ return HttpClient.post<FlaskBaseResponse>(`/agents/${id}/noncritical`)
17
+ },
18
+ deleteAgent(id: string) {
19
+ return HttpClient.delete<FlaskBaseResponse>(`/agents/${id}/delete`)
20
+ },
21
+ syncAgents() {
22
+ return HttpClient.post<FlaskBaseResponse>(`/agents/sync`)
23
+ },
24
+ agentVulnerabilities(id: string) {
25
+ return HttpClient.get<FlaskBaseResponse & { vulnerabilities: AgentVulnerabilities[] }>(`/agents/${id}/vulnerabilities`) // Include the vulnerabilities
26
+ },
27
+ agentsWazuhOutdated() {
28
+ return HttpClient.get<FlaskBaseResponse & { outdated_wazuh_agents: OutdatedWazuhAgents }>(`/agents/wazuh/outdated`) // Include the outdated Wazuh agents
29
+ },
30
+ agentsVelociraptorOutdated() {
31
+ return HttpClient.get<FlaskBaseResponse & { outdated_velociraptor_agents: OutdatedVelociraptorAgents }>(
32
+ `/agents/velociraptor/outdated`
33
+ ) // Include the outdated Velociraptor agents
34
}
35
}
src/types/agents.d.ts
+23
@@ -11,4 +11,27 @@ export interface Agents {
11
os: string
12
velociraptor_client_version: string
13
wazuh_agent_version: string
14
+ vulnerabilities?: AgentVulnerabilities[]
15
}
16
+
17
+export interface AgentVulnerabilities {
18
+ architecture: string
19
+ condition: string
20
+ cve: string
21
+ cvss2_score: number
22
+ cvss3_score: number
23
+ detection_time: string
24
+ external_references: string[]
25
+ name: string
26
+ published: string
27
+ severity: string
28
+ status: string
29
+ title: string
30
+ type: string
31
+ updated: string
32
+ version: string
33
+}
34
+
35
+export type OutdatedWazuhAgents = Agents[]
36
+
37
+export type OutdatedVelociraptorAgents = Agents[]
src/views/apps/Dashboards/Agents.vue
+1
@@ -43,6 +43,7 @@
43
</div>
44
<div class="ip fs-14 secondary-text">{{ agent.ip_address }}</div>
45
<div class="os fs-14 secondary-text">{{ agent.os }}</div>
46
+ <div class="os fs-14 secondary-text">{{ agent.label }}</div>
47
</div>
48
<div class="phone align-vertical p-10">
49
<span class="align-vertical-middle">{{ agent.last_seen }}</span>