This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
generated from BCACTF/chall-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* misc/miracle * fix dockering * make the process exit * this lines unnecessary --------- Co-authored-by: glacialcascade <[email protected]>
- Loading branch information
1 parent
da347bf
commit bcac79e
Showing
8 changed files
with
1,298 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM node:20.14 | ||
|
||
RUN apt-get update && apt-get install -y curl gcc wget && apt-get clean && rm -rf /var/lib/apt/lists/* \ | ||
&& wget -O ynetd.c https://raw.githubusercontent.com/johnsonjh/ynetd/e6fd08f8f5d0c6b8c18d645957e30ce012536ed4/ynetd.c \ | ||
&& echo "ec7509dec7737da54f8b18e1b5ba935d657f9f016c36cfc9ac08f9952373226f ynetd.c" | sha256sum -c \ | ||
&& gcc -o ynetd ynetd.c && chmod +x ./ynetd && mv ynetd /usr/local/bin/ynetd && rm ynetd.c \ | ||
&& export PATH=$PATH:/usr/local/bin | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app/ | ||
|
||
EXPOSE 8898 | ||
|
||
ENTRYPOINT ["ynetd", "-p", "8898", "node main.js"] |
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,20 @@ | ||
name: Miracle | ||
categories: | ||
- misc | ||
value: 50 | ||
flag: | ||
file: ./flag.txt | ||
description: |- | ||
You'll need a miracle to get this flag. The server requires you to solve an easy addition problem, but you only | ||
get the flag if the bits magically flip to form another answer. | ||
hints: [] | ||
files: | ||
- src: ./main.js | ||
- src: ./eslint.config.mjs | ||
authors: | ||
- Mudasir | ||
visible: true | ||
deploy: | ||
nc: | ||
build: . | ||
expose: 8898/tcp |
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,31 @@ | ||
import globals from "globals"; | ||
import pluginJs from "@eslint/js"; | ||
|
||
|
||
export default [ | ||
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}}, | ||
{languageOptions: { globals: globals.browser }}, | ||
pluginJs.configs.recommended, | ||
{ | ||
rules: { | ||
"no-unused-vars": "error", | ||
"no-octal": "error", | ||
"for-direction": "error", | ||
"getter-return": "error", | ||
"no-async-promise-executor": "error", | ||
"no-compare-neg-zero": "error", | ||
"no-cond-assign": "error", | ||
"no-constant-condition": "error", | ||
"no-control-regex": "error", | ||
"no-dupe-args": "error", | ||
"no-dupe-keys": "error", | ||
"no-duplicate-case": "error", | ||
"no-empty": "error", | ||
"no-empty-character-class": "error", | ||
"no-ex-assign": "error", | ||
"no-extra-boolean-cast": "error", | ||
"no-extra-semi": "error", | ||
"no-invalid-regexp": "error", | ||
} | ||
} | ||
]; |
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 @@ | ||
bcactf{j$_is_W3Ird_?rfuhie4923} |
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,53 @@ | ||
const readline = require("readline"); | ||
const fs = require("fs"); | ||
|
||
async function sleep(ms) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
|
||
// thanks chatgpt | ||
function printWithoutNewline(text) { | ||
process.stdout.write(text); | ||
} | ||
|
||
function prompt(question) { | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
|
||
return new Promise((resolve) => { | ||
rl.question(question, (answer) => { | ||
rl.close(); | ||
resolve(answer); | ||
}); | ||
}); | ||
} | ||
//end thanks chatgpt | ||
|
||
const flag = fs.readFileSync("flag.txt", "utf8"); | ||
|
||
async function run() { | ||
const name = await prompt("What is your name?\n") ?? "Harry"; | ||
const ans = await prompt("What is 55+22?\n") ?? "0"; | ||
if (eval("Number(ans)") === 77) { | ||
console.log("Correct!"); | ||
console.log("Waiting for bits to flip..."); | ||
for (let i = 0; i < 10; i++) { | ||
printWithoutNewline("..."); | ||
await sleep(300); | ||
} | ||
console.log("\n"); | ||
if (eval(ans) === 63) { | ||
console.log(`You made those bits flip?? You're a wizard ${name}! `); | ||
console.log(`Here's your flag: ${flag}`); | ||
} else { | ||
console.log("You didn't make the bits flip. Too bad "); | ||
} | ||
} else { | ||
console.log("wow you suck at math."); | ||
} | ||
process.exit(1); | ||
} | ||
|
||
run(); |
Oops, something went wrong.