mirror of
				https://github.com/mgeeky/Penetration-Testing-Tools.git
				synced 2025-11-04 04:55:26 +01:00 
			
		
		
		
	Added toggleWaf.sh
This commit is contained in:
		@@ -9,3 +9,5 @@ $ ./find-nessus-plugin.sh 62940
 | 
				
			|||||||
- **`openvas-automate.sh`** - A simple OpenVAS scanner automation script. If you want to use your custom defined scan type - you'll need to edit script's code, especially `targets` array and `if` decision statement in lines 111-137. [gist](https://gist.github.com/mgeeky/a038f809dff4d308db94f5f657908da7)
 | 
					- **`openvas-automate.sh`** - A simple OpenVAS scanner automation script. If you want to use your custom defined scan type - you'll need to edit script's code, especially `targets` array and `if` decision statement in lines 111-137. [gist](https://gist.github.com/mgeeky/a038f809dff4d308db94f5f657908da7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- **`prepare-kali.sh`** - A script that supplies fresh Kali installation with set of initial packages, configurations, wordlists (`/root/data`) and a big repository of tools I've found useful (located in `/root/tools`). ([gist](https://gist.github.com/mgeeky/39d1681e44804f089d1553cc7597e628))
 | 
					- **`prepare-kali.sh`** - A script that supplies fresh Kali installation with set of initial packages, configurations, wordlists (`/root/data`) and a big repository of tools I've found useful (located in `/root/tools`). ([gist](https://gist.github.com/mgeeky/39d1681e44804f089d1553cc7597e628))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- **`toggleWaf.sh`** - Simple script used to quickly enable/disable ModSecurity on Apache2
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										39
									
								
								linux/toggleWaf.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								linux/toggleWaf.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					modname=security2
 | 
				
			||||||
 | 
					friendlyname=WAF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ $# -ne 1 ]; then
 | 
				
			||||||
 | 
					    echo "Usage: ./toggleWaf <on|off|status>"
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					case $1 in
 | 
				
			||||||
 | 
					    "on")
 | 
				
			||||||
 | 
					        if [ $EUID -ne 0 ]; then
 | 
				
			||||||
 | 
					            echo "[!] This function must be run as root. Use sudo."
 | 
				
			||||||
 | 
					            exit 1
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        a2enmod $modname > /dev/null
 | 
				
			||||||
 | 
					        systemctl reload apache2
 | 
				
			||||||
 | 
					        echo "[+] $friendlyname enabled."
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    "off")
 | 
				
			||||||
 | 
					        if [ $EUID -ne 0 ]; then
 | 
				
			||||||
 | 
					            echo "[!] This function must be run as root. Use sudo."
 | 
				
			||||||
 | 
					            exit 1
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        a2dismod $modname > /dev/null
 | 
				
			||||||
 | 
					        systemctl reload apache2
 | 
				
			||||||
 | 
					        echo "[-] $friendlyname disabled."
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    "status")
 | 
				
			||||||
 | 
					        if a2query -m $modname 2> /dev/null | grep -q 'enabled' ; then
 | 
				
			||||||
 | 
					            echo "[+] $friendlyname is enabled."
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					            echo "[-] $friendlyname is disabled."
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
		Reference in New Issue
	
	Block a user