Skip to content

Latest commit

 

History

History
42 lines (37 loc) · 1.67 KB

README.md

File metadata and controls

42 lines (37 loc) · 1.67 KB

http-anti-flood

A http-anti flood code for HTTP, recomended used for GTPS/Another private-servers game.

  • Feel free to star :) if this helped you..
  • Feel free to report a bugs :) if there is a bugs..

explanations and other

So basically, this http-code will detect the flooder. whoever is detected by the flooder will be immediately blocked by your Windows Firewall. it is recommended for GTPS (Growtopia-Private-Servers) because this is very helpful for those who are often affected by DDoS Attacks.

functions code

function blockthem () {
exec(`netsh advfirewall firewall add rule name="BLACKLIST" dir=in action=block remoteip="${ipAddress}"`, (error, stdout, stderr, spawn) => {
console.log(`[${ipAddress}] Connection have been Blocked`)
 });
}
  • servers data:
function serverdataread () {
	if(fs.existsSync('C:/xampp/htdocs/growtopia/server_data.php')) {
		let data = fs.readFileSync('C:/xampp/htdocs/growtopia/server_data.php','utf8')
		res.write(data)	
	} else {
        res.write(`server|${ipAddress}\nport|17091\ntype|1\n#maint|HTTP`);
	}
}
  • so if there is a function in your http code. you can write blockthem() to block a IPs
  • exec commands
exec(`netsh advfirewall firewall add rule name="BLACKLIST" dir=in action=block remoteip="${ipAddress}"`, (error, stdout, stderr, spawn) => {
// Do something here.
});

Obtained from: