跳到主要内容

Reversing - 021

备注

created by || 0xH3rshel

⏲️ Release Date // 2022-09-06

💀 Solvers // 16

🧩 Type // rev

反编译

int __fastcall main(int argc, const char **argv, const char **envp)
{
char s[264]; // [rsp+0h] [rbp-120h] BYREF
const char *v5; // [rsp+108h] [rbp-18h]
int i; // [rsp+114h] [rbp-Ch]
int v7; // [rsp+118h] [rbp-8h]
int v8; // [rsp+11Ch] [rbp-4h]

v5 = "$uperZecretP4zz";
v8 = 0;
v7 = 1;
printf("Enter passwd: ");
__isoc99_scanf("%s", s);
if ( strlen(s) == 6 )
{
if ( s[0] == 80 )
{
for ( i = 1; i <= 5; ++i )
{
v8 += s[i] - 48;
v7 *= s[i] - 48;
}
if ( v8 == 24 && v7 == 2048 )
{
if ( s[1] == 56 )
printf("Correct");
else
printf("really close");
}
else
{
printf("Close");
}
}
else
{
printf("Almost");
}
}
else
{
printf("Incorrect");
}
return 0;
}

Python脚本进行爆破

import string
import itertools as its


def check(ins):
v8 = 0
v7 = 1
for i in range(1, 6):
v8 += ord(ins[i]) - 48
v7 *= ord(ins[i]) - 48
if v8 == 24 and v7 == 2048:
return True


s = ""

s += chr(80)
s += chr(56)

dic = string.digits + string.ascii_letters
r = its.product(dic, repeat=4)

for i in r:
word = "".join(i)
tmp = s + word
if check(tmp):
print(tmp)

# P84444