Catch up on stories from the past week (and beyond) at the Slashdot story archive


Forgot your password?
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 Internet speed test! ×
User Journal

Journal clone53421's Journal: HTML/80x86 polyglot

Don't even ask...

javascript:void(prompt("Source code",unescape("<!-- %u0152\xC8%u017D\xD8\xBAP!\x81\xF2%20%20\xB4)%u20AC\xF4 \xCD!\xB4L0\xC0\xCD! --><html><head></head><body><script type=\x22text/javascript\x22>document.write(String(\x22Hello world!$\x22).split(\x22$\x22)[0])\x3B</script></body></html>")));

Copy and paste into the address bar (IE or FF tested). Copy the prompted value and paste it into Notepad; that's the source code*. Save as polyglot.[com|htm] (ANSI encoding) and run. Note: the 80x86 implementation doesn't wait around, so run it from the command prompt or the window will disappear before you see the output.

*Because /. doesn't like the strange characters, I can't post the source code directly. However, once you've saved it as .htm in Notepad as described above – Unicode weirdness notwithstanding – opening it with a browser, viewing the source, copying and pasting into Notepad, and saving as .com should yield an identical copy of the program.

Note: The String() value is the actual data that the 80x86 code displays. As a result, you can easily change it to whatever pleases you. (Leave the $ at the end; it's the delimiter for the interrupt that prints the string. Consequentially, you can't print a string containing a $ character.) However, the beginning of the string is hard-coded, so you won't be able to change the HTML before it (for example to add a <title> value)... actually, try it and see what happens (don't make the HTML shorter though...).

This discussion has been archived. No new comments can be posted.

HTML/80x86 polyglot

Comments Filter:

Computers are useless. They can only give you answers. -- Pablo Picasso