Live data from Hacker News

A file that’s both an acceptable HTML page and a JPEG (2012)

lcamtuf.coredump.cx

1–10 of 72 posts

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#4

Explanation please?

Took a look at the page source, and it's full of binary garbage. It looks to me that it's a JPEG image that has been slightly tweaked to contain just enough HTML to get a (lenient) browser to display it.

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#6

Explanation please?

Took a look at the page source, and it's full of binary garbage. It looks to me that it's a JPEG image that has been slightly tweaked to contain just enough HTML to get a (lenient) browser to display it.

It's a JPEG with the HTML written in the comment field:

  # exiftool -b -comment body { visibility: hidden; } .n { visibility: visible; position: absolute; padding: 0 1ex 0 1ex; margin: 0; top: 0; left: 0; } h1 { margin-top: 0.4ex; margin-bottom: 0.8ex; }Hello, squirrel fans!This is an embedded landing page for an image. You can link to this URL and get the HTML document you are viewing right now (soon to include essential squirrel facts); or embed the exact same URL as an image on your own squirrel-themed page:

Click here!

No server-side hacks involved - the magic happens in your browser. Let's try embedding the current page as an image right now (INCEPTION!):

Pretty radical, eh? Send money to: lcamtuf@coredump.cx

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#7

Earlier quoted context omitted.

Took a look at the page source, and it's full of binary garbage. It looks to me that it's a JPEG image that has been slightly tweaked to contain just enough HTML to get a (lenient) browser to display it.

It's a JPEG with the HTML written in the comment field: # exiftool -b -comment body { visibility: hidden; } .n { visibility: visible; position: absolute; padding: 0 1ex 0 1ex; margin: 0; top: 0; left: 0; } h1 { margin-top: 0.4ex; margin-bottom: 0.8ex; } Hello, squirrel fans! This is an embedded landing page for an image. You can link to this URL and get the HTML document you are viewing right now (soon to include ess…

It also uses an (non terminated - AFAICT) HTML Comment to hide the rest of the JPEG data.

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#8
post #7

Earlier quoted context omitted.

It's a JPEG with the HTML written in the comment field: # exiftool -b -comment body { visibility: hidden; } .n { visibility: visible; position: absolute; padding: 0 1ex 0 1ex; margin: 0; top: 0; left: 0; } h1 { margin-top: 0.4ex; margin-bottom: 0.8ex; } Hello, squirrel fans! This is an embedded landing page for an image. You can link to this URL and get the HTML document you are viewing right now (soon to include ess…

It also uses an (non terminated - AFAICT) HTML Comment to hide the rest of the JPEG data.

Yes but it is not necessary because everything except absolutely positioned div is hidden anyway.

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#9
post #7

Earlier quoted context omitted.

It's a JPEG with the HTML written in the comment field: # exiftool -b -comment body { visibility: hidden; } .n { visibility: visible; position: absolute; padding: 0 1ex 0 1ex; margin: 0; top: 0; left: 0; } h1 { margin-top: 0.4ex; margin-bottom: 0.8ex; } Hello, squirrel fans! This is an embedded landing page for an image. You can link to this URL and get the HTML document you are viewing right now (soon to include ess…

It also uses an (non terminated - AFAICT) HTML Comment to hide the rest of the JPEG data.

> non terminated - AFAICT

Yes, it shows up as all green in Safari. And:

    $ { curl -s http://lcamtuf.coredump.cx/squirrel/?1 | grep -- '-->' ; } || echo "Not found"
    Not found

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#10

Earlier quoted context omitted.

Took a look at the page source, and it's full of binary garbage. It looks to me that it's a JPEG image that has been slightly tweaked to contain just enough HTML to get a (lenient) browser to display it.

It's a JPEG with the HTML written in the comment field: # exiftool -b -comment body { visibility: hidden; } .n { visibility: visible; position: absolute; padding: 0 1ex 0 1ex; margin: 0; top: 0; left: 0; } h1 { margin-top: 0.4ex; margin-bottom: 0.8ex; } Hello, squirrel fans! This is an embedded landing page for an image. You can link to this URL and get the HTML document you are viewing right now (soon to include ess…

I suspected it was something like that: the "meat" of the HTML and JPEG data being contained in each other's comment fields, since that's how many quines work. I don't quite know enough about the JPEG file format to be confident about it, though.
Post reply on HN