2025-03-06 22:18:15 +01:00
|
|
|
import {type HacktheboxInfo} from "#Infos/Hacking/Hackthebox.tsx";
|
|
|
|
import type { Handler } from "..";
|
2023-05-08 03:00:11 +02:00
|
|
|
|
2025-03-06 22:18:15 +01:00
|
|
|
export const hacking_hackthebox: Handler = async () => {
|
2025-03-02 14:37:13 +01:00
|
|
|
const hackthebox = await (await fetch("https://www.hackthebox.com/api/v4/profile/activity/1063999")).json() as {
|
2023-05-08 03:00:11 +02:00
|
|
|
profile: {
|
2024-04-27 18:45:18 +02:00
|
|
|
activity: HacktheboxInfo[];
|
|
|
|
};
|
2025-03-02 14:37:13 +01:00
|
|
|
};
|
2023-05-08 03:00:11 +02:00
|
|
|
|
2025-02-26 23:58:49 +01:00
|
|
|
const pwn = hackthebox.profile.activity.find((a: HacktheboxInfo) => a?.object_type === "machine");
|
2023-05-08 03:00:11 +02:00
|
|
|
if (!pwn) {
|
2025-03-06 22:18:15 +01:00
|
|
|
return new Response("Not Found", {status: 404});
|
2023-05-08 03:00:11 +02:00
|
|
|
}
|
|
|
|
|
2024-04-27 18:45:18 +02:00
|
|
|
pwn.machine_avatar = `https://www.hackthebox.com${pwn.machine_avatar}`;
|
|
|
|
pwn.date = pwn.date.substring(0, pwn.date.indexOf("T"));
|
2023-05-08 03:00:11 +02:00
|
|
|
|
2025-03-06 22:18:15 +01:00
|
|
|
return new Response(new Blob([JSON.stringify(pwn)], {
|
|
|
|
type: "application/json",
|
|
|
|
}), {status: 200});
|
2024-04-27 18:45:18 +02:00
|
|
|
};
|