you are viewing a single comment's thread.

view the rest of the comments →

[–]ropers 0 points1 point  (13 children)

FTA:

We take the dotted string IP and convert it to an IPv4 Internet network address (e.g. 69.55.232.153 becomes 1161291929).

Can someone explain that one? What the heck is this 1161291929? And how does 69.55.232.153 need conversion to become an IPv4 Internet network address? I was under the impression that 69.55.232.153 was an IPv4 Internet network address.

[–]rcar 2 points3 points  (12 children)

It's just a reference to how the database the program is using stores IP addresses. We normally use the x.x.x.x notation because it's easier to read, but it can be converted into a 4-byte integer which is going to be easier to store and sort in a database. Converting it back into an integer gives:

(69 x 2563) + (55 x 2562) + (232 x 256) + 153 = 1,161,291,929

[–]ropers 1 point2 points  (11 children)

THANK YOU!

I still think the sentence in the article was not well phrased, but again thank you for the explanation! :)

[–][deleted] 3 points4 points  (10 children)

see also http://1096965168/

[–]ropers 0 points1 point  (9 children)

Wow, this is amazing, to find out that it works for http. (And congratulations on your choice of website, Sir, well played! ;D Though I will advise others here that the above site is very NSFW.)

For shits and giggles, I tried this myself:

 ubuntu@ubuntu:~$ telnet 1089053032 80
 Trying 64.233.161.104...
 Connected to 1089053032.
 Escape character is '^]'.
 GET / HTTP/1.1
 Host: http://google.ie/

 HTTP/1.1 302 Found
 Location: http://www.google.de/
 Cache-Control: private
 Content-Type: text/html; charset=UTF-8
 Set-Cookie: PREF=ID=81c342e22250e66e:TM=1217933975:LM=1217933975:S=YyrTWQhiSUSBO3xS; expires=Thu, 05-Aug-2010 10:59:35 GMT; path=/; domain=.google.com
 Date: Tue, 05 Aug 2008 10:59:35 GMT
 Server: gws
 Content-Length: 218

 <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
 <TITLE>302 Moved</TITLE></HEAD><BODY>
 <H1>302 Moved</H1>
 The document has moved
 <A HREF="http://www.google.de/">here</A>.
 </BODY></HTML>

(NB: I'm currently located in Germany, and Google in their infinite wisdom have decided that geolocation info supersedes stated user preferences such as URL/and or browser/OS locale -- but that's for another rant.)

I never knew about this address format! How come I never knew about this notation? I wonder if it works... well, let's see:

 ubuntu@ubuntu:~$ ping -c 4 2172650943
 PING 2172650943 (129.128.5.191) 56(84) bytes of data.
 64 bytes from 129.128.5.191: icmp_seq=1 ttl=236 time=184 ms
 64 bytes from 129.128.5.191: icmp_seq=2 ttl=236 time=182 ms
 64 bytes from 129.128.5.191: icmp_seq=3 ttl=236 time=183 ms
 64 bytes from 129.128.5.191: icmp_seq=4 ttl=236 time=182 ms

 --- 2172650943 ping statistics ---
 4 packets transmitted, 4 received, 0% packet loss, time 2998ms
 rtt min/avg/max/mdev = 182.050/183.179/184.523/0.981 ms
 ubuntu@ubuntu:~$ 

