-
Notifications
You must be signed in to change notification settings - Fork 64
/
downlocal.sh
47 lines (30 loc) · 901 Bytes
/
downlocal.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
#!/bin/bash
#
# Download files from [Index Of] web pages
#
Usage="[+] Usage:\n \
\tdownlocal <LINK>\n
"
[ -z $1 ] || [ $1 = "-h" ] && echo -e $Usage && exit 1 #{ echo "[-] Don't Forget The Argument"; echo "./donwlocal.sh <LINK>"; exit 1; }
printf -v begin '%(%s)T' -1
down () {
echo "[+] Download From: " $1
curl -s $1 | grep href | awk -F'"' '{print $2}' | grep -v "/$" | xargs -I% bash -c "wget $1/% -q"
}
flist=()
res=$(curl -s $1 | grep href | awk -F'"' '{print $2}' | grep "/$")
for i in $res; do
flist+=($i)
done
down "$1"
#echo "$PWD"
#[ ${#flist[@]} -ne 0 ] && { for dir in "${flist[@]}"; do cd "$PWD"; mkdir "$dir"; cd "$dir"; down "$1/$dir"; done }
#echo "${listdir[@]}"
printf -v end '%(%s)T' -1
time=$[end - begin]
min=$[time / 60]
sec=$[time % 60]
printf "\n#####################\n"
printf "[+] Time: $min:$sec\n"
printf "[+] Done!\n"
printf "#####################\n"