百度已收录

Neverland

反编译后看主函数
NeverlandMain.png
有一个func函数,双击进入
Neverlandfunc.png

是一个斐波那契数列的变形,是递归实现的,且idx[i]数组后十个数据非常大,导致无法跑出完整的flag
所以要对这个递归进行优化
代码如下

#include <stdio.h>

unsigned __int64 idx[40] = { 0x09, 0x0F, 0x0C, 0x03, 0x02, 0x10, 0x0B, 0x0E, 0x07, 0x0A, 0x2E, 0x2D, 0x2B, 0x2E, 0x2F, 0x2D, 0x2F, 0x28, 0x31, 0x3A, 0x31, 0x33, 0x33, 0x2B, 0x32, 0x37, 0x37, 0x38, 0x3C, 0x30, 0xFFFFFFCE, 0xFFFFFF93, 0xFFFFFFD8, 0xFFFFFFF2, 0xFFFFFFDF, 0xFFFFFF70, 0xFFFFFF72, 0xFFFFFFD0, 0xFFFFFFA6, 0xFFFFFF9A };
unsigned __int64 enc[40] = { 0xBFFCC, 0xBFFFFF84, 0x3000043, 0x0DD, 0x59, 0x61, 0xBFFF87, 0x30000035, 0xBF99, 0x300032, 0x36, 0x0FFFFFFC9, 0x0FFFFFF98, 0x30, 0x0FFFFFF9F, 0x0FFFFFFCC, 0x0FFFFFFC8, 0x62, 0x0FFFFFF99, 0x30, 0x0FFFFFFC8, 0x0FFFFFF9A, 0x0FFFFFFC5, 0x0FFFFFF9E, 0x32, 0x0FFFFFFC4, 0x0FFFFFFC8, 0x60, 0x3D, 0x35, 0x3D, 0x0FFFFFFCB, 0x34, 0x3C, 0xFFFFFF9F, 0x65, 0x65, 0x33, 0x66, 0x79 };

unsigned __int64 fun1(unsigned __int64 n)
{
    unsigned __int64 fn0 = 7;
    unsigned __int64 fn1 = 8;
    unsigned __int64 k = 2;
    unsigned __int64 fn = 0;

    if (n == 0)
    {
        return 7;
    }
    if (n == 1)
    {
        return 8;
    }
    while (k <= n)
    {
        fn = 3 * fn1 + 4 * fn0;
        fn0 = fn1;
        fn1 = fn;
        k++;
    }
    return fn;
}

char v0;
int main()
{
    for (int i = 0; i < 40; i++)
    {
        v0 = fun1(idx[i]);
        putchar(v0 ^ enc[i]);
    }
    return 0;
}