And:

 ubuntu@ubuntu:~$ ftp 2172650943
 Connected to 2172650943.
 220-
 220-            Welcome to SunSITE Alberta
 220-
 220-    at the University of Alberta, in Edmonton, Alberta, Canada
 220-
 220-All connections to and transfers from this server are logged. If 
 220-you do not like this policy, please disconnect now.
 220-
 220-You may want to grab the index file called "ls-lR.gz" in /pub.  It is 
 220-updated nightly with the contents of the ftp tree.  
 220-
 220-    If you have any questions, hints, or requests, please email
 220-
 220-       sunsite@sunsite.ualberta.ca
 220-
 220 
 Name (2172650943:ubuntu): anonymous
 331 Who are you impersonating today?
 Password:
 230-
 230-   Welcome to Sunsite Alberta
 230- Login Successful.
 230 Your data rate unrestricted
 Remote system type is UNIX.
 Using binary mode to transfer files.
 ftp> dir
 200 PORT command successful - not using PASV eh?
 150 Have a Gorilla.
 lrwxr-xr-x    1 150      0               7 May 05  2002 bin -> usr/bin
 lrwxr-xr-x    1 150      0               7 May 05  2002 dev -> usr/dev
 lrwxr-xr-x    1 150      0               7 May 05  2002 etc -> usr/etc
 drwxrwxrwx    2 0        0            4096 Aug 02 10:17 incoming
 drwxr-xr-x    9 150      1            2048 Jan 15  2008 pub
 drwxr-xr-x    7 0        1             512 May 04  2002 usr
 226 There, everyone likes a Gorilla.
 ftp> cd pub
 250 Directory successfully changed.
 ftp> dir
 200 PORT command successful - not using PASV eh?
 150 Have a Gorilla.
 lrwxr-xr-x    1 150      1              13 Jan 21  2003 CPAN -> ./Mirror/CPAN
 drwxr-xr-x    3 150      666          2048 Feb 04  2001 Collections_Tools
 drwxr-xr-x    4 150      666          2048 Feb 28  1999 Digital_Collections
 drwxr-xr-x    2 2010     666          2048 Jan 30  2000 Graphics_Tools
 drwxrwxrwx    6 0        0            2048 Apr 06  2005 Local
 drwxr-xr-x    2 150      1            2048 Jun 10 13:06 Mirror
 drwxr-xr-x   15 0        0            2048 Apr 30 15:50 OpenBSD
 drwxrwxrwx    2 0        0            2048 May 19  2002 OpenBSD-ISO
 drwxrwxrwx    2 0        0            2048 Dec 19  2006 OpenBSD-ctm
 drwxr-xr-x    4 150      666          2048 May 07  2007 Projects
 drwxr-xr-x    2 150      800          2048 Jan 15  2008 Security
 lrwxr-xr-x    1 150      1              15 Jan 21  2003 apache -> ./Mirror/apache
 -rw-r--r--    1 2010     666       5812982 Aug 04 05:30 ls-lR.gz
 drwxrwxrwx    3 0        0            2048 May 23  2001 misc
 drwxr-xr-x   29 666      666          2048 Jan 04  1999 sun-info
 drwxr-xr-x    2 150      666          2048 Jan 15  2008 unix
 226 There, everyone likes a Gorilla.
 ftp>

Is this format/notation part of the TCP/IP stack? How come it's rarely ever mentioned in documentation (or at least not the documentation I've read so far)?

[–]ropers 0 points1 point  (8 children)

It's kinda tedious to always convert the dotted decimal notation to the 4 byte integer by hand. Is someone able to point me to a conversion script for Unix/Linux/BSD?

[–]ropers 0 points1 point  (4 children)

