3

http://www.cise.ufl.edu/~manuel/obfuscate/obfuscate.html (http://www.cise.ufl.edu/~manuel/obfuscate/savastio) の Web サイトでこのコードを見ましたが、このコード非常に非常にクレイジーです。それが起こっているときに何が起こっているのか理解できませんでした。私を助けてください。各行が実行されるときに何が起こっているか教えてください。たとえばprintf、" " と呼ばれるステートメントがない場合、関数はそこにありEnter the numberます。しかし、まだ実行中に " Enter the number" を尋ねています。どこから来ているのか。そして、なぜこのようなコードが書かれているのか。" "のように見えますn!(階乗を意味しますが)。私を助けてください。

#include <stdio.h>

#define l11l 0xFFFF
#define ll1 for
#define ll111 if
#define l1l1 unsigned
#define l111 struct
#define lll11 short
#define ll11l long
#define ll1ll putchar
#define l1l1l(l) l=malloc(sizeof(l111 llll1));l->lll1l=1-1;l->ll1l1=1-1;
#define l1ll1 *lllll++=l1ll%10000;l1ll/=10000;
#define l1lll ll111(!l1->lll1l){l1l1l(l1->lll1l);l1->lll1l->ll1l1=l1;}\
lllll=(l1=l1->lll1l)->lll;ll=1-1;
#define llll 1000




                                                     l111 llll1 {
                                                     l111 llll1 *
      lll1l,*ll1l1        ;l1l1                      lll11 lll [
      llll];};main      (){l111 llll1                *ll11,*l1l,*
      l1, *ll1l, *    malloc ( ) ; l1l1              ll11l l1ll ;
      ll11l l11,ll  ,l;l1l1 lll11 *lll1,*            lllll; ll1(l
      =1-1 ;l< 14; ll1ll("\t\"8)>l\"9!.)>vl"         [l]^'L'),++l
      );scanf("%d",&l);l1l1l(l1l) l1l1l(ll11         ) (l1=l1l)->
      lll[l1l->lll[1-1]     =1]=l11l;ll1(l11         =1+1;l11<=l;
      ++l11){l1=ll11;         lll1 = (ll1l=(         ll11=l1l))->
      lll; lllll =(            l1l=l1)->lll;         ll=(l1ll=1-1
      );ll1(;ll1l->             lll1l||l11l!=        *lll1;){l1ll
      +=l11**lll1++             ;l1ll1 ll111         (++ll>llll){
      l1lll lll1=(              ll1l =ll1l->         lll1l)->lll;
      }}ll1(;l1ll;              ){l1ll1 ll111        (++ll>=llll)
      { l1lll} } *              lllll=l11l;}
      ll1(l=(ll=1-              1);(l<llll)&&
      (l1->lll[ l]              !=l11l);++l);        ll1 (;l1;l1=
      l1->ll1l1,l=              llll){ll1(--l        ;l>=1-1;--l,
      ++ll)printf(              (ll)?((ll%19)        ?"%04d":(ll=
      19,"\n%04d")              ):"%4d",l1->         lll[l] ) ; }
                                                     ll1ll(10); }
4

2 に答える 2

10

手始めに、コードを適切にインデントして、#defines. インデントはGNUindentgcc -E行うことができ、前処理を行います。コードが入っていると仮定しますfactorial.c(これにはコマンドラインを使用する必要があります):

> gcc -E factorial.c | indent > clean_factorial.c

stdio.h注意すべきことは、前処理ステップがすべてをにダンプすることclean_factorial.cです。しかし、それは無関係な情報なので、#include<stdio.h>実行する前にコメント アウト/削除する必要がありgcc -Eます。これは基本的に次のようになります。

struct llll1
{
  struct llll1 *lll1l, *ll1l1;
  unsigned short lll[1000];
};
main ()
{
  struct llll1 *ll11, *l1l, *l1, *ll1l, *malloc ();
  unsigned long l1ll;
  long l11, ll, l;
  unsigned short *lll1, *lllll;
  for (l = 1 - 1; l < 14; putchar ("\t\"8)>l\"9!.)>vl"[l] ^ 'L'), ++l);
  scanf ("%d", &l);
  l1l = malloc (sizeof (struct llll1));
  l1l->lll1l = 1 - 1;
  l1l->ll1l1 = 1 - 1;
  ll11 = malloc (sizeof (struct llll1));
  ll11->lll1l = 1 - 1;
  ll11->ll1l1 = 1 - 1;
  (l1 = l1l)->lll[l1l->lll[1 - 1] = 1] = 0xFFFF;
  for (l11 = 1 + 1; l11 <= l; ++l11)
    {
      l1 = ll11;
      lll1 = (ll1l = (ll11 = l1l))->lll;
      lllll = (l1l = l1)->lll;
      ll = (l1ll = 1 - 1);
      for (; ll1l->lll1l || 0xFFFF != *lll1;)
        {
          l1ll += l11 ** lll1++;
          *lllll++ = l1ll % 10000;
          l1ll /= 10000;
          if (++ll > 1000)
            {
              if (!l1->lll1l)
                {
                  l1->lll1l = malloc (sizeof (struct llll1));
                  l1->lll1l->lll1l = 1 - 1;
                  l1->lll1l->ll1l1 = 1 - 1;;
                  l1->lll1l->ll1l1 = l1;
                }
              lllll = (l1 = l1->lll1l)->lll;
              ll = 1 - 1;
              lll1 = (ll1l = ll1l->lll1l)->lll;
            }
        }
      for (; l1ll;)
        {
          *lllll++ = l1ll % 10000;
          l1ll /= 10000;
          if (++ll >= 1000)
            {
              if (!l1->lll1l)
                {
                  l1->lll1l = malloc (sizeof (struct llll1));
                  l1->lll1l->lll1l = 1 - 1;
                  l1->lll1l->ll1l1 = 1 - 1;;
                  l1->lll1l->ll1l1 = l1;
                }
              lllll = (l1 = l1->lll1l)->lll;
              ll = 1 - 1;
            }
        }
      *lllll = 0xFFFF;
    }
  for (l = (ll = 1 - 1); (l < 1000) && (l1->lll[l] != 0xFFFF); ++l);
  for (; l1; l1 = l1->ll1l1, l = 1000)
    {
      for (--l; l >= 1 - 1; --l, ++ll)
        printf ((ll) ? ((ll % 19) ? "%04d" : (ll =
                                              19, "\n%04d")) : "%4d",
                l1->lll[l]);
    }
  putchar (10);
}

