shell转换IP
老大写的一个shell转换IP的 很好用 ,分享下!#!/bin/bash
hexip=""
hextoip() {
hex=$1
ip1=`printf "%d." 0x${hex:6:2}`
ip2=`printf "%d." 0x${hex:4:2}`
ip3=`printf "%d." 0x${hex:2:2}`
ip4=`printf "%d" 0x${hex:0:2}`
ip=$ip1$ip2$ip3$ip4
hexip=$ip
#return $ip
}
iptohex() {
IFS=.
for str in $1
do
printf "%02X" $str
done
}
iptoaddr ()
{
#exec < $1
#while read a
for a in `cat $1`
do
#sring=`curl -s"http://ip138.com/ips138.asp?ip=${a}&action=2" |grep '' |awk -F'[>
页:
[1]