added whitelist functionality
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
const whitelist = [
|
||||
"127.0.0.1"
|
||||
]
|
||||
|
||||
const net = require("net")
|
||||
const {exec} = require("child_process");
|
||||
const { ReadableStreamDefaultController } = require("node:stream/web");
|
||||
const portlist = [21,1433]
|
||||
const host = "0.0.0.0";
|
||||
var ipSet = new Set()
|
||||
@@ -14,6 +19,9 @@ portlist.forEach(i => {
|
||||
})
|
||||
// defining connection event
|
||||
server.on("connection", a => {
|
||||
// if the ip is in the whitelist, ignore the connection (this is to prevent manually crafted packets to)
|
||||
if(whitelist.includes(a.remoteAddress)) return
|
||||
|
||||
console.log(`incomming connection from : ${a.remoteAddress} on port ${i}`)
|
||||
// handle error even on socket instance (prevents the econnreset error)
|
||||
a.on("error", () => {})
|
||||
|
||||
Reference in New Issue
Block a user