IP Address Converter

2019-02-03 11:43发布

There is IP address: 66.102.13.19, and from this address as that received this address

http://1113984275

But how? And how I can make this with the help of bash. For example, this service can do it, but I do not understand the algorithm.

7条回答
beautiful°
2楼-- · 2019-02-03 12:36

IP address -> Number:

echo 66.102.13.19 | tr . '\n' | awk '{s = s*256 + $1} END{print s}'

Number -> IP address:

(export ip=1113984275; for i in {1..4}; do s='.'$((ip%256))$s && ((ip>>=8)); done; echo ${s:1})
查看更多
登录 后发表回答