replaced spawn with exec
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const net = require("net")
|
||||
const {spawn} = require("child_process");
|
||||
const {spawn,exec} = require("child_process");
|
||||
const portlist = [21,1433,7777]
|
||||
const host = "0.0.0.0";
|
||||
servermap = new Map()
|
||||
@@ -19,8 +19,22 @@ portlist.forEach(i => {
|
||||
// Handle banning ip
|
||||
|
||||
|
||||
const output = spawn("echo", [`-A INPUT -s ${a.remoteAddress} -j DROP`]);
|
||||
output.stdout.on("data", () => {console.log(data);})
|
||||
// const output = spawn("echo", [`-A INPUT -s ${a.remoteAddress} -j DROP`]);
|
||||
// output.stdout.on("data", () => {console.log(data);})
|
||||
|
||||
|
||||
|
||||
exec(`echo -A INPUT -s ${a.remoteAddress} -j DROP`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`);
|
||||
return;
|
||||
}
|
||||
console.log(`stdout: ${stdout}`);
|
||||
});
|
||||
})
|
||||
servermap.set(i, server)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user