From b18fe33ee30d92c317b2838d884c8e41b202d264 Mon Sep 17 00:00:00 2001 From: AstronomicallyCookedTomato Date: Fri, 2 Oct 2026 20:30:43 +0200 Subject: [PATCH] Lagde mockdata til Software siden, oppdaterte README og mappestruktur i frontend --- frontend/{README.md => InitialSetup.md} | 0 frontend/src/data/softwareData.ts | 52 +++++++ frontend/src/data/softwareMockData.ts | 128 ++++++++++++++++++ frontend/src/pages/{ => Home}/Home.css | 0 frontend/src/pages/{ => Home}/Home.tsx | 0 .../src/pages/{ => SavedItems}/SavedItems.css | 0 .../src/pages/{ => SavedItems}/SavedItems.tsx | 0 .../src/pages/{ => Software}/Software.css | 0 .../src/pages/{ => Software}/Software.tsx | 42 ++---- .../pages/{ => Software}/SoftwareDetail.css | 0 .../pages/{ => Software}/SoftwareDetail.tsx | 50 +------ frontend/src/routes/AppRoutes.tsx | 8 +- 12 files changed, 201 insertions(+), 79 deletions(-) rename frontend/{README.md => InitialSetup.md} (100%) create mode 100644 frontend/src/data/softwareData.ts create mode 100644 frontend/src/data/softwareMockData.ts rename frontend/src/pages/{ => Home}/Home.css (100%) rename frontend/src/pages/{ => Home}/Home.tsx (100%) rename frontend/src/pages/{ => SavedItems}/SavedItems.css (100%) rename frontend/src/pages/{ => SavedItems}/SavedItems.tsx (100%) rename frontend/src/pages/{ => Software}/Software.css (100%) rename frontend/src/pages/{ => Software}/Software.tsx (92%) rename frontend/src/pages/{ => Software}/SoftwareDetail.css (100%) rename frontend/src/pages/{ => Software}/SoftwareDetail.tsx (88%) diff --git a/frontend/README.md b/frontend/InitialSetup.md similarity index 100% rename from frontend/README.md rename to frontend/InitialSetup.md diff --git a/frontend/src/data/softwareData.ts b/frontend/src/data/softwareData.ts new file mode 100644 index 0000000..babf09c --- /dev/null +++ b/frontend/src/data/softwareData.ts @@ -0,0 +1,52 @@ +import { graphqlRequest } from "../api/graphql"; +import { mockSoftware, type SoftwareEntry } from "./softwareMockData"; + +export type { SoftwareEntry } from "./softwareMockData"; + +export const USE_SOFTWARE_MOCK_DATA = true; // ENDRE DENNE FOR Å IKKE BRUKE MOCK!!! + +export type SoftwareCatalogEntry = Omit; + +export async function getSoftwareCatalog(): Promise { + if (USE_SOFTWARE_MOCK_DATA) return mockSoftware; + + const data = await graphqlRequest<{ software: SoftwareCatalogEntry[] }>(` + query SoftwareCatalog { + software { + id + mitreId + name + description + type + aliases + platforms + } + } + `); + + return data.software; +} + +export async function getSoftwareByMitreId(mitreId: string): Promise { + if (USE_SOFTWARE_MOCK_DATA) { + return mockSoftware.find((entry) => entry.mitreId === mitreId) ?? null; + } + + const data = await graphqlRequest<{ softwareByMitreId: SoftwareEntry | null }>(` + query SoftwareDetail($mitreId: String!) { + softwareByMitreId(mitreId: $mitreId) { + id + mitreId + name + description + type + aliases + platforms + associatedTechniques { id mitreId name } + usedByThreatActors { id mitreId name } + } + } + `, { mitreId }); + + return data.softwareByMitreId; +} \ No newline at end of file diff --git a/frontend/src/data/softwareMockData.ts b/frontend/src/data/softwareMockData.ts new file mode 100644 index 0000000..471e65b --- /dev/null +++ b/frontend/src/data/softwareMockData.ts @@ -0,0 +1,128 @@ +export type RelatedSoftwareEntry = { + id: string; + mitreId: string; + name: string; +}; + +export type SoftwareEntry = { + id: string; + mitreId: string; + name: string; + type: "TOOL" | "MALWARE"; + summary: string; + description: string; + aliases: string[]; + platforms: string[]; + associatedTechniques: RelatedSoftwareEntry[]; + usedByThreatActors: RelatedSoftwareEntry[]; +}; + +export const mockSoftware: SoftwareEntry[] = [ + { + id: "S0002", + mitreId: "S0002", + name: "Mimikatz", + type: "TOOL", + summary: "Extracts credentials from memory using LSASS dumping and other techniques.", + description: "Mimikatz is an open-source tool used to extract credentials from Windows memory, including passwords, hash values, Kerberos tickets, and other authentication material. It is widely used by adversaries for post-exploitation and credential theft, and can also be used to perform pass-the-hash, pass-the-ticket, and other credential-related attacks. Mimikatz is commonly employed in red team operations and malicious campaigns due to its flexibility and extensive feature set for interacting with Windows security internals.", + aliases: ["mimikatz", "kiwi", "gentilkiwi", "mimilb"], + platforms: ["Windows"], + associatedTechniques: [ + { id: "T1003", mitreId: "T1003", name: "OS Credential Dumping" }, + { id: "T1555", mitreId: "T1555", name: "Credentials from Password Stores" }, + { id: "T1078", mitreId: "T1078", name: "Valid Accounts" }, + { id: "T1059", mitreId: "T1059", name: "Command and Scripting Interpreter" }, + { id: "T1110", mitreId: "T1110", name: "Brute Force" }, + ], + usedByThreatActors: [ + { id: "G0016", mitreId: "G0016", name: "APT28" }, + { id: "apt29", mitreId: "G0016", name: "APT29" }, + { id: "G0032", mitreId: "G0032", name: "Lazarus Group" }, + { id: "G0034", mitreId: "G0034", name: "Sandworm Team" }, + ], + }, + { + id: "S0154", + mitreId: "S0154", + name: "Cobalt Strike", + type: "TOOL", + summary: "Adversary emulation framework for post-exploitation, C2, and lateral movement.", + description: "Adversary emulation framework for post-exploitation, C2, and lateral movement.", + aliases: ["CobaltStrike"], + platforms: ["Windows", "Linux", "macOS"], + associatedTechniques: [], + usedByThreatActors: [], + }, + { + id: "S0363", + mitreId: "S0363", + name: "PowerShell Empire", + type: "TOOL", + summary: "Post-exploitation framework using PowerShell for C2 and lateral movement.", + description: "Post-exploitation framework using PowerShell for C2 and lateral movement.", + aliases: ["Empire", "PowerShell Empire"], + platforms: ["Windows", "Linux", "macOS"], + associatedTechniques: [], + usedByThreatActors: [], + }, + { + id: "S0498", + mitreId: "S0498", + name: "WellMess", + type: "MALWARE", + summary: "Modular backdoor used for espionage and data theft.", + description: "Modular backdoor used for espionage and data theft.", + aliases: ["WellMess"], + platforms: ["Windows", "Linux"], + associatedTechniques: [], + usedByThreatActors: [], + }, + { + id: "S0521", + mitreId: "S0521", + name: "SeaDuke", + type: "MALWARE", + summary: "Modular malware platform used for long-term espionage operations.", + description: "Modular malware platform used for long-term espionage operations.", + aliases: ["SeaDuke"], + platforms: ["Windows"], + associatedTechniques: [], + usedByThreatActors: [], + }, + { + id: "S0580", + mitreId: "S0580", + name: "SUNBURST", + type: "MALWARE", + summary: "Supply chain malware used to gain long-term access to target environments.", + description: "Supply chain malware used to gain long-term access to target environments.", + aliases: ["SUNBURST", "Solorigate"], + platforms: ["Windows"], + associatedTechniques: [], + usedByThreatActors: [], + }, + { + id: "S0619", + mitreId: "S0619", + name: "DarkHalo", + type: "MALWARE", + summary: "Backdoor used for privilege escalation and persistent access.", + description: "Backdoor used for privilege escalation and persistent access.", + aliases: ["DarkHalo"], + platforms: ["Windows"], + associatedTechniques: [], + usedByThreatActors: [], + }, + { + id: "S0689", + mitreId: "S0689", + name: "PlugX", + type: "MALWARE", + summary: "Modular remote access trojan used for espionage and data exfiltration.", + description: "Modular remote access trojan used for espionage and data exfiltration.", + aliases: ["PlugX", "Korplug"], + platforms: ["Windows"], + associatedTechniques: [], + usedByThreatActors: [], + }, +]; \ No newline at end of file diff --git a/frontend/src/pages/Home.css b/frontend/src/pages/Home/Home.css similarity index 100% rename from frontend/src/pages/Home.css rename to frontend/src/pages/Home/Home.css diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home/Home.tsx similarity index 100% rename from frontend/src/pages/Home.tsx rename to frontend/src/pages/Home/Home.tsx diff --git a/frontend/src/pages/SavedItems.css b/frontend/src/pages/SavedItems/SavedItems.css similarity index 100% rename from frontend/src/pages/SavedItems.css rename to frontend/src/pages/SavedItems/SavedItems.css diff --git a/frontend/src/pages/SavedItems.tsx b/frontend/src/pages/SavedItems/SavedItems.tsx similarity index 100% rename from frontend/src/pages/SavedItems.tsx rename to frontend/src/pages/SavedItems/SavedItems.tsx diff --git a/frontend/src/pages/Software.css b/frontend/src/pages/Software/Software.css similarity index 100% rename from frontend/src/pages/Software.css rename to frontend/src/pages/Software/Software.css diff --git a/frontend/src/pages/Software.tsx b/frontend/src/pages/Software/Software.tsx similarity index 92% rename from frontend/src/pages/Software.tsx rename to frontend/src/pages/Software/Software.tsx index 36f8026..aa645f8 100644 --- a/frontend/src/pages/Software.tsx +++ b/frontend/src/pages/Software/Software.tsx @@ -12,23 +12,13 @@ import { Shield, TerminalSquare, } from "lucide-react"; -import { graphqlRequest } from "../api/graphql"; +import { getSoftwareCatalog, type SoftwareCatalogEntry } from "../../data/softwareData"; import "./Software.css"; -type SoftwareEntry = { - id: string; - mitreId: string; - name: string; - type: "TOOL" | "MALWARE"; - description: string; - aliases: string[]; - platforms: string[]; -}; - -const PAGE_SIZE = 10; +const PAGE_SIZE = 8; function Software() { - const [softwareEntries, setSoftwareEntries] = useState([]); + const [softwareEntries, setSoftwareEntries] = useState([]); const [loading, setLoading] = useState(true); const [loadError, setLoadError] = useState(""); const [search, setSearch] = useState(""); @@ -39,21 +29,9 @@ function Software() { useEffect(() => { let cancelled = false; - graphqlRequest<{ software: SoftwareEntry[] }>(` - query SoftwareCatalog { - software { - id - mitreId - name - description - type - aliases - platforms - } - } - `) - .then((data) => { - if (!cancelled) setSoftwareEntries(data.software); + getSoftwareCatalog() + .then((entries) => { + if (!cancelled) setSoftwareEntries(entries); }) .catch((error: unknown) => { if (!cancelled) { @@ -221,7 +199,7 @@ function Software() {
) : loadError ? (
@@ -251,15 +229,15 @@ function Software() {

{entry.name}

-

{entry.description}

+

{("summary" in entry && entry.summary) || entry.description}

{entry.platforms.join(" · ")}

- View details