-
Notifications
You must be signed in to change notification settings - Fork 0
/
html_parsing.sh
35 lines (30 loc) · 1.06 KB
/
html_parsing.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
#!/bin/bash
if [ "$1" == "" ]
then
echo ""
echo " [#] HTML Parsing"
echo ""
echo " [>] Usage: $0 SITE"
echo " [>] Example: $0 www.site.com"
echo ""
else
echo ""
echo " [#] HTML Parsing"
echo ""
echo " [>] Resolving the URLs from $1"
echo ""
wget -O /tmp/index.html -q $1
grep href /tmp/index.html | cut -d "/" -f 3 | grep "\." | cut -d '"' -f 1 | grep -v "<l" > /tmp/urlslist.txt
for url in $(cat /tmp/urlslist.txt);
do
host $url | grep "has address" | awk -F' ' -v OFS="\t" '{print "",$4,"",$1}' >> /tmp/hostslist.txt;
done
echo ""
echo " ============================================================================="
echo " | # IP URL |"
echo " ============================================================================="
cat /tmp/hostslist.txt | sort -n | uniq | cat -n
echo " ============================================================================="
echo ""
rm /tmp/index.html /tmp/urlslist.txt /tmp/hostslist.txt
fi