Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Define color codes for better output readability
- RED='\033[0;31m'
- GREEN='\033[0;32m'
- YELLOW='\033[0;33m'
- NC='\033[0m' # No Color
- # Function to display the menu
- display_menu() {
- echo -e "${GREEN}==============================${NC}"
- echo -e "${GREEN} Simple Vulnerability Scan ${NC}"
- echo -e "${GREEN}==============================${NC}"
- echo "1. Network Scan (using Nmap)"
- echo "2. Open Port Check (using Netcat)"
- echo "3. File Integrity Check (using md5sum)"
- echo "4. Check Bash Vulnerability (Shellshock)"
- echo "5. Exit"
- echo -e "${GREEN}==============================${NC}"
- }
- # Function for Network Scan using Nmap
- network_scan() {
- echo -e "${YELLOW}Starting Network Scan...${NC}"
- echo "Enter target IP range (e.g., 192.168.1.0/24):"
- read ip_range
- # Check if Nmap is installed
- if ! command -v nmap &> /dev/null; then
- echo -e "${RED}Error: Nmap is not installed. Please install Nmap and try again.${NC}"
- return 1
- fi
- echo -e "${YELLOW}Scanning $ip_range...${NC}"
- nmap -sP "$ip_range" # -sP for ping scan, customize for other scan types
- echo -e "${GREEN}Network scan complete.${NC}"
- }
- # Function for Open Port Check using Netcat
- open_port_check() {
- echo -e "${YELLOW}Starting Open Port Check...${NC}"
- echo "Enter target IP address or hostname:"
- read target_ip
- echo -e "${YELLOW}Checking open ports on $target_ip...${NC}"
- # Adjust the port range (e.g., 1-1023) based on your needs
- nc -zv "$target_ip" 1-1023 2>&1 | grep succeeded
- echo -e "${GREEN}Open port check complete.${NC}"
- }
- # Function for File Integrity Check using md5sum
- file_integrity_check() {
- echo -e "${YELLOW}Starting File Integrity Check...${NC}"
- echo "Enter file path:"
- read file_path
- if [ ! -f "$file_path" ]; then
- echo -e "${RED}Error: File not found.${NC}"
- return 1
- fi
- original_checksum=$(md5sum "$file_path" | awk '{print $1}')
- echo "Original Checksum: $original_checksum"
- echo -e "${YELLOW}Performing file integrity check...${NC}"
- current_checksum=$(md5sum "$file_path" | awk '{print $1}')
- if [ "$original_checksum" == "$current_checksum" ]; then
- echo -e "${GREEN}File integrity is intact.${NC}"
- else
- echo -e "${RED}Warning: File integrity check failed!${NC}"
- fi
- }
- # Function to check for Bash Vulnerability (Shellshock)
- check_bash_vulnerability() {
- echo -e "${YELLOW}Checking for Bash vulnerability (Shellshock)...${NC}"
- # This command tests for the Shellshock vulnerability
- result=$(env x='() { :;}; echo VULNERABLE' bash -c :)
- if echo "$result" | grep -q "VULNERABLE"; then
- echo -e "${RED}System is potentially vulnerable to Shellshock.${NC}"
- else
- echo -e "${GREEN}System appears to be patched against Shellshock.${NC}"
- fi
- }
- # Main script loop
- while true; do
- display_menu
- echo "Enter your choice:"
- read choice
- case "$choice" in
- 1)
- network_scan
- ;;
- 2)
- open_port_check
- ;;
- 3)
- file_integrity_check
- ;;
- 4)
- check_bash_vulnerability
- ;;
- 5)
- echo -e "${YELLOW}Exiting...${NC}"
- exit 0
- ;;
- *)
- echo -e "${RED}Invalid choice. Please enter a number from the menu.${NC}"
- ;;
- esac
- echo # Add an empty line for readability
- read -rp "Press Enter to continue..."
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement