-
Notifications
You must be signed in to change notification settings - Fork 0
/
zhizhu.sh
executable file
·55 lines (49 loc) · 1.33 KB
/
zhizhu.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
#!/bin/bash
pre='www.google.com'
function getImage {
#获取图片函数
echo -e "scan:$@"
allImageURLs=$(cat bufPage|tr ' ' 'n'|grep 'http'|grep "jpg'"|cut -d "'" -f 2)
domain=$(echo "$allImageURLs"|cut -d '/' -f 3|head -1)
if ! ( grep -q "$domain" domainlog );then
echo "$domain" >> domainlog
echo "Find New domain!"
fi
for imageURL in $allImageURLs
do
imageName=$(echo ${imageURL##*/})
if [ -e $imageName ];then
echo -e "t****$imageName is existed!"
else
wget -U "$MYAGENT" $imageURL -q
echo -e "t====$imageName saved!"
fi
done
}
function getPage {
curl -A "$MYAGENT" -s $@> bufPage
#获取主页中的超链接,输出到bufpage
getImage $@
allPages=$(cat bufPage|tr ' ' 'n'|grep -v 'list'|grep 'html'|grep -v 'http'|grep "/t/"|cut -d '"' -f 2)
for oneURL in $allPages
do
# echo "<<<<<<$oneURL>>>>>>"
if echo $oneURL|grep -q [[:alnum:]];then
if !( grep -q "$oneURL" waitting || grep -q "$oneURL" scanHistory );then
# echo "$pre$oneURL" >> waitting
echo "add new page $pre$oneURL^^^^"
fi
else
break;
fi
done
}
while args=$(head -1 waitting)
do
sed -i '1d' waitting
if ( echo $args|grep -q [[:alnum:]] );then
getPage $args
else
break
fi
done