INNER CODE UNIT · JavaScript

readFile

Adamkadaban/CTFs · 1.CTFs/CSAW Red 2020/web/traverse 1/index.js:10

function readFile(filepath) {
  return fs.readFileSync(filepath, {encoding: 'utf8'});
}


app.use(logger());
app.use(async ctx => {
  // Get the filepath from the http get query
  // https://en.wikipedia.org/wiki/Query_string
  const filepath = ctx.query.filepath || 'index.html';

  // Return the file as a response
  ctx.body = readFile(filepath);
});

console.log('http://0.0.0.0:5000/')
app.listen(5000);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…