------------------------------------------------------------------------------ Base10 numbers and IP numbers. ------------------------------------------------------------------------------ Author: Digital Overdrive E-mail : digiover@dsinet.org Homepage : http://www.dsinet.org ------------------------------------------------------------------------------ Thanks to : Dugo (for the scripts) network-tools.com (for the formula) Greetz : #dsinet, #h4h, #hit2000, #root66 en #selwerd ------------------------------------------------------------------------------ Copyright : You may only redistribute this file unchanged ------------------------------------------------------------------------------ Maybe you've seen them before, weird numbers which appears to be IP numbers. Well, they are called 'Base10' numbers. Often used by spammers who are hoping to remain anonymous by using such number. Well, I'm going to explain how you can convert them to regular IP numbers. What do you need : A Linux computer for the scripts. If you don't have a computer with Linux installed you have to calculate all the numbers yourself (or with a calculater ofcourse :) In my example I'll use this IP number : 209.237.160.164 (network-tools.com) Now you'll have to find a way to convert the IP number to a Base10 number. You can use this formula : $1 * 256^3 + $2 * 65536 + $3 * 256 + $4 $1 = the first part of a IP number, so : 209 $2 = the second part of a IP number, so : 237 $3 = the third part of a IP number, so : 160 $4 = the fourth part of a IP number, so : 164 The formula now is : 209 x (256)^3 + 237 x (256)^2 + 160 x (256)^1 + 164 The outcome is : 3522011300. You can use this commandline script for it : ~$ echo $1|awk -F. '{print $1" * 256^3 + "$2" * 65536 + "$3" * 256 + "$4}'|bc change the $1, $2, $3 and $4 in the different octets of the IP number Now let's ping our Base10 number : ~$ ping 3522011300 PING 3522011300 (209.237.160.164): 56 data bytes 64 bytes from 209.237.160.164: icmp_seq=0 ttl=115 time=116.8 ms --- 3522011300 ping statistics --- 2 packets transmitted, 1 packets received, 50% packet loss round-trip min/avg/max = 116.8/116.8/116.8 ms Here we see that we were right. 3522011300 indeed is 209.237.160.164 =) Are there other ways to do this ? Yes there is. You have to convert the IP number first into binary numbers, then remove the dots (".") and convert that back into decimal numbers. Example : 209.237.160.164 First we'll convert 209 first (you have to do every octets seperately) : 11010001 237 : 11101101 160 : 10100000 164 : 10100100 So: 209.237.160.164 = 11010001.11101101.10100000.10100100. You can do this very easly by using this script : #!/bin/sh for i in `echo $1|tr "." " "`; do printf "obase=2\n$i\n"|bc; done ~$ chmod +x script ~$ ./script Now remove the dots (".") : 11010001111011011010000010100100 and convert this back into decimal numbers : = 3522011300 You can do this with this script : #!/bin/sh printf "ibase=2\n$1\n" |bc ~$ chmod +x script2 ~$ ./script2 Digital Overdrive, 18/12/2000 EOF ------------------------------------------------------------------------------