常规题目,C#程序,无壳无混淆
dnspy打开,定位到main函数
逻辑很清楚,分几个阶段:
提取原始数独:<Module>.sudoku,0xf换成0
求解:
抽出填进去的数:34689155813271746868579324125982187492581517263447389126
迷宫:$ArrayType$$$BY133E 局部变量:
!是起始位置,?是目标位置,+是空地,-是墙,WSAD控制行走
8步正好走到终点:SDSDDWWA
组合上述,最终flag为:
今年的第一个题后碎碎念:
看雪CTF今年的规则是一点都没变啊,还真是坚持自己的特色。犹记得从去年到现在群里很多人都提出过当前计分模式不合理(防守方难度分极大的由一血时间决定而不怎么受做出人数的影响;攻击分积分受时间影响过大,衰减过于严重,以至于去年曾短暂出现过仅靠一道一血排名就高出了做出四道题的人的心寒时刻,而从题目难度看,那四道题付出的精力可并不低)
给希望拿奖的防守方提供一点点出题思路
签到题还没做,不是屯flag,是真的卡壳没思路……
// <Module>
// Token: 0x06000003 RID: 3 RVA: 0x00001090 File Offset: 0x00000490
internal
unsafe
static
int
main()
{
$ArrayType$$$BY0BAA@D $ArrayType$$$BY0BAA@D;
initblk(
ref
$ArrayType$$$BY0BAA@D, 0, 256);
<Module>.printf(
ref
<Module>.??_C@_0BJ@MNCFGMHN@Please?5input?5your?5flag?3?5?$AA@);
<Module>.scanf(
ref
<Module>.??_C@_05HPMPOKFN@?$CF?$FL?$FO?6?$FN?$AA@,
ref
$ArrayType$$$BY0BAA@D);
sbyte
* ptr =
ref
$ArrayType$$$BY0BAA@D;
if
($ArrayType$$$BY0BAA@D !=
null
)
{
do
{
ptr += 1L;
}
while
(*ptr != 0);
}
if
(ptr - (
ref
$ArrayType$$$BY0BAA@D) != 70U)
{
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
}
if
($ArrayType$$$BY0BAA@D == 102 && *((
ref
$ArrayType$$$BY0BAA@D) + 1) == 108 && *((
ref
$ArrayType$$$BY0BAA@D) + 2) == 97 && *((
ref
$ArrayType$$$BY0BAA@D) + 3) == 103 && *((
ref
$ArrayType$$$BY0BAA@D) + 4) == 123 && *((
ref
$ArrayType$$$BY0BAA@D) + 69) == 125)
{
$ArrayType$$$BY0EA@E $ArrayType$$$BY0EA@E;
cpblk(
ref
$ArrayType$$$BY0EA@E, (
ref
$ArrayType$$$BY0BAA@D) + 5, 64);
uint
num = 0U;
uint
num2 = 0U;
$ArrayType$$$BY188E* ptr2 = &<Module>.sudoku;
do
{
uint
num3 = 0U;
$ArrayType$$$BY188E* ptr3 = ptr2;
do
{
if
(*(
byte
*)ptr3 == 15)
{
byte
b = *((
ulong
)num + (
ref
$ArrayType$$$BY0EA@E));
if
(b < 48 || b > 57)
{
goto
IL_109;
}
*(
byte
*)ptr3 = b - 48;
num += 1U;
}
num3 += 1U;
ptr3 += 1L / (
long
)
sizeof
($ArrayType$$$BY188E);
}
while
(num3 < 9U);
num2 += 1U;
ptr2 += 9L / (
long
)
sizeof
($ArrayType$$$BY188E);
}
while
(num2 < 9U);
uint
num4 = 1U;
uint
num5 = 1U;
uint
num6 = 0U;
long
num7 = 0L;
while
(num4 == 1U)
{
long
num8 = 0L;
uint
num9 = 1U;
while
(num4 == 1U)
{
uint
num10 = num9;
if
(num9 < 9U)
{
long
num11 = (
long
)((
ulong
)num9);
byte
b2 = *(num7 + num8 + (
ref
<Module>.sudoku));
num4 = 1U;
$ArrayType$$$BY188E* ptr4 = num7 + num11 + (
ref
<Module>.sudoku);
while
(b2 != *(
byte
*)ptr4)
{
num10 += 1U;
ptr4 += 1L / (
long
)
sizeof
($ArrayType$$$BY188E);
if
(num10 >= 9U)
{
goto
IL_17F;
}
}
num4 = 0U;
}
IL_17F:
num9 += 1U;
num8 += 1L;
if
(num9 - 1U >= 9U)
{
break
;
}
}
num6 += 1U;
num7 += 9L;
if
(num6 >= 9U)
{
break
;
}
}
uint
num12 = 0U;
long
num13 = 0L;
while
(num5 == 1U)
{
uint
num14 = 1U;
$ArrayType$$$BY188E* ptr5 = num13 + (
ref
<Module>.sudoku);
while
(num5 == 1U)
{
uint
num15 = num14;
if
(num14 < 9U)
{
$ArrayType$$$BY188E* ptr6 = num14;
byte
b3 = *(
byte
*)ptr5;
num5 = 1U;
$ArrayType$$$BY188E* ptr7 = ptr6 * 9L + num13 / (
long
)
sizeof
($ArrayType$$$BY188E) + (
ref
<Module>.sudoku) /
sizeof
($ArrayType$$$BY188E);
while
(b3 != *(
byte
*)ptr7)
{
num15 += 1U;
ptr7 += 9L / (
long
)
sizeof
($ArrayType$$$BY188E);
if
(num15 >= 9U)
{
goto
IL_209;
}
}
num5 = 0U;
}
IL_209:
num14 += 1U;
ptr5 += 9L / (
long
)
sizeof
($ArrayType$$$BY188E);
if
(num14 - 1U >= 9U)
{
break
;
}
}
num12 += 1U;
num13 += 1L;
if
(num12 >= 9U)
{
break
;
}
}
if
(num4 == 1U && num5 == 1U)
{
$ArrayType$$$BY133E $ArrayType$$$BY133E = 33;
*((
ref
$ArrayType$$$BY133E) + 1) = 45;
*((
ref
$ArrayType$$$BY133E) + 2) = 63;
*((
ref
$ArrayType$$$BY133E) + 3) = 43;
*((
ref
$ArrayType$$$BY133E) + 4) = 43;
*((
ref
$ArrayType$$$BY133E) + 5) = 43;
*((
ref
$ArrayType$$$BY133E) + 6) = 45;
*((
ref
$ArrayType$$$BY133E) + 7) = 43;
*((
ref
$ArrayType$$$BY133E) + 8) = 45;
*((
ref
$ArrayType$$$BY133E) + 9) = 43;
*((
ref
$ArrayType$$$BY133E) + 10) = 43;
*((
ref
$ArrayType$$$BY133E) + 11) = 43;
*((
ref
$ArrayType$$$BY133E) + 12) = 43;
*((
ref
$ArrayType$$$BY133E) + 13) = 45;
*((
ref
$ArrayType$$$BY133E) + 14) = 45;
*((
ref
$ArrayType$$$BY133E) + 15) = 43;
byte
b4 = 0;
byte
b5 = 0;
uint
num16 = 0U;
do
{
int
num17 = (
int
)(*((
ulong
)num + (
ref
$ArrayType$$$BY0EA@E)));
num += 1U;
if
(num17 != 65)
{
if
(num17 != 68)
{
if
(num17 != 83)
{
if
(num17 == 87)
{
if
(b4 == 0)
{
goto
IL_323;
}
b4 -= 1;
}
}
else
{
if
(b4 == 3)
{
goto
IL_330;
}
b4 += 1;
}
}
else
{
if
(b5 == 3)
{
goto
IL_33D;
}
b5 += 1;
}
}
else
{
if
(b5 == 0)
{
goto
IL_34A;
}
b5 -= 1;
}
if
(*((
ulong
)b5 + (
ref
$ArrayType$$$BY133E) + (
ulong
)b4 * 4UL) == 45)
{
goto
IL_357;
}
num16 += 1U;
}
while
(num16 < 8U);
if
(*((
ulong
)b5 + (
ref
$ArrayType$$$BY133E) + (
ulong
)b4 * 4UL) == 63)
{
<Module>.printf(
ref
<Module>.??_C@_0BB@MGPKLNCH@You?5are?5winner?$CB?6?$AA@);
return
0;
}
goto
IL_381;
IL_323:
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
IL_330:
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
IL_33D:
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
IL_34A:
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
IL_357:
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
}
goto
IL_381;
IL_109:
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
}
IL_381:
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
}
// <Module>
// Token: 0x06000003 RID: 3 RVA: 0x00001090 File Offset: 0x00000490
internal
unsafe
static
int
main()
{
$ArrayType$$$BY0BAA@D $ArrayType$$$BY0BAA@D;
initblk(
ref
$ArrayType$$$BY0BAA@D, 0, 256);
<Module>.printf(
ref
<Module>.??_C@_0BJ@MNCFGMHN@Please?5input?5your?5flag?3?5?$AA@);
<Module>.scanf(
ref
<Module>.??_C@_05HPMPOKFN@?$CF?$FL?$FO?6?$FN?$AA@,
ref
$ArrayType$$$BY0BAA@D);
sbyte
* ptr =
ref
$ArrayType$$$BY0BAA@D;
if
($ArrayType$$$BY0BAA@D !=
null
)
{
do
{
ptr += 1L;
}
while
(*ptr != 0);
}
if
(ptr - (
ref
$ArrayType$$$BY0BAA@D) != 70U)
{
<Module>.printf(
ref
<Module>.??_C@_0M@IIPHMAMA@Try?5again?$CB?6?$AA@);
return
-1;
}
if
($ArrayType$$$BY0BAA@D == 102 && *((
ref
$ArrayType$$$BY0BAA@D) + 1) == 108 && *((
ref
$ArrayType$$$BY0BAA@D) + 2) == 97 && *((
ref
$ArrayType$$$BY0BAA@D) + 3) == 103 && *((
ref
$ArrayType$$$BY0BAA@D) + 4) == 123 && *((
ref
$ArrayType$$$BY0BAA@D) + 69) == 125)
{
$ArrayType$$$BY0EA@E $ArrayType$$$BY0EA@E;
cpblk(
ref
$ArrayType$$$BY0EA@E, (
ref
$ArrayType$$$BY0BAA@D) + 5, 64);
uint
num = 0U;
uint
num2 = 0U;
$ArrayType$$$BY188E* ptr2 = &<Module>.sudoku;
do
{
uint
num3 = 0U;
$ArrayType$$$BY188E* ptr3 = ptr2;
do
{
if
(*(
byte
*)ptr3 == 15)
{
byte
b = *((
ulong
)num + (
ref
$ArrayType$$$BY0EA@E));
if
(b < 48 || b > 57)
{
goto
IL_109;
}
*(
byte
*)ptr3 = b - 48;
num += 1U;
}
num3 += 1U;
ptr3 += 1L / (
long
)
sizeof
($ArrayType$$$BY188E);
}
while
(num3 < 9U);
num2 += 1U;
ptr2 += 9L / (
long
)
sizeof
($ArrayType$$$BY188E);
}
while
(num2 < 9U);
uint
num4 = 1U;
uint
num5 = 1U;
uint
num6 = 0U;
long
num7 = 0L;
while
(num4 == 1U)
{
long
num8 = 0L;
uint
num9 = 1U;
while
(num4 == 1U)
{
uint
num10 = num9;
if
(num9 < 9U)
{
long
num11 = (
long
)((
ulong
)num9);
byte
b2 = *(num7 + num8 + (
ref
<Module>.sudoku));
num4 = 1U;
$ArrayType$$$BY188E* ptr4 = num7 + num11 + (
ref
<Module>.sudoku);
while
(b2 != *(
byte
*)ptr4)
{
num10 += 1U;
ptr4 += 1L / (
long
)
sizeof
($ArrayType$$$BY188E);
if
(num10 >= 9U)
{
goto
IL_17F;
}
}
num4 = 0U;
}
IL_17F:
num9 += 1U;
num8 += 1L;
if
(num9 - 1U >= 9U)
{
break
;
}
}
num6 += 1U;
num7 += 9L;
if
(num6 >= 9U)
{
break
;
}
}
uint
num12 = 0U;
long
num13 = 0L;
while
(num5 == 1U)
{
uint
num14 = 1U;
$ArrayType$$$BY188E* ptr5 = num13 + (
ref
<Module>.sudoku);
while
(num5 == 1U)
{
uint
num15 = num14;
if
(num14 < 9U)
{
$ArrayType$$$BY188E* ptr6 = num14;
byte
b3 = *(
byte
*)ptr5;
num5 = 1U;
$ArrayType$$$BY188E* ptr7 = ptr6 * 9L + num13 / (
long
)
sizeof
($ArrayType$$$BY188E) + (
ref
<Module>.sudoku) /
sizeof
($ArrayType$$$BY188E);
while
(b3 != *(
byte
*)ptr7)
{
num15 += 1U;
ptr7 += 9L / (
long
)
sizeof
($ArrayType$$$BY188E);
if
(num15 >= 9U)
{
goto
IL_209;
}
}
num5 = 0U;
}
IL_209:
num14 += 1U;
ptr5 += 9L / (
long
)
sizeof
($ArrayType$$$BY188E);
if
(num14 - 1U >= 9U)
{
break
;
}
}
num12 += 1U;
num13 += 1L;
if
(num12 >= 9U)
{
break
;
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
最后于 2024-8-17 00:19
被mb_mgodlfyn编辑
,原因: