replaced echo with iptables, time to see if it works
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
const net = require("net")
|
const net = require("net")
|
||||||
const {spawn,exec} = require("child_process");
|
const {exec} = require("child_process");
|
||||||
const portlist = [21,1433,7777]
|
const portlist = [21,1433,7777]
|
||||||
const host = "0.0.0.0";
|
const host = "0.0.0.0";
|
||||||
var ipSet = new Set()
|
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
|
// 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(()=>{
|
setInterval(()=>{
|
||||||
ipSet.forEach(i => {
|
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) {
|
if (error) {
|
||||||
console.log(`error: ${error.message}`);
|
console.log(`error: ${error.message}`);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user