CrackMe® Practices for Newbies
PROJECT 6: caveman by Ghiribizzo

Re: snakebyte's thread
Saturday, 27-Feb-99 01:40:55



    #include
    #include
    #include
    #include
    #include

    main()
    {
    FILE *fp;
    size_t length;
    long offset;
    int len;
    char buf[80];
    char *x="$";
    int i;
    char a;

    if ( (fp = fopen("test.txt", "wb") )==NULL)
    {
    fprintf(stderr,"error opening file");
    exit(1);
    }

    puts("enter your name: ");
    gets(buf);



    length=strlen(buf);
    len=length+1;




    fwrite(&len,sizeof(int),1,fp);

    fseek(fp, 2, 0);

    fwrite(buf, sizeof(length),length, fp);

    fseek(fp,len+1,0);

    fwrite(x,sizeof(char),1,fp);




    if ( (fp = fopen("test.txt", "rb") )==NULL)
    {
    fprintf(stderr,"error opening file");
    exit(1);
    }




    fread(buf, sizeof(length),length, fp);
    printf("length of username is: %d , %d with terminating $",length,length+1);

    for(a=0;a {
    a=(buf[i]<<1)+(buf[i]>>31);

    printf("\n%c",a);

    }

    return 0;

    }


    can't seem to get the bitwise operation to do what I want...any C coders wanna give me a hint (Cronos...perhaps a slightly more specific hint than previously)...how can I pass values with inline?...sorta like this...

    asm {
    mov cx,length
    xor ax,ax
    mov si,[buf]

    lodsb
    add ah,al
    rol ax,1
    rol ax,1
    rol ax,1
    mov bx,ax
    mov ah,9
    int 21h
    loop

    }


    ps-let me know if this stuff is off-topic for the forum...I'd like to actually produce something useful here...have learned quite a bit from this project...thanks to all for their much appreciated assistance...

    snakebyte__


Message thread:

snakebyte's thread (snakebyte__@hotmail.com) (20-Feb-99 09:08:43)

Back to main board