Created
September 29, 2011 06:38
-
-
Save yarwelp/1250117 to your computer and use it in GitHub Desktop.
A polyglot written in C and bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> /* | |
# Copyright (c) 2011, Erik Nordstroem <contact[at]erikano[dot]net> | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted, provided that the above | |
# copyright notice and this permission notice appear in all copies. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
EXIT_SUCCESS=0 # */ | |
#define F char *f | |
main () | |
{ | |
F="UMAD?"; | |
printf /* | egrep -v ".*" #*/("");/* | |
F=$( echo $F | egrep -o "[A-Za-z]*" | sed "s/ //g" ) | |
gcc $0 -o $F && ./$F || for i in 1 ; do echo lol; # */ | |
printf /*$F? | sed "s/\/\*\([A-Za-z]\)/\1/g" ; echo #*/ ("lol\n%s\n", f); | |
return 0; printf /* >/dev/null # */ (""); //\ | |
done; | |
} | |
//usr/bin/env false #\ | |
main # PS joke was self made after reading about Polyglot_(computing) on WP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download the program.
$ wget https://gist.github.com/gists/1250117/download -O polyglot.tgz
Extract the contents of the top level directory in the archive to the current directory.
$ tar xvf polyglot.tgz --strip 1
Open a
bash
shell (this step can be omitted ifbash
is your default shell).$ bash
Make the file executable.
$ chmod 755 polyglot.c
Run it.
$ ./polyglot.c