IPv6 ReverseIP, OpenWRT-Build hat kein sipcalc

This commit is contained in:
Blackyfff 2021-01-04 20:53:39 +01:00
parent 6451a20eb5
commit 5fd536d939
1 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,11 @@ function validate_ip() {
fi
return $stat
}
function reverseIp6 {
echo "$1" | \
awk -F: 'BEGIN {OFS=""}{ FillCount=9-NF; for(i=1;i<=NF;i++){if(length($i) == 0){if(i==NF) {$i="0000";} else {for(j=1;j<=FillCount;j++){$i=($i "0000");}}} else {$i=substr(("0000" $i), length($i)+1);}}; print}' | \
awk '{ i=length; x=substr($0,i,1); for(i--;i!=0;i--)x=x "\." substr($0,i,1);}END{print x}'
}
mkdir -p $TempDir