-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsfiles.sh
executable file
·31 lines (31 loc) · 926 Bytes
/
jsfiles.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
#!/bin/bash
mkdir scripts
mkdir scriptsresponse
RED='\033[0;31m'
NC='\033[0m'
fileFound=false
CUR_PATH=$(pwd)
for x in $(ls "$CUR_PATH/responsebody")
do
printf "$x\n"
if [ $fileFound = true ] || [ $x = $1 ] || [ -z "$1" ]
then
$fileFound = true
printf "\n\n${RED}$x${NC}\n\n"
END_POINTS=$(cat "$CUR_PATH/responsebody/$x" | grep -Eoi "src=\"[^>]+></script>" | cut -d '"' -f 2)
printf "$fileFound\n"
for end_point in $END_POINTS
do
len=$(echo $end_point | grep "http" | wc -c)
mkdir "scriptsresponse/$x/"
URL=$end_point
if [ $len == 0 ]
then
URL="https://$x$end_point"
fi
file=$(basename $end_point)
curl -X GET $URL -L > "scriptsresponse/$x/$file"
echo $URL >> "scripts/$x"
done
fi
done