C0nw0nk / Nginx-Lua-Anti-DDoS

A Anti-DDoS script to protect Nginx web servers using Lua with a HTML Javascript based authentication puzzle inspired by Cloudflare I am under attack mode an Anti-DDoS authentication page protect yourself from every attack type All Layer 7 Attacks Mitigating Historic Attacks DoS DoS Implications DDoS All Brute Force Attacks Zero day exploits Social Engineering Rainbow Tables Password Cracking Tools Password Lists Dictionary Attacks Time Delay Any Hosting Provider Any CMS or Custom Website Unlimited Attempt Frequency Search Attacks HTTP Basic Authentication HTTP Digest Authentication HTML Form Based Authentication Mask Attacks Rule-Based Search Attacks Combinator Attacks Botnet Attacks Unauthorized IPs IP Whitelisting Bruter THC Hydra John the Ripper Brutus Ophcrack unauthorized logins Injection Broken Authentication and Session Management Sensitive Data Exposure XML External Entities (XXE) Broken Access Control Security Misconfiguration Cross-Site Scripting (XSS) Insecure Deserialization Using Components with Known Vulnerabilities Insufficient Logging & Monitoring Drupal WordPress Joomla Flash Magento PHP Plone WHMCS Atlassian Products malicious traffic Adult video script avs KVS Kernel Video Sharing Clip Bucket Tube sites Content Management Systems Social networks scripts backends proxy proxies PHP Python Porn sites xxx adult gaming networks servers sites forums vbulletin phpbb mybb smf simple machines forum xenforo web hosting video streaming buffering ldap upstream downstream download upload rtmp vod video over dl hls dash hds mss livestream drm mp4 mp3 swf css js html php python sex m3u zip rar archive compressed mitigation code source sourcecode chan 4chan 4chan.org 8chan.net 8ch 8ch.net infinite chan 8kun 8kun.net anonymous anon tor services .onion torproject.org nginx.org nginx.com openresty.org darknet dark net deepweb deep web darkweb dark web mirror vpn reddit reddit.com adobe flash hackthissite.org dreamhack hack hacked hacking hacker hackers hackerz hackz hacks code coding script scripting scripter source leaks leaked leaking cve vulnerability great firewall china america japan russia .gov government http1 http2 http3 quic q3 litespeedtech litespeed apache torrents torrent torrenting webtorrent bittorrent bitorrent bit-torrent cyberlocker cyberlockers cyber locker cyberbunker warez keygen key generator free irc internet relay chat peer-to-peer p2p cryptocurrency crypto bitcoin miner browser xmr monero coinhive coin hive coin-hive litecoin ethereum cpu cycles popads pop-ads advert advertisement networks banner ads protect ovh blazingfast.io amazon steampowered valve store.steampowered.com steamcommunity thepiratebay lulzsec antisec xhamster pornhub porn.com pornhub.com xhamster.com xvideos xvdideos.com xnxx xnxx.com popads popcash cpm ppc
MIT License
1.16k stars 269 forks source link

I am Under Attack Mode to Automatically enable during attack and disable when attack ends #25

Open Webuser6666 opened 4 years ago

Webuser6666 commented 4 years ago

add Auto Switch ?

C0nw0nk commented 4 years ago

What do you mean auto switch you have to elaborate and give more detail to what it is you are asking.

My guess is that you want a feature request of the script to automatically detect when under DDoS and switch on / off right ?

Webuser6666 commented 4 years ago

My guess is that you want a feature request of the script to automatically detect when under DDoS and switch on / off right ?

yes ;)

C0nw0nk commented 4 years ago

I can do it easily would require a nginx server config tweak for users though.

http {
     lua_shared_dict antiddos 10m; #Anti-DDoS shared memory zone
}

I will build it in disabled by default and people can add it to their setup and enable it if they want.

Webuser6666 commented 4 years ago

I can do it easily would require a nginx server config tweak for users though.

can add with a choice for people

disaster123 commented 4 years ago

The question is how to detect when under ddos.

I had some things in mind: 1.) check avg. upstream response times and enable if avg response time is above threshold 2.) check avg. requests per IP for content-type html - at east in all cases i know just checking the requests / s is not useful as a lot of sites do a lot of stuff with json, css and so and i saw very high but valid requests

C0nw0nk commented 4 years ago

Those are good methods i was also planning on using ngx.var.binary_remote_addr and inserting their binary IP's into the shared memory space the same as limit_conn and limit_req modules do in order to save memory space since binary data is smaller than the ngx.var.remote_addr string itself. I will add it as a feature with allot of sub features to make it easy to customise the domains, urls, paths, requests types etc you can throttle with it.

rx-209 commented 4 years ago

Hi. Short question - how to exclude some location for script?

C0nw0nk commented 4 years ago

@rx-209 You want to exclude a domain or a URL path like /test/lol ?

rx-209 commented 4 years ago

@rx-209 You want to exclude a domain or a URL path like /test/lol ?

path like /test/lol

C0nw0nk commented 4 years ago

@rx-209

https://github.com/C0nw0nk/Nginx-Lua-Anti-DDoS/commit/bf420a3e95144ed7022209295005b6b373051828

That will allow you to set custom paths in the script to enable protection on and disable protection on.

local master_switch_custom_hosts = {

{
1, --run auth checks
"localhost/path1.*",
},
{
2, --bypass auth checks
"localhost/path2.*",
},

}

@Webuser6666 @disaster123

Currently building it at the moment may take a few weeks for me to finish.

svaldnuk commented 3 years ago

Has anyone been able to add this function or has a solution?

fdmadong commented 12 months ago

I can do it easily would require a nginx server config tweak for users though.

http {
     lua_shared_dict antiddos 10m; #Anti-DDoS shared memory zone
}

I will build it in disabled by default and people can add it to their setup and enable it if they want.

I didn't find a place to use this parameter in the documentation. Turning it on or off doesn't seem to affect the running of the script?