Skip to content

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

License

Notifications You must be signed in to change notification settings

FrenzY8/http-anti-flood

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: