ida64打开文件,搜索字符串
进入please input a lucky number伪代码
输入数字进入patch_me(v4);,输入数字为偶数进入get_flag()函数
unsigned __int64 get_flag()
{
unsigned int v0; // eax
char v1; // al
signed int i; // [rsp+4h] [rbp-3Ch]
signed int j; // [rsp+8h] [rbp-38h]
__int64 s; // [rsp+10h] [rbp-30h]
char v6; // [rsp+18h] [rbp-28h]
unsigned __int64 v7; // [rsp+38h] [rbp-8h]
v7 = __readfsqword(0x28u);
v0 = time(0LL);
srand(v0);
for ( i = 0; i <= 4; ++i )
{
switch ( rand() % 200 )
{
case 1:
puts("OK, it's flag:");
memset(&s, 0, 0x28uLL);
strcat((char *)&s, f1);
strcat((char *)&s, &f2);
printf("%s", &s);
break;
case 2:
printf("Solar not like you");
break;
case 3:
printf("Solar want a girlfriend");
break;
case 4:
v6 = 0;
s = 0x7F666F6067756369LL;
strcat(&f2, (const char *)&s);
break;
case 5:
for ( j = 0; j <= 7; ++j )
{
if ( j % 2 == 1 )
v1 = *(&f2 + j) - 2;
else
v1 = *(&f2 + j) - 1;
*(&f2 + j) = v1;
}
break;
default:
puts("emmm,you can't find flag 23333");
break;
}
}
return __readfsqword(0x28u) ^ v7;
}
flag为f1+f2,f1已知为GXY{do_not_,所以需要求f2
switch case需要的顺序为:case 4、case 5、case 1
s = 9180147350284624745LL; ,按H转为十六进制为0x7F666F6067756369LL;,使用时需要逆序
脚本:
flag='GXY{do_not_'
f2=[0x69,0x63,0x75,0x67,0x60,0x6f,0x66,0x7f]
v1=[]
for i in range(8):
if i%2==1:
v1.append(f2[i]+i-2)
else:
v1.append(f2[i]+i-1)
f2[i]=v1[i]-i
flag+=chr(f2[i])
print(flag)
GXY{do_not_hate_me}
标签:__,f2,Reverse,rbp,v1,flag,guy,rsp,luck
From: https://www.cnblogs.com/scarecr0w7/p/17377124.html