re每日一题(20200529)(补)

4 篇文章 0 订阅

re每日一题(20200529)(补)

GKCTF2020

Chellys_identity

关键比较函数为sub_411721

int __usercall sub_41B3B0@<eax>(int a1@<xmm0>, int a2)
{
  _DWORD *i; // eax
  int v3; // eax
  int v4; // edx
  int v5; // ST04_4
  int v6; // ST00_4
  int v8; // [esp+D0h] [ebp-60h]
  int v9; // [esp+DCh] [ebp-54h]
  int v10; // [esp+F4h] [ebp-3Ch]
  _DWORD *v11; // [esp+100h] [ebp-30h]
  char v12; // [esp+118h] [ebp-18h]
  int v13; // [esp+12Ch] [ebp-4h]
  int savedregs; // [esp+130h] [ebp+0h]

  sub_4114BF(&unk_42D027);
  sub_4112F8(0x10u);
  sub_4116E0(a1, &v12, 128);
  v11 = sub_411456(a2, a1);
  v10 = sub_411375(a2, a1);
  while ( v11 != v10 )
  {
    v9 = 0;
    v8 = 0;
    for ( i = sub_411325(&v12, a1, 0); *i < *v11; i = sub_411325(&v12, a1, v8) )
      v9 += *sub_411325(&v12, a1, v8++);
    *v11 ^= v9;
    ++v11;
  }
  v3 = sub_4114D3();
  v5 = v4;
  sub_411537(&savedregs, &dword_41B4BC, v3);
  return sub_4114DD(&savedregs ^ v13, v5, 1, v6, a1);
}

while循环中,对2-127中的质数求和,若输出的ASCII码在第n-1项和第n项质数之中,则对前n-1项质数求和并于输入对异或。

函数sub_411852为比较函数,

  v13 = 0x1B6;
  v14 = 0x498;
  v15 = 0x441;
  v16 = 0x179;
  v17 = 0x179;
  v18 = 0x640;
  v19 = 0x39C;
  v20 = 0x179;
  v21 = 0x64A;
  v22 = 0x39C;
  v23 = 0x27D;
  v24 = 0x27F;
  v25 = 0x178;
  v26 = 0x236;
  v27 = 0x344;
  v28 = 0x33E;

写出脚本:

prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127]
cipher = [0x1b6,0x498,0x441,0x179,0x179,0x640,0x39c,0x179,0x64a,0x39c,0x27d,0x27f,0x178,0x236,0x344,0x33e]
prime_list = []

for i in range(len(a)):
    sum += a[i]
    prime_list.append(sum)

flag = ''

for x in cipher:
    for y in prime_list:
        if x^y < 256:
            tmp = chr(x^y)
            if tmp in key:
                flag += tmp
				break

其中第13位存在两个结果,取其中一个就好

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值