From 1d991fe51b6e4026807e6010b09197c3951ba4f5 Mon Sep 17 00:00:00 2001 From: GZTime Date: Sat, 31 Aug 2024 17:26:09 +0800 Subject: [PATCH] feat: add OSINT and Pentest tags --- src/GZCTF.sln.DotSettings | 2 + src/GZCTF/ClientApp/src/Api.ts | 2 + .../src/locales/en_US/challenge.json | 22 +++---- .../src/locales/ja_JP/challenge.json | 12 ++-- .../src/locales/zh_CN/challenge.json | 18 +++--- .../admin/games/[id]/challenges/Index.tsx | 1 + src/GZCTF/ClientApp/src/utils/Shared.tsx | 59 ++++++++++++++----- src/GZCTF/Utils/Enums.cs | 6 +- 8 files changed, 82 insertions(+), 40 deletions(-) diff --git a/src/GZCTF.sln.DotSettings b/src/GZCTF.sln.DotSettings index 0dcc33103..ac6177e21 100644 --- a/src/GZCTF.sln.DotSettings +++ b/src/GZCTF.sln.DotSettings @@ -18,7 +18,9 @@ True True True + True True + True True True True diff --git a/src/GZCTF/ClientApp/src/Api.ts b/src/GZCTF/ClientApp/src/Api.ts index 4640e8efa..73fe2f38c 100644 --- a/src/GZCTF/ClientApp/src/Api.ts +++ b/src/GZCTF/ClientApp/src/Api.ts @@ -633,6 +633,8 @@ export enum ChallengeTag { Mobile = "Mobile", PPC = "PPC", AI = "AI", + Pentest = "Pentest", + OSINT = "OSINT", } /** 列表响应 */ diff --git a/src/GZCTF/ClientApp/src/locales/en_US/challenge.json b/src/GZCTF/ClientApp/src/locales/en_US/challenge.json index 3172c1e73..561336cae 100644 --- a/src/GZCTF/ClientApp/src/locales/en_US/challenge.json +++ b/src/GZCTF/ClientApp/src/locales/en_US/challenge.json @@ -143,17 +143,19 @@ } }, "tag": { - "ai": "AI", + "ai": "AI security", "blockchain": "Blockchain", - "crypto": "Crypto", - "forensics": "Forensics", - "hardware": "Hardware", - "misc": "Misc", - "mobile": "Mobile", - "ppc": "PPC", - "pwn": "Pwn", - "reverse": "Reverse", - "web": "Web" + "crypto": "Cryptography", + "forensics": "Digital forensics", + "hardware": "Hardware security", + "misc": "Miscellaneous", + "mobile": "Mobile security", + "ppc": "Programming", + "pwn": "Binary exploitation", + "reverse": "Reverse engineering", + "web": "Web security", + "osint": "Open-source intel", + "pentest": "Penetration testing" }, "type": { "dynamic_attachment": { diff --git a/src/GZCTF/ClientApp/src/locales/ja_JP/challenge.json b/src/GZCTF/ClientApp/src/locales/ja_JP/challenge.json index 84d076857..466aecacf 100644 --- a/src/GZCTF/ClientApp/src/locales/ja_JP/challenge.json +++ b/src/GZCTF/ClientApp/src/locales/ja_JP/challenge.json @@ -143,17 +143,19 @@ } }, "tag": { - "ai": "AI", + "ai": "AIセキュリティ", "blockchain": "ブロックチェーン", "crypto": "暗号学", - "forensics": "フォレンジック", - "hardware": "ハードウェア", + "forensics": "デジタル・フォレンジック", + "hardware": "ハードウェアセキュリティ", "misc": "その他", "mobile": "モバイルセキュリティ", "ppc": "プログラミング", - "pwn": "Pwn", + "pwn": "エクスプロイト", "reverse": "リバースエンジニアリング", - "web": "Web" + "web": "ウェブセキュリティ", + "osint": "オープンソース情報", + "pentest": "ペネトレーションテスト" }, "type": { "dynamic_attachment": { diff --git a/src/GZCTF/ClientApp/src/locales/zh_CN/challenge.json b/src/GZCTF/ClientApp/src/locales/zh_CN/challenge.json index c75516f48..dc4190a60 100644 --- a/src/GZCTF/ClientApp/src/locales/zh_CN/challenge.json +++ b/src/GZCTF/ClientApp/src/locales/zh_CN/challenge.json @@ -143,17 +143,19 @@ } }, "tag": { - "ai": "AI", + "ai": "人工智能安全", "blockchain": "区块链", "crypto": "密码学", - "forensics": "取证", - "hardware": "硬件", - "misc": "杂项", + "forensics": "数字取证", + "hardware": "硬件安全", + "misc": "安全杂项", "mobile": "移动安全", - "ppc": "编程", - "pwn": "Pwn", - "reverse": "逆向", - "web": "Web" + "ppc": "专业编程", + "pwn": "二进制漏洞利用", + "reverse": "逆向工程", + "web": "网络安全", + "osint": "开源情报", + "pentest": "渗透测试" }, "type": { "dynamic_attachment": { diff --git a/src/GZCTF/ClientApp/src/pages/admin/games/[id]/challenges/Index.tsx b/src/GZCTF/ClientApp/src/pages/admin/games/[id]/challenges/Index.tsx index e9a2348b1..94c6d6d41 100644 --- a/src/GZCTF/ClientApp/src/pages/admin/games/[id]/challenges/Index.tsx +++ b/src/GZCTF/ClientApp/src/pages/admin/games/[id]/challenges/Index.tsx @@ -123,6 +123,7 @@ const GameChallengeEdit: FC = () => { placeholder={t('admin.content.show_all')} clearable searchable + w="16rem" value={category} nothingFoundMessage={t('admin.content.nothing_found')} onChange={(value) => setCategory(value as ChallengeTag | null)} diff --git a/src/GZCTF/ClientApp/src/utils/Shared.tsx b/src/GZCTF/ClientApp/src/utils/Shared.tsx index 9214e123e..655691d22 100644 --- a/src/GZCTF/ClientApp/src/utils/Shared.tsx +++ b/src/GZCTF/ClientApp/src/utils/Shared.tsx @@ -29,10 +29,12 @@ import { mdiHexagonSlice2, mdiHexagonSlice4, mdiHexagonSlice6, + mdiLanPending, mdiLightbulbOnOutline, mdiMatrix, mdiPlus, mdiRobotLoveOutline, + mdiSearchWeb, mdiWeb, } from '@mdi/js' import { Icon } from '@mdi/react' @@ -104,6 +106,8 @@ export const ChallengeTypeItem: SelectProps['renderOption'] = ({ option }) => { export const useChallengeTagLabelMap = () => { const { t } = useTranslation() const theme = useMantineTheme() + const { colorScheme } = useMantineColorScheme() + const revert = colorScheme === 'dark' ? 'light' : 'dark' return new Map([ [ @@ -122,8 +126,8 @@ export const useChallengeTagLabelMap = () => { desrc: t('challenge.tag.crypto'), icon: mdiMatrix, name: ChallengeTag.Crypto, - color: 'indigo', - colors: theme.colors['indigo'], + color: 'violet', + colors: theme.colors['violet'], }, ], [ @@ -162,8 +166,8 @@ export const useChallengeTagLabelMap = () => { desrc: t('challenge.tag.blockchain'), icon: mdiEthereum, name: ChallengeTag.Blockchain, - color: 'lime', - colors: theme.colors['lime'], + color: 'green', + colors: theme.colors['green'], }, ], [ @@ -172,8 +176,8 @@ export const useChallengeTagLabelMap = () => { desrc: t('challenge.tag.forensics'), icon: mdiFingerprint, name: ChallengeTag.Forensics, - color: 'cyan', - colors: theme.colors['cyan'], + color: 'indigo', + colors: theme.colors['indigo'], }, ], [ @@ -182,8 +186,8 @@ export const useChallengeTagLabelMap = () => { desrc: t('challenge.tag.hardware'), icon: mdiChip, name: ChallengeTag.Hardware, - color: 'violet', - colors: theme.colors['violet'], + color: 'grape', + colors: theme.colors['grape'], }, ], [ @@ -202,8 +206,8 @@ export const useChallengeTagLabelMap = () => { desrc: t('challenge.tag.ppc'), icon: mdiConsole, name: ChallengeTag.PPC, - color: 'orange', - colors: theme.colors['orange'], + color: revert, + colors: theme.colors[revert], }, ], [ @@ -212,8 +216,28 @@ export const useChallengeTagLabelMap = () => { desrc: t('challenge.tag.ai'), icon: mdiRobotLoveOutline, name: ChallengeTag.AI, - color: 'green', - colors: theme.colors['green'], + color: 'lime', + colors: theme.colors['lime'], + }, + ], + [ + ChallengeTag.OSINT, + { + desrc: t('challenge.tag.osint'), + icon: mdiSearchWeb, + name: ChallengeTag.OSINT, + color: 'orange', + colors: theme.colors['orange'], + }, + ], + [ + ChallengeTag.Pentest, + { + desrc: t('challenge.tag.pentest'), + icon: mdiLanPending, + name: ChallengeTag.Pentest, + color: 'cyan', + colors: theme.colors['cyan'], }, ], ]) @@ -230,14 +254,17 @@ export interface ChallengeTagItemProps { type SelectChallengeTagItemProps = ChallengeTagItemProps & ComboboxItem export const ChallengeTagItem: SelectProps['renderOption'] = ({ option }) => { - const { colors, icon, name } = option as SelectChallengeTagItemProps + const { colors, icon, name, desrc } = option as SelectChallengeTagItemProps return ( - - {name} - + + + {name} + + {desrc} + ) } diff --git a/src/GZCTF/Utils/Enums.cs b/src/GZCTF/Utils/Enums.cs index 355424ee1..38e6db07b 100644 --- a/src/GZCTF/Utils/Enums.cs +++ b/src/GZCTF/Utils/Enums.cs @@ -345,7 +345,11 @@ public enum ChallengeTag : byte Hardware = 7, Mobile = 8, PPC = 9, - AI = 10 + // ReSharper disable once InconsistentNaming + AI = 10, + Pentest = 11, + // ReSharper disable once InconsistentNaming + OSINT = 12, } ///