This started as an internal competition to develop polyglot's (i.e. code that runs in multiple languages) to print out the text "JASH" to be included in the SensePost 2018 artwork. This is a throw back to the old Just Another Perl Hacker competitions and is a great way for hackers to learn how to (ab)use languages. Feel free to submit your own idea with a pull request and we'll put the best up here with full credit to you.
@leonjza's entry was immortalised on the HUD of:
- The primary aim is to submit a polyglot that runs in the most languages with the fewest characters.
- Differences in major version numbers of languages can count as different languages.
- However, polyglots that use novel techniques, or run in esoteric languages are encouraged.
- As are beautiful polyglots i.e. elegant code or pictographic code.
By @leonjza
#<?
print("JASH");
Runs in 9: python2/3, R, Ruby, Perl, Lua, Julia, php7.1, hack/hhvm
By @singe
#/*<?#*/
#include <stdio.h> /*
print 'JASH';exit;#?>
__DATA__ = 1
""""
__END__
*/
int main() { printf("JASH"); } /*
"""#*/
Runs in 7: python2, zsh, Ruby, Perl, php7.1, C, C++ (ref: @wakhub)
By @ian
#!/bin/sh
$1 JASH 2>&1 | grep -o JASH | uniq
Ian hacked the rules to come up with his "fileless" polyglot. Pass in any executable that reflects the first parameter in either stdout or stderr.