-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HTB parser #193
Merged
Merged
Add HTB parser #193
Conversation
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 parses the tasks of the CTF website https://ctf.hackthebox.com/ The tasks can be copied from the network tab. A direct GET-request to the endpoint does not work, since the endpoint requires authentication with a bearer token in the Authorization header. The number to category mapping seems to be static and comes from the https://ctf.hackthebox.com/api/public/challengeCategories endpoint, which is publicly accessible. This parser also imports the challenge description. To allow this, the `ParsedTask` type is modified to include an optional `description` field. The object passed to `createTask` is also implicit, to include the description in the object. This commit also includes small code refactoring: - The `ParsedTask` type is not duplicated anymore, but imported from `parsers/index.ts`. - Because of this, the `keep` field is also added to fix typing in `TaskImportDialog.vue`. - The dialog now only hides when the importing is fully finished to prevent confusion with an empty screen after importing (due to delay of importing). The button displays the loading progress.
XeR
requested changes
Dec 10, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR !
Looks like isValid
is broken and the parser will try to hijack everything you paste in.
Here is a light ctfd json I've been using to make my tests for a while if you need one :
{"data": [{"category": "recon", "name": "Welcome", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 17, "value": 100}, {"category": "web", "name": "CaaS", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 8, "value": 132}, {"category": "rev", "name": "Simple Encryption", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 16, "value": 340}, {"category": "ppc", "name": "Warmup ROX", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 14, "value": 454}, {"category": "web", "name": "URL to PDF", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 10, "value": 458}, {"category": "misc", "name": "Miscrypto Alphabet", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 4, "value": 479}, {"category": "ppc", "name": "Dungeon Escape", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 12, "value": 489}, {"category": "web", "name": "XTrader", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 15, "value": 491}, {"category": "misc", "name": "Against the Perfect discord Inquisitor 1", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 1, "value": 496}, {"category": "pwn", "name": "FireHTTPD", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 6, "value": 498}, {"category": "misc", "name": "Mineflag Return", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 21, "value": 498}, {"category": "ppc", "name": "Gamod", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 13, "value": 499}, {"category": "misc", "name": "Against the Perfect discord Inquisitor 2", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 2, "value": 500}, {"category": "misc", "name": "Listening to the flag", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 3, "value": 500}, {"category": "rev", "name": "Cars", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 5, "value": 500}, {"category": "web", "name": "wfPM", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 11, "value": 500}, {"category": "crypto", "name": "Conora Secret", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 18, "value": 500}, {"category": "pwn", "name": "The Return of the Side Effect", "template": "/plugins/dynamic_challenges/assets/view.html", "tags": [], "script": "/plugins/dynamic_challenges/assets/view.js", "type": "dynamic", "id": 19, "value": 500}], "success": true}
XeR
approved these changes
Dec 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This parses the tasks of the CTF website https://ctf.hackthebox.com/. The tasks can be copied from the network tab. A direct GET-request to the endpoint does not work, since the endpoint requires authentication with a bearer token in the Authorization header.
The number to category mapping seems to be static and comes from the https://ctf.hackthebox.com/api/public/challengeCategories endpoint, which is publicly accessible.
This parser also imports the challenge description. To allow this, the
ParsedTask
type is modified to include an optionaldescription
field. The object passed tocreateTask
is also implicit, to include the description in the object.This commit also includes small code refactoring:
ParsedTask
type is not duplicated anymore, but imported fromparsers/index.ts
.keep
field is also added to fix typing inTaskImportDialog.vue
.To test this parser, you can copy the following data from the HTB University CTF 2022: