-1

I'm trying to figure out what this code is doing. The first thing that I don't understand is the condition that tests if arg0's value is 0x2. I read that 0x2 in ASCII is STX (Start of text). Here's the code.

void main(int arg0, int arg1) {
    var_30 = arg1;
    var_14 = 0x7a;
    var_10 = 0x0;
    if (LODWORD(arg0) == 0x2) goto loc_4006f3;

loc_4006df:
    rax = puts("Wrong");
    rax = exit(0x1);
    return;

loc_4006f3:
    LODWORD(rax) = 0x0;
    var_8 = sign_extend_32(LODWORD(time(0x0)));
    var_14 = 0x22334455;
    goto loc_40075c;

loc_40075c:
    if (var_14 > 0x10000000) goto loc_400711;

loc_400765:
    if (LODWORD(atoi(*(var_30 + 0x8))) == var_14) {
        rax = puts("Congratulations");
    }
    else {
        rax = puts("Wrong");
    }
    return;

loc_400711:
    var_14 = LODWORD(SeriousHash(LODWORD(var_14)));
    LODWORD(rax) = 0x0;
    rax = sleep(0x15180);
    LODWORD(rax) = 0x0;
    if (var_8 + 0x15180 <= sign_extend_32(LODWORD(time(0x0)))) goto loc_40075c;

loc_400752:
    rax = exit(0x2);
    return;
}
0

It might be easier to read the actual disassembly rather than an attempted decompilation.

arg0 is really argc for the main function. So, it is comparing argc to 2 and exiting if it is not equal; i.e. there should be one argument passed to the executable (keep in mind there is always one implicit argument which is the executable name itself)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.