aboutsummaryrefslogtreecommitdiff
path: root/cnc/srv.js
diff options
context:
space:
mode:
authorspv <spv@spv.sh>2025-05-04 20:12:34 -0400
committerspv <spv@spv.sh>2025-05-04 20:12:34 -0400
commite2d1d18715a7c5b80cce02a96b09a5d57de38072 (patch)
tree59ff2ca2227675aaf4173ec4b6c521fff31532ed /cnc/srv.js
flawless victory
Diffstat (limited to 'cnc/srv.js')
-rw-r--r--cnc/srv.js30
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