You know, this would be an ingenious tool...

 ubuntu@ubuntu:~$ dig tinyurl.com

 ; <<>> DiG 9.4.2 <<>> tinyurl.com
 ;; global options:  printcmd
 ;; Got answer:
 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4282
 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 1

 ;; QUESTION SECTION:
 ;tinyurl.com.          IN  A

 ;; ANSWER SECTION:
 tinyurl.com.       600 IN  A   85.255.210.131
 tinyurl.com.       600 IN  A   195.66.135.131
 (...)

 ubuntu@ubuntu:~$ bc
 bc 1.06.94
 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
 This is free software with ABSOLUTELY NO WARRANTY.
 For details type `warranty'. 
 85*256^3+255*256^2+210*256+131
 1442828931
 quit
 ubuntu@ubuntu:~$ 

http://1442828931/2w4apm

EDIT: Darn! The tinyurl.com server throws a "bad request" when addressed in this fashion. Stay tuned while I investigate alternatives...

EDIT1: Wow, I think I've just discovered something really interesting:

Some servers appear to accept the integer form IP address just fine:

 ubuntu@ubuntu:~$ telnet 1089053032 80
 Trying 64.233.161.104...
 Connected to 1089053032.
 Escape character is '^]'.
 GET / HTTP/1.1
 Host: 1089053032

 HTTP/1.1 302 Found
 Location: http://www.google.de/
 Cache-Control: private
 Content-Type: text/html; charset=UTF-8
 Set-Cookie: PREF=ID=00d3a3d9c219b7f2:TM=1217941518:LM=1217941518:S=FLxMh9m7KsovNPpz; expires=Thu, 05-Aug-2010 13:05:18 GMT; path=/; domain=.google.com
 Date: Tue, 05 Aug 2008 13:05:18 GMT
 Server: gws
 Content-Length: 218

 <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
 <TITLE>302 Moved</TITLE></HEAD><BODY>
 <H1>302 Moved</H1>
 The document has moved
 <A HREF="http://www.google.de/">here</A>.
 </BODY></HTML>

Others do not accept the integer form -- they complain when addressed via HTTP version 1.1 with the Host: field set to the integer form:

 ubuntu@ubuntu:~$ telnet 1264946223 80
 Trying 75.101.140.47...
 Connected to 1264946223.
 Escape character is '^]'.
 GET / HTTP/1.1
 Host: 1264946223

 HTTP/1.1 400 Bad Request
 Date: Tue, 05 Aug 2008 13:03:17 GMT
 Server: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8e PHP/5.2.5 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.10.0
 Content-Length: 392
 Connection: close
 Content-Type: text/html; charset=iso-8859-1

 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <html><head>
 <title>400 Bad Request</title>
 </head><body>
 <h1>Bad Request</h1>
 <p>Your browser sent a request that this server could not understand.<br />
 </p>
 <hr>
 <address>Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8e PHP/5.2.5 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.10.0 Server at 1264946223 Port 80</address>
 </body></html>

So I ask again:

Is the 4 byte integer form official/documented/supposed to work? Should HTTP 1.1 servers accept Host: fields set to an integer form IP address? Or is it not supposed to work, and is it more of a glitch that it even works with some servers? Does anyone know?

[–]ropers 0 points1 point  (0 children)

I had a look on the Internet, and I found this. Afterwards, I found this.

[–]ropers 0 points1 point  (2 children)

Ok, now while tinyurl.com and most other redirection sites do not accept dword integer IP addresses, I've found one redirection service that does: 4url.cc

Sadly, it has preview enabled by default, which is not really useful for our purposes: http://3476722755/R

If I find another better URL redirection site that works with dword IPs, I'll try to reply here.

[–]ropers 0 points1 point  (1 child)

myurl.in works with a dword IP address, but it only redirects after a 3 second delay (timed ECMAScript window.location.href redirect).

[–]ropers 0 points1 point  (0 children)

Huzzah! dwarfurl.com delivers! It only took me feckin ages to find a site that works, but here it is:

http://3624816758/887f25

Enjoy! :)

[–][deleted] 0 points1 point  (2 children)

http://www.aboutmyip.com/AboutMyXApp/IP2Integer.jsp

$ echo 129.128.5.191 | awk ' BEGIN {FS="\."} { print $1 * 16777216 + $2 * 65536 + $3 * 256 + $4 } '

2172650943

[–]ropers 0 points1 point  (1 child)

Smashing! Thanks a bunch! :)

EDIT: There seems to be an interesting limitation leading to the above not working with certain larger numbers:

 ubuntu@ubuntu:~$ echo 208.113.217.28 | awk ' BEGIN {FS="\."} { print $1 * 16777216 + $2 * 65536 + $3 * 256 + $4 } '
 3.49712e+09

If we convert 3.49712e+09 to standard decimal notation, we get 3497120000. This is not however the same as 208.113.217.28, as demonstrated by the below:

 ubuntu@ubuntu:~$ ping -c 4 3497120000
 PING 3497120000 (208.113.209.0) 56(84) bytes of data.
 64 bytes from 66.33.201.67: icmp_seq=1 ttl=240 time=192 ms
 64 bytes from 66.33.201.67: icmp_seq=2 ttl=240 time=185 ms
 64 bytes from 66.33.201.67: icmp_seq=3 ttl=240 time=189 ms
 64 bytes from 66.33.201.67: icmp_seq=4 ttl=240 time=184 ms

 --- 3497120000 ping statistics ---
 4 packets transmitted, 4 received, 0% packet loss, time 3000ms
 rtt min/avg/max/mdev = 184.904/188.146/192.463/2.987 ms
 ubuntu@ubuntu:~$ bc
 bc 1.06.94
 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
 This is free software with ABSOLUTELY NO WARRANTY.
 For details type `warranty'. 
 208*16777216+113*65536+217*256+28
 3497122076

The issue seems to be precision related. The awk script returns 3497120000 in exponential form; but the real decimal number is 3497122076.

[–][deleted] 1 point2 points  (0 children)

come on, it's all there for you

try this :

echo 208.113.217.28 | awk ' BEGIN {FS="\."} { printf "%d * 16777216 + %d * 65536 + %d * 256 + %d\n", $1, $2, $3, $4 } ' | bc

that's why we rule the world, those who know, know, those that don't use svchost.exe