これは少し読みやすく、変数の名前を変更するなどの操作を実行して、変数が何をするのかまだわからなくても簡単に区別できるようにすることができます。たとえば、これは構造体の名前を に変更し、そのstructure中のポインターを呼び出します (エディターの検索置換ツールでもこれを行うことができます):leftright

> sed -i 's/llll1/structure/g; s/lll1l/left/g; s/ll1l1/right/g;' clean_factorial.c

(順序に注意する必要があります。そうしないと、たとえばの置換lllが と競合する可能性があります)。lllll

他にも簡単にできることがいくつかあります。

  • 1 - 1多く発生します:それを置き換えます0(そして、それを代わりに1 + 1置き換えることを除いて)。20
  • with の行は"\t\"8)>l\"9!.)>vl"[l] ^ 'L'、xor 演算を行った後に各文字を出力する文字列に沿って表示されます(理由を理解してください!をカンマ ステートメントではなく、for ループの本体に'L'配置すると役立つ場合があります)。putchar
  • putchar(10)新しい行を印刷するだけです。
  • コンマ演算子について知っておいてください。

それ以外は、大変な作業です。デバッガーなどのツールを使用して、実行の流れを追跡し、どこで何が起こっているかを調べることができます。

于 2012-04-11T05:36:00.373 に答える
2

これは、ラップを解除しようとした私の試みであり、プロンプトロジックに少し行き詰まったので、longCゼロに初期化し、手動で番号のリクエストを出力しました:

#include <stdio.h>

struct StructName
{
    struct StructName *structA, *structB;

    unsigned short unsignedShortArrayA[1000];
};

main ()
{
    struct StructName *structC, *structD, *structE, *structF, *malloc();

    unsigned long unsignedLongA;

    long longA, longB, longC = 0;

    unsigned short *unsignedShortA, *unsignedShortB;

    //for(longC=0; longC< 14; putchar("\t\"8)>longC\"9!.)>vl" [longC]^'longC'),++longC )
    //;

    printf("%s", "Enter a number: " );

    scanf("%d", &longC);

    structD = malloc(sizeof(struct StructName));
    structD->structA=0;
    structD->structB=0;

    structC=malloc(sizeof(struct StructName));
    structC->structA=0;
    structC->structB=0;

    (structE=structD)->unsignedShortArrayA[structD->unsignedShortArrayA[0] =1] = 0xFFFF;

    for( longA=1+1;longA<=longC;++longA)
    {
        structE=structC;
        unsignedShortA = (structF=( structC=structD))->unsignedShortArrayA;
        unsignedShortB =( structD=structE)->unsignedShortArrayA;
        longB=(unsignedLongA=0);

        for( ; structF->structA || 0xFFFF != *unsignedShortA; )
        {
            unsignedLongA+=longA**unsignedShortA++;
            *unsignedShortB++=unsignedLongA%10000;
            unsignedLongA/=10000;

            if( ++longB>1000 )
            {
                if( !structE->structA )
                {
                    structE->structA=malloc(sizeof(struct StructName));
                    structE->structA->structA=0;
                    structE->structA->structB=0;

                    structE->structA->structB=structE;
                }

                unsignedShortB=(structE=structE->structA)->unsignedShortArrayA;
                longB=0;
                unsignedShortA=( structF =structF-> structA)->unsignedShortArrayA;
            }
        }

        for( ; unsignedLongA; )
        {
            *unsignedShortB++=unsignedLongA%10000;
            unsignedLongA/=10000;

            if( ++longB>=1000 )
            {
                if( !structE->structA )
                {
                    structE->structA=malloc(sizeof(struct StructName));
                    structE->structA->structA=0;
                    structE->structA->structB=0;

                    structE->structA->structB=structE;
                }

                unsignedShortB=(structE=structE->structA)->unsignedShortArrayA;
                longB=0;
            }
        }

        * unsignedShortB=0xFFFF;
    }

    for( longC=(longB=1- 1); (longC<1000) && (structE->unsignedShortArrayA[ longC] !=0xFFFF); ++longC )
    {
        ;
    }

    for( ; structE; structE=structE->structB, longC=1000 )
    {
        for( --longC; longC>=0; --longC, ++longB)
        {
            printf( (longB)?((longB%19) ? "%04d" : (longB=19,"\n%04d") ):"%4d",structE-> unsignedShortArrayA[longC] );
        }
    }

    putchar(10);
}

編集:少しクリーンアップ。

于 2012-04-11T05:42:21.533 に答える