-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjls.sh
executable file
·165 lines (133 loc) · 3.41 KB
/
jls.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
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
#!/bin/bash
function help(){
echo "usage:"
echo "this script take list of template and test it on list of url "
echo -e "\t u \t update templates"
echo -e "\t s \t show templates "
echo -e "\t l \t provide list of url (require) "
echo -e "\t t \t use specific template tmp1,tmp2,tmp3,..."
echo -e "\t g \t ignore previous test"
echo -e "\t c \t occurance number (10 default)"
}
function template_base_logs(){
if [ -f ./jls_$1/.logs ];then
a=""
for i in $2 ;do
if ! grep "$i" ./jls_$1/.logs &> /dev/null ;then
a="$a $i"
fi
done
else
a="$2"
fi
echo "$a"
}
function template_specific(){
echo $(echo $1 |sed 's/,/ /g')
}
function template_all(){
ls ~/jls_templates |xargs
}
function a(){
echo $1
echo $2
echo $3
}
function jls(){
mkdir -p jls_$1
# echo "$3"
for i in $3 ;do
template="/home/medbsq/jls_templates/$i"
output="./jls_$1/$i.txt"
#echo "$template"
if [ -f $template ];then
echo -ne "\e[33mtemplate : $i"\\r
# jaeles scan -s $template -U $1 -o $output -c $2
jaeles scan -c $2 -s $template -v -U $1 -o $output
# -c 100 -s jls_templates/aircontrol-rce.yaml -o p
# echo "$i [$(date +%D__%X)]" >> ./jls_$1/.logs
fi
done
echo "------------------------------------------------------------------------------------------------------------" >> ./jls_$1/.logs
find ./$output -empty -delete &> /dev/null
}
function update_tmp(){
# original_location="~/nuclei-templates"
# work_location="~/templates"
#update template from github
cd ~/jaeles-signatures && git pull
cd - &> /dev/null
#transfer tmp process
for i in common cves fuzz mics passives probe sensitive;do
cp $(find ~/jaeles-signatures/$i -iname "*.yaml" ) ~/jls_templates &> /dev/null
done
#custom templates
cp ~/jls/costum_tmp ~/jls_templates &>/dev/null
cd ~/jls-sig/Mysignature && git pull
cd - &> /dev/null
cp ~/jls-sig/Mysignature ~/jls_templates &>/dev/null
cd ~/jls-sig/ghsec-jaeles-signatures && git pull
cd - &> /dev/null
cp ~/jls-sig/ghsec-jaeles-signatures ~/jls_templates &>/dev/null
}
function list_tmp(){
ls ~/jls_templates/
}
#variables
template=""
url=""
occurence=10
ignore=0
#option handler
while getopts ":l:t:c:gsu" OPTION
do
case $OPTION in
s)
list_tmp
exit
;;
t)
template="$OPTARG"
;;
c)
occurence="$OPTARG"
;;
g)
ignore=1
;;
l)
url="$OPTARG"
;;
u)
#update_tmp
update_tmp
exit
;;
:)
help
exit 1
;;
\?)
help
exit 1
;;
esac
done
#get template
if [[ $template == "" ]] && [[ $url == "" ]];then
help
exit
elif [[ $template == "" ]] && [[ $url != "" ]];then
template="$(template_all)"
elif [[ $template != "" ]] && [[ $url == "" ]];then
help
exit
else
template="$(template_specific $template)"
fi
#logs filtration
if [ $ignore -eq 0 ];then
template=$(template_base_logs $url "$template")
#template_base_logs $url "$template"
fi
jls $url $occurence "$template"