Полиморф на Perl

Discussion in 'PHP' started by x0x01, 22 Aug 2008.

  1. x0x01

    x0x01 Elder - Старейшина

    Joined:
    19 Oct 2006
    Messages:
    32
    Likes Received:
    6
    Reputations:
    1
    Полиморф на Perl (пример)

    На самом деле не полный полиморф, но пример, безусловно, интересен.
    Code:
    print "Hello, I'm polymorphic\n";
    
    open(Myself, $0);
    @Body = <Myself>;
    close(Myself);
    
    $Body = join("",@Body);
    $cryptKey = int(rand(255));
    
    for($i=0;$i<length($Body);$i++)
    {@Crypt[$i]=(ord(substr($Body,$i,1))) * ($cryptKey);}
    
    for($i=0;$i<6;$i++)
    {$Var[$i]=chr(int(rand(25)+65)).int(rand(65535));}
    
    $glue = chr(int(rand(25)+65));
    $Crypt = join($glue,@Crypt);
    
    open(File, ">$0");
    print File "\$$Var[0]=\"$Crypt\";";
    print File "\@$Var[1]=split(\"$glue\",\$$Var[0]);";
    print File "for(\$$Var[2]=0;\$$Var[2]<(\@$Var[1]);\$$Var[2]++)
    {\$$Var[3].=chr(\@$Var[1] [\$$Var[2]]/$cryptKey);}";
    print File "open($Var[4],\">\$0\"); print $Var[4] \$$Var[3];
    close($Var[4]); \@$Var[5]=(\"perl\",\"$0\"); system(\@$Var[5]);";
    close(File);
    Найдено тут
     
    #1 x0x01, 22 Aug 2008
    Last edited: 22 Aug 2008