10 ms·
This is a valid ipv4 address
- jloughry 13y agoThe submission is a little misleading; it's traditional on HN to link to an article discussing the principle, rather than simply a demonstration. However, the OP highlights an interesting point. There are other, analogous, unexpected behaviours like this one, such as numeric constants with leading zeros being interpreted as octal, that arise from the ubiquity of the C standard library. You see them in Java all over the place. Edited to Add: Don't think good penetration testers (and malware writers, alas) don't already know about this trick. But, as http://xkcd.com/1053/ http://xkcd.com/1053/ pointed out, it's always great to teach new people old things.
- kalleboo 13y ago> Don't think good penetration testers (and malware writers, alas) don't already know about this trick. This was also a popular trick among kids at my high school to work around the web content filter and get on social networks
- serf 13y agoyeah, some years back there was also some C code in an issue of 2600 (or maybe a bash script? I cant remember) that obfuscated URLs in this manner. The article that the script was attached to actually used school URL filtering as the example case use.
- sp332 13y agoYeah I've made a similar post here before and got a few upvotes. https://news.ycombinator.com/item?id=5763739 https://news.ycombinator.com/item?id=5763739 It's worth noting that the address isn't converted by the browser, but by the network stack.
- deleted 13y ago[deleted]
- nwh 13y agoThe decoded URL for this submission is http://184.172.10.74/ http://184.172.10.74/ — the server for Hacker News. Here's some other encodings you can use for the same address, they're all valid and recognised by most browsers and other software: http://3098282570/ http://3098282570/ http://7393249866/ http://7393249866/ http://0xb8.0xac.0x0a.0x4a/ http://0xb8.0xac.0x0a.0x4a/ http://0270.0254.0012.0112/ http://0270.0254.0012.0112/ The source for this comment is an XSS filtering bypass tool by RSnake — http://ha.ckers.org/xsscalc.html http://ha.ckers.org/xsscalc.html
- ColinDabritz 13y agoI recognize the other formats, but what format is "http://7393249866/" http://7393249866/"? It opens about:blank in chrome. How is it distinguished from the format above it?
- agwa 13y ago7393249866 mod 2^32 is 3098282570. I'm not convinced you can do that - although it works in Firefox, telnet and ping don't like it. Edit: I highly doubt that this is standard behavior. I suspect that implementations that permit this are storing the number in a 32 bit integer and not checking to see that it was truncated.
- nwh 13y agoping and other command line tools don't mind it for me on OSX, I don't know what the distinction between them would be though. $ ping 7393249866 PING 7393249866 (184.172.10.74): 56 data bytes 64 bytes from 184.172.10.74: icmp_seq=0 ttl=47 time=259.042 ms
- ColinDabritz 13y agoIt seems to work in Safari as well. I sort of understand the dword format, but why would this be useful, or a standard?
- tyilo 13y agohttp://7393249866/ http://7393249866/ doesn't seem to work in chrome as it doesn't believe it's a link. Entering it directly in the URL-bar doesn't work either. All of the others is shown as `184.172.10.74` on mouse-over.
- TallboyOne 13y agoI don't follow.
- sebcioz 13y agoHow can I encode any ip address?
- tzury 13y agoGoogle for "ip to long"...
- tyilo 13y agoThe normal way of displaying the ip address for HN is `184.172.10.74`. You then just have to take each 4 parts and multiply it with a power of 256: 184 * 256^3 + 172 * 256^2 + 10 * 256^1 + 74 * 256^0 == 3098282570
- madmo 13y agoIn python: struct.unpack(">I", struct.pack("BBBB", 184, 172, 10, 74))
- swatkat 13y agoDot to decimal/hex/octal format conversion, and vice versa. You can use online tools like these: http://www.kloth.net/services/iplocate.php http://www.kloth.net/services/iplocate.php
- rachelbythebay 13y agoThe last time this came up on HN, I decided to dig into ping and glibc's resolver stuff to find out exactly why this worked. http://rachelbythebay.com/w/2012/10/13/ping/ http://rachelbythebay.com/w/2012/10/13/ping/
- 300bps 13y agoThat article is focused on ping and glibc but the reason why this works is fundamental to IPv4 itself. All IPv4 address are 32 bit addresses. That's why each number of an IPv4 address that people are familiar with are called octets. They represent 8 bits of the 32 bit address. So if you have 127.0.0.1, then the first octet is 127, the second is 0 and so on. Any representation of this 32 bit number (including the most familiar A.B.C.D format) is a kind of short-hand for representing that 32 bit number. I tried finding a link to a particular site that was phenomenal for learning the entire TCP/IP stack but I haven't seen that site since at least 1998. But basically, if you want to spend time learning about IPv4 right before IPv6 becomes the dominant standard, then look into how hosts use the combination of IP address and subnet mask to determine if something is on the local network, how hosts use ARP to translate a 32 bit IP address into a MAC address and all the other low level protocols.
- rachelbythebay 13y agoNo, it works because the tool allows it by virtue of how it's implemented. Find a different ping or inet_aton implementation and it won't necessarily work.
- nzmsv 13y agoInteresting, I went searching and learned something new. You are right. Apparently the textual representation of IP addresses was not properly specified in any RFC, so this is in fact a quirk of the implementation. http://tools.ietf.org/html/draft-main-ipaddr-text-rep-02 http://tools.ietf.org/html/draft-main-ipaddr-text-rep-02
- 300bps 13y agoFind a different ping or inet_aton implementation and it won't necessarily work. At best, you seem to be picking nits. More likely though I think you just have a very surface level understanding of what is going on here. The bottom line is that, as I said already, an IPv4 address is a 32 bit number. It's also true that various tools that communicate with IP addresses utilize different methods to arrive at the underlying 32 bit number. But it's not right to say that "this only applies to systems using ping from iptools and glibc" as the article you linked says. Many of these "tricks" worked in all manner of operating systems and applications. I was discussing many of them in IRC using Windows 3.1 and Trumpet Winsock before 1994. Again, the bottom line is that an IPv4 IP address is a 32 bit number and there are dozens of ways that various applications allow you to arrive at that number. It's silly for an article or someone quoting it to attempt to say it only applies to one implementation.
- dreen 13y agoGuys check out this website at http://0x7f000001 http://0x7f000001 hahaha what an idiot made this, that page is shit!
- niktrix 13y agofrom where you got this ?
- dreen 13y agoseriously downvoters? how do you walk with that stick in?
- asveikau 13y agoMaybe the downvoters don't get the joke and they think you're insulting their website. :-)
- VLM 13y agoThe downvoters probably found a lot of pr0n and warez and (or?) unsavory content at that address. Imagine how painful it would be if you clicked on that and saw the legendary goatse, or tubgirl.
- jloughry 13y agoYou made a good point here: I recognised 127.0.0.1 in the value instantly, showing that you can sometimes read this representation by eye, e.g.: 0x0a000001 = 10.0.0.1 0xc0a80001 = 192.168.0.1
- simcop2387 13y agoThat's why i usually like to go with, http://0x7f123456/ http://0x7f123456/ same effect but less recognition.
- icoder 13y agoDidn't work for me
- nmeofthestate 13y agoSomeone better fix the title - should be "Hacker News".
- cturhan 13y agois it browser interprets this to IP adress?
- lelf 13y agohttps://en.wikipedia.org/wiki/IPv4#Address_representations https://en.wikipedia.org/wiki/IPv4#Address_representations
- jcburnham 13y agoIn Urbit, 3098282570 is ~lanben-dibnup. ~tomsyt-balsen/try=> `@p`3.098.282.570 ~lanben-dibnup
- seanalltogether 13y agoIt took me awhile to understand what was so significant about the submission. In chrome when I roll over the link i just see 184.172.10.74.
- sebcat 13y agoThis is why it's a good idea to use getaddrinfo and getnameinfo for IP address validation and normalization. While we're at it, use sockaddr's to represent addresses. in6_addr doesn't hold the IPv6 address scope/zone ID.
- BigEndian101 13y ago(FIRST_OCTET << 24) + (SECOND_OCTET << 16) + (THIRD_OCTET << 8) + FOURTH_OCTET
- andoriyu 13y agoSeriously? IPv4 in long form is top news?
- jpswade 13y agohttp://php.net/manual/en/function.ip2long.php http://php.net/manual/en/function.ip2long.php http://codepad.org/5ncM6IMS http://codepad.org/5ncM6IMS
- logn 13y agoAlso, this tool is useful, a bi-directional IP-long converter: http://www.elfqrin.com/LongIP.php http://www.elfqrin.com/LongIP.php
- swinglock 13y agoAn IPv4 address is a 32 bit number. The 4 octet representation is just meant for humans, it doesn't even look like that in an IPv4 packet header.
- atezaz 13y agonot valid
- scaramanga 13y agosage
- INIT_6 13y agoI first discovered these 10digit decimal formatted IPv4 address about a year ago when testing/analyzing android apps. Created a quick python scripts to convert back and forth. https://github.com/initiate6/IP_addresses https://github.com/initiate6/IP_addresses
- rmrfrmrf 13y agoThe fact that this is 'news' or a 'trick' to some people says a lot about the current state of HN. IP addresses have integer representations by design! Are the commenters here really so removed from actually doing work that they've never seen a database that stores IP addresses as integers? (Hint: ALL of the good ones do). That's to say nothing of the fact that there are clearly many people here who don't understand what binary is. At least it's good to know that the radical, ridiculous, Reddity mentality that's been plaguing HN as of late is coming from a clearly different group of people than those who used to comment. Looks like it's time to move on to greener pastures.
- jmduke 13y agoI haven't been on Hacker News long enough to speak definitively about the current state of HN (a bit less than two years, but I spent the first one lurking), but I would be more concerned about comments that complain about 'HN changing' (as someone who was on Reddit to hear complaints about all the Diggers... then all the 4chaners.. then all the high schoolers..) than content considered 'elementary' to smarter programmers than I. I notice that you haven't submitted any links. Is there any particular reason why? If you're not pleased with the content on the site, why don't you submit better content? (For what it's worth: this content is news for me. I never spent much time thinking about IP addresses before clicking the link and getting confused for a solid minute. I understand what binary is, though, I promise!)
- escapologybb 13y agoholds up hand This totally confused me for a minute until I started reading the comments, what on earth does that say about my intellect?! frets madly
- wilg 13y agoAlmost all the other comments in this thread are people spreading knowledge about technology. Sure, maybe you already knew it. Maybe things were better "back in the day". People having a genuine interest in stuff like this just really doesn't seem worth bemoaning. Isn't it better to be happy that someone is learning something you're familiar with rather than being upset that they didn't already know it?
- memracom 13y agoAn IPv4 address is a 32 bit string of bits. That 32 bit value can be represented in many different ways, but none of those ways are IPv4 addresses. The actual address is that string of 32 bits, and that is what is used in the TCP stack inside your OS or your router.
- Leask 13y agoUsing this python script to make the int-ip-address: #!/usr/bin/env python import socket import struct def ip2long(ip): packedIP = socket.inet_aton(ip) return struct.unpack("!L", packedIP)[0] print ip2long('192.241.224.102') # your website ip address # or download it on github: https://gist.github.com/Leask/7075483 https://gist.github.com/Leask/7075483
- d0mine 13y agoOr more straightforward in Python 3.3+: import ipaddress print(int(ipaddress.ip_address('192.241.224.102')))
- 16s 13y agoAn IPv4 address is a 32 bit integer. It's a number that can be represented in various ways. Been that way for decades now.
- X-Cubed 13y agoInterestingly, Chrome shows the dotted address format in the status bar when you hover over the link.
- chromano 13y agoHow come no one mentioned http://0xdeadbeef http://0xdeadbeef ?
- geoffpado 13y agoThe inverse of this actually bit me when I was porting my company's app from iOS to Windows 8. We have a custom URI scheme to open stories in our app that looks like foo://<int>. On iOS, we just take the bit after the scheme and use it directly. Windows, however, was giving it to us as a dotted-decimal string, so we had to convert back from that to the integer representation before using it. That was the day I learned that these different kinds of representations could be used and to not assume anything about URIs.
- lucb1e 13y agoI set a vhost for this years ago, instructing whomever was cool enough to use this URL to e-mail me. Nothing received yet :(