-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataHound.sh
90 lines (82 loc) · 2.5 KB
/
DataHound.sh
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
#!/bin/bash
BOLD="\e[1m"
NORMAL="\e[0m"
GREEN="\e[32m"
RED="\e[31m"
YELLOW="\e[33m"
HELP="
${BOLD}[+]USAGE:${NORMAL} ./search.sh (OPTIONS)
-j (string) - search in javascript files
-x (string) - search in header files
-e (string) - search in html files
-n (string) - search nmap scans
-h - help
"
# function to search for expressions in HTML files
searchhtml() {
local WORD="${1}"
for domain in $(ls Response-Body); do
echo -e "\n${BOLD}${YELLOW}${domain}${NORMAL}"
RES=$(cat Response-Body/$domain | grep -E --color=always "${WORD}")
if [ $(echo $RES | wc -c) -le 1 ]; then
echo -e "${BOLD}${RED}No results found${NORMAL}"
else
echo -e $RES
fi
done
}
# function to search for expressions in header files
searchheader() {
local WORD="${1}"
for domain in $(ls Headers); do
echo -e "\n${BOLD}${YELLOW}${domain}${NORMAL}"
RES=$(cat Headers/$domain | grep -E --color=always "${WORD}")
if [ $(echo $RES | wc -c) -le 1 ]; then
echo -e "${BOLD}${RED}No results found${NORMAL}"
else
echo -e $RES
fi
done
}
# function to search for expressions in Javascript files
searchjs() {
local WORD="${1}"
for domain in $(ls Scripts-Response); do
for file in $(ls Scripts-Response/$domain); do
echo -e "\n${BOLD}${YELLOW}${domain}/${file}${NORMAL}"
RES=$(cat Scripts-Response/$domain/$file | js-beautify | grep --color=always -E "${WORD}")
if [ $(echo $RES | wc -c) -le 1 ]; then
echo -e "${BOLD}${RED}No results found${NORMAL}"
else
echo -e $RES
fi
done
done
}
# function to search for expressions in nmap scans
searchnmap() {
local WORD="${1}"
for domain in $(ls ../Scan/Nmap-scans); do
echo -e "\n${BOLD}${YELLOW}${domain}${NORMAL}"
RES=$(cat Nmap-scans/$domain | grep -E --color=always "${WORD}")
if [ $(echo $RES | wc -c) -le 1 ]; then
echo -e "${BOLD}${RED}No results found${NORMAL}"
else
echo -e $RES
fi
done
}
while getopts j:x:e:n:h OPTIONS; do
case "${OPTIONS}" in
j) searchjs "${OPTARG}" ;;
e) searchhtml "${OPTARG}" ;;
x) searchheader "${OPTARG}" ;;
n) searchnmap "${OPTARG}" ;;
h) echo -e "${HELP}" ;;
*)
echo -e "${BOLD}${RED}[+] Select a valid option.${NORMAL}\n"
echo -e "${HELP}"
exit 1
;;
esac
done