Advertisement
Jackspade9624

vscan.sh

Jun 8th, 2025 (edited)
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Define color codes for better output readability
  4. RED='\033[0;31m'
  5. GREEN='\033[0;32m'
  6. YELLOW='\033[0;33m'
  7. NC='\033[0m' # No Color
  8.  
  9. # Function to display the menu
  10. display_menu() {
  11. echo -e "${GREEN}==============================${NC}"
  12. echo -e "${GREEN} Simple Vulnerability Scan ${NC}"
  13. echo -e "${GREEN}==============================${NC}"
  14. echo "1. Network Scan (using Nmap)"
  15. echo "2. Open Port Check (using Netcat)"
  16. echo "3. File Integrity Check (using md5sum)"
  17. echo "4. Check Bash Vulnerability (Shellshock)"
  18. echo "5. Exit"
  19. echo -e "${GREEN}==============================${NC}"
  20. }
  21.  
  22. # Function for Network Scan using Nmap
  23. network_scan() {
  24. echo -e "${YELLOW}Starting Network Scan...${NC}"
  25. echo "Enter target IP range (e.g., 192.168.1.0/24):"
  26. read ip_range
  27.  
  28. # Check if Nmap is installed
  29. if ! command -v nmap &> /dev/null; then
  30. echo -e "${RED}Error: Nmap is not installed. Please install Nmap and try again.${NC}"
  31. return 1
  32. fi
  33.  
  34. echo -e "${YELLOW}Scanning $ip_range...${NC}"
  35. nmap -sP "$ip_range" # -sP for ping scan, customize for other scan types
  36. echo -e "${GREEN}Network scan complete.${NC}"
  37. }
  38.  
  39. # Function for Open Port Check using Netcat
  40. open_port_check() {
  41. echo -e "${YELLOW}Starting Open Port Check...${NC}"
  42. echo "Enter target IP address or hostname:"
  43. read target_ip
  44.  
  45. echo -e "${YELLOW}Checking open ports on $target_ip...${NC}"
  46. # Adjust the port range (e.g., 1-1023) based on your needs
  47. nc -zv "$target_ip" 1-1023 2>&1 | grep succeeded
  48. echo -e "${GREEN}Open port check complete.${NC}"
  49. }
  50.  
  51. # Function for File Integrity Check using md5sum
  52. file_integrity_check() {
  53. echo -e "${YELLOW}Starting File Integrity Check...${NC}"
  54. echo "Enter file path:"
  55. read file_path
  56.  
  57. if [ ! -f "$file_path" ]; then
  58. echo -e "${RED}Error: File not found.${NC}"
  59. return 1
  60. fi
  61.  
  62. original_checksum=$(md5sum "$file_path" | awk '{print $1}')
  63. echo "Original Checksum: $original_checksum"
  64.  
  65. echo -e "${YELLOW}Performing file integrity check...${NC}"
  66. current_checksum=$(md5sum "$file_path" | awk '{print $1}')
  67.  
  68. if [ "$original_checksum" == "$current_checksum" ]; then
  69. echo -e "${GREEN}File integrity is intact.${NC}"
  70. else
  71. echo -e "${RED}Warning: File integrity check failed!${NC}"
  72. fi
  73. }
  74.  
  75. # Function to check for Bash Vulnerability (Shellshock)
  76. check_bash_vulnerability() {
  77. echo -e "${YELLOW}Checking for Bash vulnerability (Shellshock)...${NC}"
  78. # This command tests for the Shellshock vulnerability
  79. result=$(env x='() { :;}; echo VULNERABLE' bash -c :)
  80.  
  81. if echo "$result" | grep -q "VULNERABLE"; then
  82. echo -e "${RED}System is potentially vulnerable to Shellshock.${NC}"
  83. else
  84. echo -e "${GREEN}System appears to be patched against Shellshock.${NC}"
  85. fi
  86. }
  87.  
  88. # Main script loop
  89. while true; do
  90. display_menu
  91. echo "Enter your choice:"
  92. read choice
  93.  
  94. case "$choice" in
  95. 1)
  96. network_scan
  97. ;;
  98. 2)
  99. open_port_check
  100. ;;
  101. 3)
  102. file_integrity_check
  103. ;;
  104. 4)
  105. check_bash_vulnerability
  106. ;;
  107. 5)
  108. echo -e "${YELLOW}Exiting...${NC}"
  109. exit 0
  110. ;;
  111. *)
  112. echo -e "${RED}Invalid choice. Please enter a number from the menu.${NC}"
  113. ;;
  114. esac
  115.  
  116. echo # Add an empty line for readability
  117. read -rp "Press Enter to continue..."
  118. done
  119.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement