-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsearch.sh
executable file
·78 lines (68 loc) · 1.57 KB
/
search.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
#!/bin/bash
BOLD="\e[1m"
NORMAL="\e[0m"
GREEN="\e[32m"
RED="\e[30m"
HELP="
[+]USAGE:\t./search.sh (OPTIONS) keyword ReconHome\n
-j (string) - search in javascript files
-e (string) - search in header files
-t (string) - search in html files
-h - help
"
#writing code to check for expressions in html
searchhtml() {
local WORD="${1}"
for domain in $(ls "aquatone/html")
do
RES=$(cat aquatone/html/$domain | grep -inE "${WORD}")
if [ $(echo $RES | wc -c) -ge 2 ]
then
echo -e "\n${BOLD}${GREEN}${domain}${NORMAL}"
echo $RES
fi
done
}
#writing code to check for expressions in html
searchheader() {
local WORD="${1}"
for domain in $(ls "aquatone/headers")
do
RES=$(cat aquatone/headers/$domain | grep -iE "${WORD}")
if [ $(echo $RES | wc -c) -ge 2 ]
then
echo -e "\n${BOLD}${GREEN}${domain}${NORMAL}"
echo $RES
fi
done
}
#writing code to check for expressions in html
searchjs() {
local WORD="${1}"
for domain in $(ls scriptResponse)
do
for file in $(ls scriptResponse/$domain)
do
RES=$(grep --color -inE "${WORD}" scriptResponse/$domain/$file)
if [ $(echo $RES | wc -c) -ge 2 ]
then
echo -e "\n${BOLD}${GREEN}${domain}/${file}${NORMAL}"
echo $RES
fi
done
done
}
while getopts j:e:t:h OPTIONS
do
case "${OPTIONS}" in
j) searchjs "${OPTARG}" "target";;
t) searchhtml "${OPTARG}" ;;
e) searchheader "${OPTARG}" ;;
h) echo -e "${HELP}" ;;
*)
echo "[+] Select a valid option.\n"
echo -e "${HELP}"
exit 1
;;
esac
done