-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmk_3.2.2.sh
More file actions
174 lines (151 loc) · 5.8 KB
/
mk_3.2.2.sh
File metadata and controls
174 lines (151 loc) · 5.8 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
# Function to handle keyboard interrupt
function cleanup() {
echo "Script interrupted. Cleaning up..."
# Kill background processes
kill -SIGTERM $GOBUSTER_PID &> /dev/null
kill -SIGTERM $NIKTO_PID &> /dev/null
kill -SIGTERM $NMAP_PID &> /dev/null
kill -SIGTERM $NUCLEI_PID &> /dev/null
rm -f scan.xml &> /dev/null
rm -f gobuster_results.txt &> /dev/null
rm -f searchsploit_results.txt &> /dev/null
rm -f nikto_results.txt &> /dev/null
rm -f nuclei_results.txt&> /dev/null
exit
}
# Function to export scan results to PDF
function export_to_pdf() {
local scan_results_file=$1
pandoc "$scan_results_file" -o "$scan_results_file.pdf" 2> /dev/null || {
echo "Error producing PDF."
sed -i 's/^[[//g' "$scan_results_file"
pandoc "$scan_results_file" -o "$scan_results_file.pdf"
}
echo "Scan results exported to PDF: $scan_results_file.pdf"
}
# Set keyboard interrupt signal handler
trap cleanup SIGINT
# Prompt the user to choose the service (HTTP or HTTPS)
echo "Choose the service:"
select service in "HTTP" "HTTPS"; do
case $service in
"HTTP")
protocol="http://"
break
;;
"HTTPS")
protocol="https://"
break
;;
*)
echo "Invalid choice. Please try again."
;;
esac
done
# Prompt the user to enter a URL without the protocol
read -p "Enter the URL (without protocol): " url
# Prompt the user to enter IP addresses
echo "Enter IP addresses (space-separated):"
read -a ip_addresses
# Prompt the user to choose tools
echo "Choose which tools to use:"
echo "1. gobuster"
echo "2. nikto"
echo "3. nuclei"
echo "4. nmap"
# Array to store selected tools
selected_tools=()
# Read user's tool selections
while true; do
read -p "Enter the number of a tool (0 to finish): " choice
case $choice in
0)
break
;;
1)
selected_tools+=("gobuster")
;;
2)
selected_tools+=("nikto")
;;
3)
selected_tools+=("nuclei")
echo "Choose Nuclei templates to use (space-separated):"
read -a selected_templates
templates+=("${selected_templates[@]}")
;;
4)
selected_tools+=("nmap")
;;
*)
echo "Invalid choice. Please try again."
;;
esac
done
# Prompt the user to choose a wordlist for gobuster if selected
if [[ " ${selected_tools[@]} " =~ "gobuster" ]]; then
gobuster_wordlist_dir="/usr/share/wordlists/dirbuster"
echo "Choose a wordlist for gobuster:"
select gobuster_wordlist_path in "$gobuster_wordlist_dir"/*; do
if [ -n "$gobuster_wordlist_path" ]; then
echo "Selected wordlist for gobuster: $gobuster_wordlist_path"
break
else
echo "Invalid selection. Please try again."
fi
done
fi
# Ask the user if they want to open Burp Suite
read -p "Do you want to open Burp Suite? (y/n): " open_burp
if [[ $open_burp == "y" || $open_burp == "Y" ]]; then
gnome-terminal --title="Burp Suite" -- bash -c "java -jar -Xmx4g /home/kali/Downloads/burpsuite_community_v2023.5.2.jar; read -p 'Press Enter to close Burp Suite'"
fi
# Run selected tools and capture the output to separate files
for tool in "${selected_tools[@]}"; do
case $tool in
"gobuster")
echo "Enter a filetype for gobuster:"
read filetype
gnome-terminal --title="Gobuster" -- bash -c "gobuster dir -w \"$gobuster_wordlist_path\" -u \"$protocol$url\" -x \"$filetype\" | tee -a gobuster_results.txt; read -p 'Press Enter to close this terminal'"
;;
"nikto")
for ip in "${ip_addresses[@]}"; do
gnome-terminal --title="Nikto $ip" -- bash -c "nikto -h \"$protocol$url\" | tee -a nikto_results.txt; read -p 'Press Enter to close this terminal'"
done
;;
"nuclei")
for template in "${templates[@]}"; do
gnome-terminal --title="$template Nuclei Scan" -- bash -c "nuclei -u \"$url\" -t \"$template\" | tee -a nuclei_results.txt; read -p 'Press Enter to close this terminal'"
done
;;
"nmap")
for ip in "${ip_addresses[@]}"; do
gnome-terminal --title="Nmap $ip" -- bash -c "sudo nmap -p- -sV -O -T4 \"$ip\" -oX scan.xml | tee -a nmap_results.txt; read -p 'Press Enter to close this terminal'"
read -p "Do you want to initiate the searchsploit scan for $ip? (y/n): " initiate_searchsploit
if [[ $initiate_searchsploit == "y" || $initiate_searchsploit == "Y" ]]; then
gnome-terminal --title="Searchsploit $ip" -- bash -c "searchsploit -x --nmap scan.xml | tee -a searchsploit_results.txt; read -p 'Press Enter to close this terminal'"
fi
done
;;
*)
echo "Unknown tool: $tool"
;;
esac
done
# Generate a comprehensive report by combining all the results
echo "Generating comprehensive report..."
# Combine nmap, gobuster, and searchsploit results
cat nmap_results.txt gobuster_results.txt searchsploit_results.txt nikto_results.txt nuclei_results.txt > comprehensive_report.txt
# Add headers information from the nmap scan
echo "Nmap headers information:" >> comprehensive_report.txt
grep -oP '(?<=<service name=").*(?=")' scan.xml >> comprehensive_report.txt
# Print the comprehensive report to the console
cat comprehensive_report.txt
# Ask the user if they want to export the report to PDF
read -p "Do you want to export the report to PDF? (y/n): " export_pdf
if [[ $export_pdf == "y" || $export_pdf == "Y" ]]; then
export_to_pdf comprehensive_report.txt
fi
# Cleanup after completing the scans or on interrupt
cleanup