replaced echo with iptables, time to see if it works

This commit is contained in:
2023-08-28 16:08:50 +02:00
parent 8277e65f13
commit 64288d4922
+2 -2
View File
@@ -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;