5th Annual Obfuscated Perl Contest 158
$Bob writes "The best and brightest of the Perl community are showing up to drive you insane. Test you strength in the 5th Annual Obfuscated Perl Contest!" Name your variables after the stooges! Write Spagetti! Its good!
Compiler solving Towers of Hanoi (Score:3)
Re:Obfuscated Perl? (Score:1)
Four words: (Score:4)
Re:Modification of read only value attempted (Score:1)
Too bad I bit.
--
A mind is a terrible thing to taste.
Re:unix comes with a perl obfuscator (Score:2)
mod this guy up!
Re:The classic obfuscated contest (hilarious) (Score:1)
Re:Attack of the Killer Llamas... (Score:1)
Re:Ah, yes, Perl... (Score:2)
Re:There's a contest!?! (Score:2)
[1]Word count, rather than Water Closet, of course.
Re:unix comes with a perl obfuscator (Score:1)
Re:Attack of the Killer Llamas... (Score:1)
Jeff Minter is easily the greatest computer game creator the world has ever seen.
Re:What's the point? (Score:1)
Obfuscation humour lost on Perl (Score:1)
Obfuscated C is funny because C is supposed to be all strict and anal. Obfuscated Perl isn't funny because Perl deliberately allows obfuscation for the sake of speedy coding.
It's like the Dem/Repub convetions: they are supposed to be flimsy and full of rhetoric, so why does the press write articles proclaiming how flimsy and rhetorical(?) the convetions are (will be.) Duh. As my grandma would say as she downed another Miller Lite: "No shit, Sherlock."
---
Slash (Score:1)
I win. :) (Score:1)
Ever notice... (Score:2)
That's because it wouldn't be very challenging... ;)
(This from a guy who loves C++)
Recursive contest... (Score:5)
Ah, yes, Perl... (Score:4)
(Well, actually, it was the regex that put him off... Any language where| ([^\s]+)\s?|\s/g) {
while ($line=<>) {
foreach ($line=~/\"((?:(?:[^\"\\]*)|(?:(?:\\\")*))*)\"\s?
print "$_\n";
}
} is legal is enough to scare anyone...)
(One faux karma point to anyone who can tell me what that does :))
Carnivore? (Score:2)
If so, how do they know it's written in Perl? I thought they were using VB....
Of course we all know that it's boud to be obfuscated enough to win......
Re:$5 on funny (Score:1)
dumbass.
Re:How many (Score:3)
I'm not the only one, fess up.
Here you go.
#!/usr/bin/perl
print "hello world\n";
exit;
Cool! (Score:1)
Perl is like masturbation... (Score:1)
Some obfuscation there... (Score:2)
At Paris.pm (in France), we have devoted a page to obfuscating the expression $A++ [pm.org].
Now 55 and counting.
BooKCheck the one with NO alphanumerical characters AT ALL!
Re:Obfuscated Perl? (Score:1)
Good programming habits are the same across most languages. I think there are just more bad perl programmers because they all came from doing web design.
Obfuscated Perl? (Score:3)
Re:My gripes with perl... (Score:1)
Heh!
Re:There's a contest!?! (Score:1)
tar -xvf perl-5.6.0.tar.gz
cd perl-5.6.0
make
make install
Re:Obfuscated C code from Perl (Score:1)
Re:Recursive contest... (Score:1)
How many (Score:5)
I'm not the only one, fess up.
A new business model for Open Source? (Score:2)
Re:What's the point? (Score:1)
[Begin Also Spach Zarathustra theme music] "My God, it's , it's
What's the point? (Score:1)
jeb.
Re:Obfuscated Perl? (Score:1)
(Warning: Variable name too meaningful!)
(Warning: No break detected! Logic may not be convoluted enough.)
(Warning: Local variable detected, recommend use of global instead)
Re:Downside (Score:2)
Re:Obfuscated Perl? (Score:1)
If you think education is expensive, try ignornace
Re:$5 on funny (Score:2)
Of course, why my cash is talking to me is a different story.
Downside (Score:1)
My vote's for "Insightful" (Score:1)
seriously, though, while i suppose there is such a thing as elegant perl, as neat perl, as organized, modular, and even object-oriented perl, at its core, perl is a way to get things done quickly and simply. and, at least to some of the people whose perl i've had the "pleasure" of wading through, quickly and simply also seems to imply sloppy and quirky. which i suppose doesn't sound too bad, but when another coder comes along and extends sloppy and quirky code with messy, odd-ball code...
maybe i should just go back to c++, where things are always so straightforward... (heh)
What I'm waiting for... (Score:5)
(disclaimer: I like and use perl for many things...but it still looks like a doctor's handwriting
Dear moderator... (Score:1)
Re:Obfuscated Perl? (Score:1)
Re:Ah, yes, Perl... (Score:1)
Day Job... (Score:3)
Micrsoft 2000 Obfuscated C# Challenge (Score:2)
Re:Rebuttal (Score:1)
Re:What's the point? (Score:1)
Re:Attack of the Killer Llamas... (Score:1)
Blindingly fast (on a DX66) and insanely addictive.
Re:Ah, yes, Perl... (Score:1)
Re:Attack of the Killer Llamas... (Score:1)
Re:Attack of the Killer Llamas... (Score:1)
I got it confused with Llamasoft.
Jeff Minter's still coding!
Re:Obfuscated Perl? (Score:1)
RSA in 2 lines most obfuscated (Score:1)
Re:Obfuscated Perl? (Score:1)
If anything, you should tell him to go shove his head up Tom Christiansen's ass...
--
Re:The classic obfuscated contest (hilarious) (Score:1)
The real beauty of the program, was that the code itself was its own documentation -- in braille!
You ran the program on itself to see the documentation in ascii.
Re:Modification of read only value attempted (Score:1)
--
A mind is a terrible thing to taste.
Re:What's the point? (Score:1)
Gah.
Re:i wonder... (Score:1)
Re:Obfuscated Perl? (Score:1)
Re:Slash (Score:1)
Re:Attack of the Killer Llamas... (Score:1)
Attempt to drag us back to some semblance of on-topicness: Llamas, Camels; is Larry Wall really just a pseudonym for Jeff Minter?
Re:What's the point? (Score:1)
You know what the fun thing is? Parentheses are about the only syntatic "noise" characters in Lisp that are in your face, so to speak. And if you're an experienced lisper you just ignore'em when reading the code.
Now compare that with the plethora of $, @, % and what not scattered around here and there in your favourite toy language. Yeah, I know, once you get the hang of it it's OK, but how long does it take and most important: is it really necessary?
--
Re:Obfuscated Perl? (Score:1)
Re:There's a contest!?! (Score:1)
A comment and a suggestion... (Score:1)
My $5 are on obfuscated, perl can be used to generate really neat and inteligable (sp?) code if you're not too lazy. Since I'm REALLY lazy, I'll submit some of my code.
As a suggestion, they should have a category for the smallest program to serve a webpage - that'll be intresting, coding an http 1.0 daemon and serving a page without using any modules. Just a thought...
Re:How many (Score:1)
Re:Obfuscated Perl? (Score:1)
"Producing satire is kind of hopeless because of the literacy rate of the American public."
Re:I'll enter my Katzifyer! (Score:2)
#!/usr/bin/perl -w
s{(tech|rights|Constitution)}
{(qw(corporation abuse geek system internet new era Hellmouth))[int(rand(8))] . " $1"}egi, print for <DATA>;
__DATA__
Plugin your text here
Re:Obfuscated C code from Perl (Score:2)
-----------
For the next Obuscated C code contest, I'm going to write the follwing perl script:
#!/usr/bin/perl
print "Hello World\n";
and then
perl -MO=CC,-O2,-oobfuscate.c obfuscate.pl
and submit the obfuscate.c
----------
So, here's the output {grin}:
*whine* but its ONLY 295 lines...
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
/* Workaround for mapstart: the only op which needs a different ppaddr */
#undef Perl_pp_mapstart
#define Perl_pp_mapstart Perl_pp_grepstart
#define XS_DynaLoader_boot_DynaLoader boot_DynaLoader
EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
static void xs_init (pTHX);
static void dl_init (pTHX);
static PerlInterpreter *my_perl;
#ifdef BROKEN_STATIC_REDECL
#define Static extern
#else
#define Static static
#endif
#ifdef BROKEN_UNION_INIT
/*
* Cribbed from cv.h with ANY (a union) replaced by void*.
* Some pre-Standard compilers can't cope with initialising unions. Ho hum.
*/
typedef struct {
char * xpv_pv;
STRLEN xpv_cur;
STRLEN xpv_len;
IV xof_off;
double xnv_nv;
MAGIC* xmg_magic;
HV* xmg_stash;
HV * xcv_stash;
OP * xcv_start;
OP * xcv_root;
void (*xcv_xsub) (CV*);
void * xcv_xsubany;
GV * xcv_gv;
char * xcv_file;
long xcv_depth;
AV * xcv_padlist;
CV * xcv_outside;
#ifdef USE_THREADS
perl_mutex *xcv_mutexp;
struct perl_thread *xcv_owner;
#endif
cv_flags_t xcv_flags;
} XPVCV_or_similar;
#define ANYINIT(i) i
#else
#define XPVCV_or_similar XPVCV
#define ANYINIT(i) {i}
#endif
#define Nullany ANYINIT(0)
#define UNUSED 0
#define sym_0 0
Static OP op_list[3];
Static LISTOP listop_list[2];
Static SV sv_list[12];
Static XPV xpv_list[7];
Static XPVAV xpvav_list[3];
Static XPVHV xpvhv_list[1];
static OP * pp_main (pTHX);
static OP op_list[3] = {
{ 0, 0, NULL, 0, 0, 65535, 0x0, 0x0 },
{ 0, 0, NULL, 0, 177, 65535, 0x0, 0x0 },
{ (OP*)&listop_list[1], 0, NULL, 0, 190, 65535, 0x1, 0x0 },
};
static LISTOP listop_list[2] = {
{ 0, 0, NULL, 0, 209, 65535, 0x5, 0x0, 0, 0, 1 },
{ 0, 0, NULL, 0, 178, 65535, 0xd, 0x40, &op_list[1], &op_list[2], 5 },
};
static SV sv_list[12] = {
{ &xpvav_list[0], 1, 0xa },
{ &xpvav_list[1], 1, 0xa },
{ 0, 1, 0x100 },
{ &xpv_list[0], 1, 0x4840004 },
{ &xpvhv_list[0], 2, 0x2000000b },
{ &xpvav_list[2], 2, 0xa },
{ &xpv_list[1], 1, 0x4040004 },
{ &xpv_list[2], 1, 0x4040004 },
{ &xpv_list[3], 1, 0x4040004 },
{ &xpv_list[4], 1, 0x4040004 },
{ &xpv_list[5], 1, 0x4040004 },
{ &xpv_list[6], 1, 0x4040004 },
};
static XPV xpv_list[7] = {
{ 0, 12, 13 },
{ 0, 37, 38 },
{ 0, 26, 27 },
{ 0, 47, 48 },
{ 0, 36, 37 },
{ 0, 30, 31 },
{ 0, 1, 2 },
};
static XPVAV xpvav_list[3] = {
{ 0, -1, -1, 0, 0.0, 0, Nullhv, 0, 0, 0x1 },
{ 0, -1, -1, 0, 0.0, 0, Nullhv, 0, 0, 0x1 },
{ 0, -1, -1, 0, 0.0, 0, Nullhv, 0, 0, 0x1 },
};
static XPVHV xpvhv_list[1] = {
{ 0, 0, 31, 0, 0.0, 0, Nullhv, -1, 0, 0, 0 },
};
static int perl_init()
{
dTHR;
dTARG;
djSP;
{
SV **svp;
AV *av = (AV*)&sv_list[1];
av_extend(av, 1);
svp = AvARRAY(av);
*svp++ = (SV*)&PL_sv_undef;
*svp++ = (SV*)&sv_list[2];
AvFILLp(av) = 1;
}
op_list[0].op_ppaddr = pp_main;
op_list[1].op_ppaddr = PL_ppaddr[OP_ENTER];
xpv_list[0].xpv_pv = savepvn("Hello world\n", 12);
listop_list[0].op_ppaddr = PL_ppaddr[OP_PRINT];
op_list[2].op_ppaddr = PL_ppaddr[OP_EXIT];
listop_list[1].op_ppaddr = PL_ppaddr[OP_LEAVE];
xpv_list[1].xpv_pv = savepvn("/usr/local/lib/perl5/5.6.0/i686-linux", 37);
xpv_list[2].xpv_pv = savepvn("/usr/local/lib/perl5/5.6.0", 26);
xpv_list[3].xpv_pv = savepvn("/usr/local/lib/perl5/site_perl/5.6.0/i68
xpv_list[4].xpv_pv = savepvn("/usr/local/lib/perl5/site_perl/5.6.0", 36);
xpv_list[5].xpv_pv = savepvn("/usr/local/lib/perl5/site_perl", 30);
xpv_list[6].xpv_pv = savepvn(".", 1);
{
SV **svp;
AV *av = (AV*)&sv_list[5];
av_extend(av, 5);
svp = AvARRAY(av);
*svp++ = (SV*)&sv_list[6];
*svp++ = (SV*)&sv_list[7];
*svp++ = (SV*)&sv_list[8];
*svp++ = (SV*)&sv_list[9];
*svp++ = (SV*)&sv_list[10];
*svp++ = (SV*)&sv_list[11];
AvFILLp(av) = 5;
}
PL_main_root = (OP*)&listop_list[1];
PL_main_start = &op_list[0];
PL_curpad = AvARRAY((AV*)&sv_list[1]);
PL_initav = (AV *) Nullsv;
GvHV(PL_incgv) = (HV*)&sv_list[4];
GvAV(PL_incgv) = (AV*)&sv_list[5];
av_store(CvPADLIST(PL_main_cv),0,SvREFCNT_inc((AV
av_store(CvPADLIST(PL_main_cv),1,SvREFCNT_inc((AV
PL_amagic_generation= 0;
return 0;
}
#include "cc_runtime.h"
static
CCPP(pp_main)
{
I32 oldsave;
SV **svp, *sv, *src, *dst, *left, *right;
MAGIC *mg;
djSP;
lab_80f5670:
PL_op = &op_list[1];
DOOP(PL_ppaddr[OP_ENTER]);
TAINT_NOT;
sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
lab_80f5848:
PUSHMARK(sp);
EXTEND(sp, 1);
PUSHs((SV*)&sv_list[3]);
PL_op = (OP*)&listop_list[0];
DOOP(PL_ppaddr[OP_PRINT]);
lab_82cddd8:
TAINT_NOT;
sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
PL_op = &op_list[2];
DOOP(PL_ppaddr[OP_EXIT]);
DOOP(PL_ppaddr[OP_LEAVE]);
FREETMPS;
PUTBACK;
return PL_op;
}
int
main(int argc, char **argv, char **env)
{
int exitstatus;
int i;
char **fakeargv;
PERL_SYS_INIT3(&argc,&argv,&env);
if (!PL_do_undump) {
my_perl = perl_alloc();
if (!my_perl)
exit(1);
perl_construct( my_perl );
PL_perl_destruct_level = 0;
}
#ifdef CSH
if (!PL_cshlen)
PL_cshlen = strlen(PL_cshname);
#endif
#ifdef ALLOW_PERL_OPTIONS
#define EXTRA_OPTIONS 2
#else
#define EXTRA_OPTIONS 3
#endif
New(666, fakeargv, argc + EXTRA_OPTIONS + 1, char *);
fakeargv[0] = argv[0];
fakeargv[1] = "-e";
fakeargv[2] = "";
#ifndef ALLOW_PERL_OPTIONS
fakeargv[3] = "--";
#endif
for (i = 1; i argc; i++)
fakeargv[i + EXTRA_OPTIONS] = argv[i];
fakeargv[argc + EXTRA_OPTIONS] = 0;
exitstatus = perl_parse(my_perl, xs_init, argc + EXTRA_OPTIONS,
fakeargv, NULL);
if (exitstatus)
exit( exitstatus );
sv_setpv(GvSV(gv_fetchpv("0", TRUE, SVt_PV)), argv[0]);
PL_main_cv = PL_compcv;
PL_compcv = 0;
exitstatus = perl_init();
if (exitstatus)
exit( exitstatus );
dl_init(aTHX);
exitstatus = perl_run( my_perl );
perl_destruct( my_perl );
perl_free( my_perl );
PERL_SYS_TERM();
exit( exitstatus );
}
/* yanked from perl.c */
static void
xs_init(pTHX)
{
char *file = __FILE__;
dTARG;
djSP;
#ifdef USE_DYNAMIC_LOADING
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
#endif
/* bootstrapping code*/
SAVETMPS;
targ=sv_newmortal();
#ifdef DYNALOADER_BOOTSTRAP
PUSHMARK(sp);
XPUSHp("DynaLoader",strlen("DynaLoader"));
PUTBACK;
boot_DynaLoader(aTHX_ NULL);
SPAGAIN;
#endif
FREETMPS;
/* end bootstrapping code */
}
static void
dl_init(pTHX)
{
char *file = __FILE__;
dTARG;
djSP;
/* Dynamicboot strapping code*/
SAVETMPS;
targ=sv_newmortal();
FREETMPS;
/* end Dynamic bootstrapping code */
}
Obfuscated C code from Perl (Score:2)
#!/usr/bin/perl
print "Hello World\n";
and then
perl -MO=CC,-O2,-oobfuscate.c obfuscate.pl
and submit the obfuscate.c
--
A mind is a terrible thing to taste.
Re:Come on Rob... (Score:3)
See Rob's Comments:
HERE [slashdot.org] for the Third Annual Obfuscated Perl Contest.
Re:Ah, yes, Perl... (Score:3)
Me: C-x 5 f ~/pr TAB w TAB RET (type type code hack) C-x w M-x compile RET RET
Them: AAAAAaaaaaaaaaugh! (head explodes)
--
Day job... (Score:2)
Re:The classic obfuscated contest (hilarious) (Score:5)
What made it obfuscated?
ObPerl: And people have suggested using this language as a first programming language? Eep.
Truly Obfuscated Perl. (Score:2)
#
$Conn = $Server->CreateObject("ADODB.Connection");
# Open a system DSN
#
$Conn->Open( "ADOSamples" );
# Execute an SQL Query
#
$RS = $Conn->Execute( "SELECT * FROM Orders" );
# Read a property to get the number of columns
# present in the Recordset returned from the
# query.
#
$count = $RS->Fields->{Count};
# Print out the names of each column
#
for ( $i = 0; $i $Response->Write( $RS->Fields($i)->Name );
$Response->Write("
");
};
# Loop the Recordset until there are no more records
#
while ( ! $RS->{EOF} ) {
for ( $i = 0; $i $Response->Write(" ");
$Response->Write($RS->Fields($i)->{Value});
$Response->Write("
");
};
# Move to the next record
#
$RS->MoveNext();
};
# Close the Recordset
#
$RS->Close();
$Conn->Close();
%>
Of course, a real entry would leave out the comments. Whaddya think? Would this qualify?
Perl IS Obfuscated C (Score:2)
...however, I need to see what silly rules the Obfuscated Perl contest has. If it doesn't have that many, you can just *bet* that I'll write a source filter that decrypts to Perl, runs itself, and calls the C preprocessor! (and maybe I'll have it generate and compile some C code while I'm at it... hmm.)
---
pb Reply or e-mail; don't vaguely moderate [ncsu.edu].
Hey! My nominee is.. (Score:3)
I know Microsoft technicians who don't sleep well knowing their webserver could be taken down by a global community of GNU extremists at any time of day or night. I know Apache admins that cringe and start filling out requisition orders for RAID arrays and Xeon processors at the slightest suggestion that someone submitted their site to Slashdot. Myself, I planned ahead with a script that reroutes everything to localhost at the first sign that my poor overworked server is having a breakdown. The chance of it being to linked to by Slashdot is one in a million, but I'm not taking any chances at being on the recieving end..
Translation. (Score:2)
while(){
$hash{$_}++;
}
while(($line,$times_seen) = each %hash){
print "$times_seen $line\n";
}
--
Re:Translation. (Score:2)
while(<>)
--
Modification of read only value attempted (Score:3)
$5 is invalid
--
A mind is a terrible thing to taste.
unix comes with a perl obfuscator (Score:5)
Re:Ah, yes, Perl... (Score:2)
Try doing that in one line with any other language and still make it as efficient as a Perl regex...
Re:Ever notice... (Score:2)
1) you forgot #include
2) what is foreach? Do you mean for_each?
3) You've got the unary function declaration all wrong.
Anyway, your program isn't really fair because you're including a great deal of code that isn't obfuscated. I could play by the same rules and write a C program one line long that includes a great deal of code and isn't obfuscated. If I only count that one line, then I win the challenge!
I'm a bit confused... (Score:2)
I guess I'll get modded down for suggesting that you get modded down.
-----
all my perl is obfuscated! (Score:2)
sig:
I'll enter my Katzifyer! (Score:2)
ReplaceRandomWords('corporation|abuse|geek|system
}
Think that would make it under the crappy web page category?
Re:Obfuscated Perl? (Score:2)
Re:unix comes with a perl obfuscator (Score:2)
Rebuttal (Score:2)
-- Dave
Re:Ah, yes, Perl... (Score:3)
That's easy. It makes my head hurt and generates a lovely whooshing sound.
I'll take that karma point now. =)
Come on Rob... (Score:5)
Why don't you enter slash??
I know deep down you've always wanted to. <grin>
There's a contest!?! (Score:2)
That reminds me... (Score:5)
That contest could create some real good compiler tests.
Like, how about a solution to Towers of Hanoi that let the compiler solve the problem by recursively including itself, eventually creating one huge 'printf()'-statement?
And it used a compiler switch for the number of pegs. At the time I tested it, gcc broke (or my computer ran out of memory, I'm not really sure which of the two...) at 15 pegs.
The solution to 14 pegs would create a over 1 MB executable containing just an MB of printf("really long string"); text.
If I find a link to it somewhere I'll let you know. The International Obfuscated C Code Contest (IOCCC) has it's homepage at www.ioccc.org [ioccc.org], but I can't seem to remember the name of the program.
Re:How many (Score:2)
Obfuscated code? Hmmm...
"Don't modify spaghetti code unless you can eat the consequences."
Or, rather:
(Shamelessly stolen from somebody's email sig)
---
Re:Ah, yes, Perl... (Score:2)
Sure, it looks unintelligable to someone who doesn't know it, but then so does french.
Re:unix comes with a perl obfuscator (Score:2)
Attack of the Killer Llamas... (Score:2)
The classic obfuscated contest (hilarious) (Score:5)
International Obfuscated C page [ioccc.org] and the amazing and confounding winners [ioccc.org].
My favorite is the tic tac toe game that is both the game and the code! [ioccc.org] (recompile to play next move...)
-- Moondog
Re:Obfuscated Basic (Score:2)
20 ? A$
--