-
Notifications
You must be signed in to change notification settings - Fork 1
/
dirx
106 lines (91 loc) · 3.56 KB
/
dirx
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
#!/bin/bash
# Created by Trabbit
# RAPS production
# R.C.S.A - DI
clear
# Installations
if ! command -v apache2 &>/dev/null; then
echo "[i] Installing apache2..."
if [[ "$(uname -o 2>/dev/null)" == "Android" ]]; then
pkg install apache2 -y
elif [ "$(uname)" == "Linux" ]; then
sudo apt-get update
sudo apt-get install -y apache2
elif [ "$(uname)" == "Darwin" ]; then
brew install apache2
else
echo "System not supported!"
exit 1
fi
fi
clear
trap 'echo -e "\n{>=============================================<}\n DONE.\n{>=============================================<}"; exit' INT
clear
function find_directories() {
local url=$1
local wordlist_file=$2
while IFS= read -r directory; do
target_url="$url/$directory/"
response=$(curl -s -o /dev/null -w "%{http_code}" "$target_url")
case $response in
200)
echo "[+] Found: /$directory/ (+)> 200 [accepted]"
echo " ╘═URL => $target_url "
;;
403)
echo "[+] Forbidden: /$directory/ (-)> 403"
echo " ╘═URL => $target_url "
;;
404)
echo "[+] Not Found: /$directory/ (-)> 404"
echo " ╘═URL => $target_url "
;;
*)
echo "[-] Unexpected Status Code for /$directory/ (?)> $response"
echo " ╘═URL => $target_url "
;;
esac
done < "$wordlist_file"
}
# Read command line arguments
while getopts 'u:w:' flag; do
case "${flag}" in
u) target_url="${OPTARG}" ;;
w) wordlist_path="${OPTARG}" ;;
*) echo "Invalid option: ${flag}" ;;
esac
done
# Check if required options are provided
if [[ -z "$target_url" || -z "$wordlist_path" ]]; then
clear
echo -e "\e[31mUsage: ./dirx -u <target_url> -w <wordlist_path>\e[0m"
exit 1
fi
# Get Apache version and open ports
apache_version=$(httpd -v | awk -F'[ /]' '/Server version/ {print $4}')
open_ports=$(netstat -tln | awk '/^tcp/ {print $4}' | awk -F: '{print $NF}' | paste -sd,)
# Extract only the filename from the wordlist path
wordlist_filename=$(basename "$wordlist_path")
# User feedback with ASCII art
echo -e "\n ####__ ___/ /___ "
echo -e " ######} |** \\ \\ |\\_ "
echo -e " ######}„_@_ //_@_ |<{////////// "
echo -e "|¯¯¯¯|\\¯¯¯\\‚|¯¯¯¯¯¯¯¯¯|/|¯¯¯¯|\\¯¯¯\\’|¯¯¯¯’|/¯¯¯¯/"
echo -e "| |'| ||__/| |\\__|‚| | | ||__ / "
echo -e "| |'| ||¯¯\\| |/¯¯|‚| |/ / / ¯¯| "
echo -e "|____|/___/‚|_________|'|____|\\___\\’/____/|____| "
echo -e " TRABBIT "
echo -e "{>=============================================<}"
echo -e "| [+] TARGET => $target_url {-u} "
echo -e "| [+] WORDLIST => $wordlist_filename {-w} "
echo -e "| [+] Apache Version => $apache_version "
echo -e "| [+] Open Ports => $open_ports "
echo -e "{>=============================================<}"
echo -e " \\\\\ DIRECTORIES BRUTEFORCE STARTED \\\\\ "
echo -e "{>=============================================<}\n"
# Execute directory brute force
find_directories "$target_url" "$wordlist_path"
# User feedback
echo -e "{>=============================================<}"
echo -e " DONE. "
echo -e "{>=============================================<}"