Skip to content

Instantly share code, notes, and snippets.

@dap
Created July 18, 2009 22:07
Show Gist options
  • Save dap/149704 to your computer and use it in GitHub Desktop.
Save dap/149704 to your computer and use it in GitHub Desktop.
Store PHP code in a GIF
#!/usr/bin/perl
# write_gif.pl - Store PHP code inside of a GIF
# Darian Anthony Patrick <[email protected]>
#
# Demonstration of masquerading PHP code inside
# of a file identifiable as GIF format
use perl5i;
use IO::All;
#Create "GIF image data, version 89a" magic patterns
my $pat = "GIF89a";
# Output magic patterns followed by PHP code
io('/tmp/this_contains_php.gif')->print(
$pat,
'<?php echo "\nThis output is from PHP code stored inside of a \"GIF\".\n"; ?>'
);
say 'Completed "GIF" creation.';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment