|
@ -1,4 +1,3 @@ |
|
|
|
|
|
|
|
|
#!/usr/bin/env sh |
|
|
#!/usr/bin/env sh |
|
|
|
|
|
|
|
|
#This file name is "dns_freedns.sh" |
|
|
#This file name is "dns_freedns.sh" |
|
@ -60,16 +59,16 @@ dns_freedns_add() { |
|
|
|
|
|
|
|
|
# Now convert the tables in the HTML to CSV. This litte gem from |
|
|
# Now convert the tables in the HTML to CSV. This litte gem from |
|
|
# http://stackoverflow.com/questions/1403087/how-can-i-convert-an-html-table-to-csv |
|
|
# http://stackoverflow.com/questions/1403087/how-can-i-convert-an-html-table-to-csv |
|
|
subdomain_csv="$(echo $htmlpage | |
|
|
|
|
|
grep -i -e '</\?TABLE\|</\?TD\|</\?TR\|</\?TH' | |
|
|
|
|
|
sed 's/^[\ \t]*//g' | |
|
|
|
|
|
tr -d '\n' | |
|
|
|
|
|
sed 's/<\/TR[^>]*>/\n/Ig' | |
|
|
|
|
|
sed 's/<\/\?\(TABLE\|TR\)[^>]*>//Ig' | |
|
|
|
|
|
sed 's/^<T[DH][^>]*>\|<\/\?T[DH][^>]*>$//Ig' | |
|
|
|
|
|
sed 's/<\/T[DH][^>]*><T[DH][^>]*>/,/Ig' | |
|
|
|
|
|
grep 'edit.php?' | |
|
|
|
|
|
grep $top_domain)" |
|
|
|
|
|
|
|
|
subdomain_csv="$(echo $htmlpage \ |
|
|
|
|
|
| grep -i -e '</\?TABLE\|</\?TD\|</\?TR\|</\?TH' \ |
|
|
|
|
|
| sed 's/^[\ \t]*//g' \ |
|
|
|
|
|
| tr -d '\n' \ |
|
|
|
|
|
| sed 's/<\/TR[^>]*>/\n/Ig' \ |
|
|
|
|
|
| sed 's/<\/\?\(TABLE\|TR\)[^>]*>//Ig' \ |
|
|
|
|
|
| sed 's/^<T[DH][^>]*>\|<\/\?T[DH][^>]*>$//Ig' \ |
|
|
|
|
|
| sed 's/<\/T[DH][^>]*><T[DH][^>]*>/,/Ig' \ |
|
|
|
|
|
| grep 'edit.php?' \ |
|
|
|
|
|
| grep $top_domain)" |
|
|
# The above beauty ends with striping out rows that do not have an |
|
|
# The above beauty ends with striping out rows that do not have an |
|
|
# href to edit.php and do not have the top domain we are looking for. |
|
|
# href to edit.php and do not have the top domain we are looking for. |
|
|
# So all we should be left with is CSV of table of subdomains we are |
|
|
# So all we should be left with is CSV of table of subdomains we are |
|
@ -78,8 +77,7 @@ dns_freedns_add() { |
|
|
# Now we have to read through this table and extract the data we need |
|
|
# Now we have to read through this table and extract the data we need |
|
|
IFS=$'\n' |
|
|
IFS=$'\n' |
|
|
found=0 |
|
|
found=0 |
|
|
for line in $subdomain_csv |
|
|
|
|
|
do |
|
|
|
|
|
|
|
|
for line in $subdomain_csv; do |
|
|
tmp="$(echo $line | cut -d ',' -f 1)" |
|
|
tmp="$(echo $line | cut -d ',' -f 1)" |
|
|
if [ $found = 0 ] && _startswith "$tmp" "<td>$top_domain"; then |
|
|
if [ $found = 0 ] && _startswith "$tmp" "<td>$top_domain"; then |
|
|
# this line will contain DNSdomainid for the top_domain |
|
|
# this line will contain DNSdomainid for the top_domain |
|
@ -189,16 +187,16 @@ dns_freedns_rm() { |
|
|
|
|
|
|
|
|
# Now convert the tables in the HTML to CSV. This litte gem from |
|
|
# Now convert the tables in the HTML to CSV. This litte gem from |
|
|
# http://stackoverflow.com/questions/1403087/how-can-i-convert-an-html-table-to-csv |
|
|
# http://stackoverflow.com/questions/1403087/how-can-i-convert-an-html-table-to-csv |
|
|
subdomain_csv="$(echo $htmlpage | |
|
|
|
|
|
grep -i -e '</\?TABLE\|</\?TD\|</\?TR\|</\?TH' | |
|
|
|
|
|
sed 's/^[\ \t]*//g' | |
|
|
|
|
|
tr -d '\n' | |
|
|
|
|
|
sed 's/<\/TR[^>]*>/\n/Ig' | |
|
|
|
|
|
sed 's/<\/\?\(TABLE\|TR\)[^>]*>//Ig' | |
|
|
|
|
|
sed 's/^<T[DH][^>]*>\|<\/\?T[DH][^>]*>$//Ig' | |
|
|
|
|
|
sed 's/<\/T[DH][^>]*><T[DH][^>]*>/,/Ig' | |
|
|
|
|
|
grep 'edit.php?' | |
|
|
|
|
|
grep $fulldomain)" |
|
|
|
|
|
|
|
|
subdomain_csv="$(echo $htmlpage \ |
|
|
|
|
|
| grep -i -e '</\?TABLE\|</\?TD\|</\?TR\|</\?TH' \ |
|
|
|
|
|
| sed 's/^[\ \t]*//g' \ |
|
|
|
|
|
| tr -d '\n' \ |
|
|
|
|
|
| sed 's/<\/TR[^>]*>/\n/Ig' \ |
|
|
|
|
|
| sed 's/<\/\?\(TABLE\|TR\)[^>]*>//Ig' \ |
|
|
|
|
|
| sed 's/^<T[DH][^>]*>\|<\/\?T[DH][^>]*>$//Ig' \ |
|
|
|
|
|
| sed 's/<\/T[DH][^>]*><T[DH][^>]*>/,/Ig' \ |
|
|
|
|
|
| grep 'edit.php?' \ |
|
|
|
|
|
| grep $fulldomain)" |
|
|
# The above beauty ends with striping out rows that do not have an |
|
|
# The above beauty ends with striping out rows that do not have an |
|
|
# href to edit.php and do not have the domain name we are looking for. |
|
|
# href to edit.php and do not have the domain name we are looking for. |
|
|
# So all we should be left with is CSV of table of subdomains we are |
|
|
# So all we should be left with is CSV of table of subdomains we are |
|
@ -206,8 +204,7 @@ dns_freedns_rm() { |
|
|
|
|
|
|
|
|
# Now we have to read through this table and extract the data we need |
|
|
# Now we have to read through this table and extract the data we need |
|
|
IFS=$'\n' |
|
|
IFS=$'\n' |
|
|
for line in $subdomain_csv |
|
|
|
|
|
do |
|
|
|
|
|
|
|
|
for line in $subdomain_csv; do |
|
|
dns_href="$(echo $line | cut -d ',' -f 2)" |
|
|
dns_href="$(echo $line | cut -d ',' -f 2)" |
|
|
tmp=${dns_href#*>} |
|
|
tmp=${dns_href#*>} |
|
|
DNSname=${tmp%%<*} |
|
|
DNSname=${tmp%%<*} |
|
@ -359,7 +356,7 @@ _freedns_urlencode() { |
|
|
c="${1:i:1}" |
|
|
c="${1:i:1}" |
|
|
case $c in |
|
|
case $c in |
|
|
[a-zA-Z0-9.~_-]) printf "$c" ;; |
|
|
[a-zA-Z0-9.~_-]) printf "$c" ;; |
|
|
*) printf '%%%02X' "'$c" |
|
|
|
|
|
|
|
|
*) printf '%%%02X' "'$c" ;; |
|
|
esac |
|
|
esac |
|
|
done |
|
|
done |
|
|
} |
|
|
} |