CGI block
Temp resolve of https://git.fullgream.tech/fullgream/net-helper/issues/4
This commit is contained in:
parent
426f7881e5
commit
7e0d2741d9
49
modules/cgiban.js
Normal file
49
modules/cgiban.js
Normal file
@ -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(
|
||||||
|
"<h1>CGI Scripts denied</h1><hr/><p>Perl is the language of dinosaurs and faggots, shove your query up your ass, piece of shit</p>",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user