-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: auto-push source + sending hash id and exposing frontend source …
…associated with the attack
- Loading branch information
Showing
20 changed files
with
458 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Box, Card, Title } from "@mantine/core" | ||
import { DeleteButton, DownloadButton, EditButton } from "../inputs/Buttons" | ||
import { getDateFormatted } from "@/utils/time" | ||
import { deleteExploitSource, triggerDownloadExploitSource, useClientSolver } from "@/utils/queries" | ||
import { useState } from "react" | ||
import { ExploitSource } from "@/utils/types" | ||
import { YesOrNoModal } from "../modals/YesOrNoModal" | ||
import { notifications } from "@mantine/notifications" | ||
import { useQueryClient } from "@tanstack/react-query" | ||
import { EditExploitSource } from "../modals/EditExploitSource" | ||
|
||
export const ExploitSourceCard = ({ src, latest, viewOnly }: { src: ExploitSource, latest?:boolean, viewOnly?:boolean }) => { | ||
|
||
const clientSolver = useClientSolver() | ||
const [deleteSourceId, setDeleteSourceId] = useState<string|undefined>() | ||
const [editSourceId, setEditSourceId] = useState<string|undefined>() | ||
const queryClient = useQueryClient() | ||
|
||
return <Card key={src.id} style={{width:"100%"}} radius="md" mt="md"> | ||
<Box display="flex" style={{ justifyContent: "space-between", alignItems:"center"}}> | ||
<Title order={3}>📦 {src.id} {latest?"(LATEST)":""}</Title> | ||
<Box display="flex" style={{gap:10}}> | ||
{!viewOnly?<EditButton onClick={()=>{ | ||
setEditSourceId(src.id) | ||
}} />:null} | ||
<DownloadButton onClick={()=>{ | ||
triggerDownloadExploitSource(src.hash) | ||
}} /> | ||
<DeleteButton onClick={()=>{ | ||
setDeleteSourceId(src.id) | ||
}} /> | ||
</Box> | ||
</Box> | ||
|
||
<Title order={4}>💬 Message: {src.message == ""?"No commit message":src.message}</Title> | ||
<Box>#️⃣ hash: {src.hash}</Box> | ||
<Box>⏱️ Pushed at: {getDateFormatted(src.pushed_at)}</Box> | ||
<Box>👤 By: {clientSolver(src.pushed_by)} ({src.arch} {src.distro} {src.os_type})</Box> | ||
<YesOrNoModal | ||
message="Are you sure you want to delete the exploit commit? This could trigger the stop of synced exploit executions!" | ||
open={deleteSourceId != null} | ||
onClose={()=>setDeleteSourceId(undefined)} | ||
onConfirm={()=>{ | ||
deleteExploitSource(deleteSourceId??"").then(()=>{ | ||
notifications.show({ title: "Exploit commit deleted", message: "The exploit commit has been deleted successfully", color: "green" }) | ||
queryClient.refetchQueries({ queryKey: ["exploits", "sources", src.exploit], }) | ||
}).catch((err)=>{ | ||
notifications.show({ title: "Error deleting the exploit commit", message: `An error occurred while deleting the exploit commit: ${err.message}`, color: "red" }) | ||
}).finally(()=>{ setDeleteSourceId(undefined) }) | ||
}} | ||
title={"Deleting exploit commit"} | ||
/> | ||
<EditExploitSource source_id={editSourceId} onClose={() => setEditSourceId(undefined)} exploit_id={src.exploit} /> | ||
</Card> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.