Created
October 11, 2016 20:53
-
-
Save pawlos/5178d34a5f267b4c66cfab68f25e5954 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| "use strict"; | |
| var randomstring = require("randomstring"); | |
| var express = require("express"); | |
| var {VM} = require("vm2"); | |
| var fs = require("fs"); | |
| var app = express(); | |
| var flag = require("./config.js").flag | |
| app.get("/", function (req, res) { | |
| res.header("Content-Type", "text/plain"); | |
| /* Orange is so kind so he put the flag here. But if you can guess correctly :P */ | |
| eval("var flag_" + randomstring.generate(64) + " = \"hitcon{" + flag + "}\";") | |
| if (req.query.data && req.query.data.length <= 12) { | |
| var vm = new VM({ | |
| timeout: 1000 | |
| }); | |
| console.log(req.query.data); | |
| res.send("eval ->" + vm.run(req.query.data)); | |
| } else { | |
| res.send(fs.readFileSync(__filename).toString()); | |
| } | |
| }); | |
| app.listen(3000, function () { | |
| console.log("listening on port 3000!"); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment