-
Notifications
You must be signed in to change notification settings - Fork 871
Expand file tree
/
Copy pathnikto.sh
More file actions
executable file
·119 lines (97 loc) · 2.85 KB
/
nikto.sh
File metadata and controls
executable file
·119 lines (97 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env bash
# by Lee Baird (@discoverscripts)
trap 'pkill -f nikto; exit' INT TERM
# Check for regular user
if [ "$EUID" == 0 ]; then
echo
echo "[!] This option cannot be ran as root."
echo
exit # Do not use exit 1 here, it will break the script
fi
if grep -q 'Nikto/@VERSION' /etc/nikto/config.txt; then
echo
echo -e "[!] Remove the default user agent string located at ${YELLOW}/etc/nikto/config.txt${NC}"
echo
exit 0
fi
if grep -q '^RFIURL=http://cirt.net/rfiinc.txt?' /etc/nikto/config.txt; then
echo
echo -e "[!] Comment out RFIURL checks located at ${YELLOW}/etc/nikto/config.txt${NC}"
echo
exit 0
fi
clear
f_banner
if command -v ydotool >/dev/null 2>&1; then
if ! pgrep ydotoold >/dev/null; then
echo -e "${YELLOW}[!] ydotoold daemon is not running.${NC}"
echo -e "${YELLOW}[!] Start the daemon manually (sudo ydotoold &) then re-run the Nikto option.${NC}"
echo
exit 0
fi
XDOTOOL="sudo ydotool"
ENTER="enter"
elif command -v xdotool >/dev/null 2>&1; then
XDOTOOL="xdotool"
ENTER="Return"
else
echo
echo -e "${YELLOW}[!] Neither xdotool nor ydotool is installed.${NC}"
echo -e "${YELLOW}[!] Run the Update option from the main menu.${NC}"
echo
exit 0
fi
echo -e "${BLUE}Run multiple instances of Nikto in parallel.${NC}"
echo
echo "1. List of IPs"
echo "2. List of IP:port"
echo "3. Previous menu"
echo
echo -n "Choice: "
read -r CHOICE
case "$CHOICE" in
1) f_location
echo
echo -n "Port (default 80): "
read -r PORT
echo
# Set default port to 80 if not provided
if [ -z "$PORT" ]; then
PORT=80
fi
# Check for a valid port number
if ! [[ "$PORT" =~ ^[0-9]+$ ]] || [ "$PORT" -lt 1 ] || [ "$PORT" -gt 65535 ]; then
f_error
fi
mkdir -p "$HOME/data/nikto-$PORT"
while IFS= read -r LINE; do
$XDOTOOL key ctrl+shift+t
$XDOTOOL type "nikto -h $LINE -port $PORT -no404 -maxtime 15m -Format htm --output $HOME/data/nikto-$PORT/$LINE.htm ; exit"
sleep 2
$XDOTOOL key $ENTER
done < "$LOCATION"
;;
2) f_location
mkdir -p "$HOME/data/nikto"
while IFS=: read -r HOST PORT; do
$XDOTOOL key ctrl+shift+t
sleep 2
$XDOTOOL type "nikto -h $HOST -port $PORT -no404 -maxtime 15m -Format htm --output $HOME/data/nikto/$HOST-$PORT.htm ; exit"
sleep 2
$XDOTOOL key $ENTER
done < "$LOCATION"
;;
3) f_main ;;
*) f_error ;;
esac
echo
echo "$MEDIUM"
echo
echo "[*] Scan complete."
echo
if [ "$CHOICE" == 1 ]; then
echo -e "The new report is located at ${YELLOW}$HOME/data/nikto-$PORT/${NC}"
else
echo -e "The new report is located at ${YELLOW}$HOME/data/nikto-multi/${NC}"
fi
echo