RE

Petition

老规矩,先查壳

无壳就直接分析

一看是看到这里我是有点懵逼的,但是看完其他函数发现,都是一样的形式

像这样:

这里应该是一种代码混淆,而主要内容就只是7和0x66进行xor

所以我们从头开始(start开始)根据函数调用顺序分析,依次输出异或结果,发现端倪:

!

所以根据函数依次将数据提取出来即可

   flag=[0x1E^0x78, 0x6C, 0x66^7, 0xce^0xa9, 0xf9^0x82, 0x8c^0xb5, 0x88^0xBE, 0xA8^0xcb, 0x52^0x64, 0x99^0xa0, 0x19^0x2f, 0x15^0x21, 0x66^0x50, 3^0x2e, 0xAF^0x97, 0xF6^0xc7, 0x43^0x7b, 0x2c^0x18, 0xc9^0xe4, 0xca^0xfe,0x66^0x55, 0xaa^0x9c, 0x4c^0x7f, 0x2d, 0x25^0x1d, 0xd6^0xb2, 0x9A, 0x44^0x7d, 0xbd^0x90, 0x72^0x45, 0x65^0x56, 8^0x6e, 0x85^0xb2, 0x12^0x21, 0x7f^0x46, 0x13^0x2b, 0x24^0x14, 0xfc^0xca, 0x24^0x12, 0x33^0x50, 0x23^0x12, 0x97^0xea,0xb2^0xb2,]
   
   for i in flag:
       print(chr(i),end='')   
       
   #flag{96c69646-8184-4363-8d9-73f7398066c1}

这里的8d9有一个坑,这里有个函数有个特殊操作:

这里有一个取反的操作,而且0x9A也不在可打印字符的ASCLL码范围内。但是如果我们直接取反python会报错,这里是C语言的特性,char类型是没有默认类型的,它既可以是signed类型的,也可以是unsigned类型的

当出现负值的时候,C语言会自己处理

但是python不会

这里手动处理即可(在数组中给0x9A取反,输出时添加判断):

flag=[0x1E^0x78, 0x6C, 0x66^7, 0xce^0xa9, 0xf9^0x82, 0x8c^0xb5, 0x88^0xBE, 0xA8^0xcb, 0x52^0x64, 0x99^0xa0, 0x19^0x2f, 0x15^0x21, 0x66^0x50, 3^0x2e, 0xAF^0x97, 0xF6^0xc7, 0x43^0x7b, 0x2c^0x18, 0xc9^0xe4, 0xca^0xfe, 0x66^0x55, 0xaa^0x9c, 0x4c^0x7f, 0x2d, 0x25^0x1d, 0xd6^0xb2, ~0x9A, 0x44^0x7d, 0xbd^0x90, 0x72^0x45, 0x65^0x56, 8^0x6e, 0x85^0xb2, 0x12^0x21, 0x7f^0x46, 0x13^0x2b, 0x24^0x14, 0xfc^0xca, 0x24^0x12, 0x33^0x50, 0x23^0x12, 0x97^0xea,0xb2^0xb2,]

for i in flag:
    if i < 0:
        i += 2**8
    print(chr(i),end='')
    
#flag{96c69646-8184-4363-8de9-73f7398066c1}