diff --git a/modules/cgiban.js b/modules/cgiban.js new file mode 100644 index 0000000..9f6d73c --- /dev/null +++ b/modules/cgiban.js @@ -0,0 +1,49 @@ +const express = require("express"); +const { NetHelperModule } = global.moduleApi; + +const HTTPServer = require("../components/_http"); + +module.exports = class CgiBanPage extends NetHelperModule { + constructor() { + super(); + this.router = express.Router(); + + this.cgiban = new this.statics.Operator( + "cgiban", + (argv) => { + return argv.length === 0; + }, + (argv, self, syntaxTree) => { + console.log( + "asdsadsadsadas cgiban", + syntaxTree.Type, + syntaxTree.Type.prototype instanceof HTTPServer, + ); + if (!(syntaxTree.Type.prototype instanceof HTTPServer)) { + throw new SyntaxError("Unsupported type of server"); + } + + const router = this.router; + router.use("/cgi-bin/*", (req, res, next) => { + res + .status(400) + .send( + "

CGI Scripts denied


Perl is the language of dinosaurs and faggots, shove your query up your ass, piece of shit

", + ); + }); + router.use("*", (req, res, n) => n()); + }, + ); + + this.operators.push(this.cgiban); + + this.emit("runned", () => { + this.serverType.app.use(router); + }); + } + + bind(type) { + super.bind(type); + this.serverType.routelist.push(this.router); + } +}; \ No newline at end of file