From 64288d492289ef0f6d625590072b012144fee450 Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 28 Aug 2023 16:08:50 +0200 Subject: [PATCH] replaced echo with iptables, time to see if it works --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 0d28acc..4731f1b 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,5 @@ const net = require("net") -const {spawn,exec} = require("child_process"); +const {exec} = require("child_process"); const portlist = [21,1433,7777] const host = "0.0.0.0"; var ipSet = new Set() @@ -26,7 +26,7 @@ portlist.forEach(i => { // This interval looks through the ipSet every 30 seconds and if there are an inside, it will ban them and remove them from the Set setInterval(()=>{ ipSet.forEach(i => { - exec(`echo -A INPUT -s ${i} -j DROP`, (error, stdout, stderr) => { + exec(`iptables -A INPUT -s ${i} -j DROP`, (error, stdout, stderr) => { if (error) { console.log(`error: ${error.message}`); return;