当前位置:网站首页>[buuctf.reverse] 151_ [FlareOn6]DnsChess
[buuctf.reverse] 151_ [FlareOn6]DnsChess
2022-07-04 21:20:00 【Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi Shi】
There are three attachments to this question
ChessUI This should be the main program , But logic is not here , Because there is a link library behind
ChessAI.so This should be the main processing function , There are few functions inside , Only getNextMove Useful
capture.pcap It is the packet caught with the server traffic , First copy the bag you caught, that's it
No. Time Source Destination Protocol Length Data Info
1 0.000000 192.168.122.1 192.168.122.29 DNS 122 Standard query 0xabfd A rook-c3-c6.game-of-thrones.flare-on.com OPT
2 0.001078 192.168.122.29 192.168.122.1 DNS 188 Standard query response 0xabfd A rook-c3-c6.game-of-thrones.flare-on.com A 127.150.96.223 NS ns1.game-of-thrones.flare-on.com A 127.0.0.1 OPT
3 1.022791 192.168.122.1 192.168.122.29 DNS 124 Standard query 0x6dc5 A knight-g1-f3.game-of-thrones.flare-on.com OPT
4 1.023794 192.168.122.29 192.168.122.1 DNS 190 Standard query response 0x6dc5 A knight-g1-f3.game-of-thrones.flare-on.com A 127.252.212.90 NS ns1.game-of-thrones.flare-on.com A 127.0.0.1 OPT
5 2.046579 192.168.122.1 192.168.122.29 DNS 122 Standard query 0xa3e4 A pawn-c2-c4.game-of-thrones.flare-on.com OPT
6 2.048882 192.168.122.29 192.168.122.1 DNS 188 Standard query response 0xa3e4 A pawn-c2-c4.game-of-thrones.flare-on.com A 127.215.177.38 NS ns1.game-of-thrones.flare-on.com A 127.0.0.1 OPT
The return package contains the requested name and IP Address
Look again getNextMove()
__int64 __fastcall getNextMove(int a1, const char *a2, unsigned int a3, unsigned int a4, __int64 a5)
{
struct hostent *v9; // [rsp+20h] [rbp-60h]
char *v10; // [rsp+28h] [rbp-58h]
char dest[72]; // [rsp+30h] [rbp-50h] BYREF
unsigned __int64 v12; // [rsp+78h] [rbp-8h]
v12 = __readfsqword(0x28u);
strcpy(dest, a2); // Son
get_place_name(dest, a3); // -c3
get_place_name(dest, a4); // -c6
strcat(dest, ".game-of-thrones.flare-on.com");// .xxxx
v9 = gethostbyname(dest); // Return information
if ( !v9 )
return 2LL;
v10 = *v9->h_addr_list;
if ( *v10 != 127 || (v10[3] & 1) != 0 || a1 != (v10[2] & 0xF) )// IP The last bit of the address is 1 The error of 3 A low 4 Bits are serial numbers
return 2LL;
sleep(1u);
byte_4060[2 * a1] = v10[1] ^ qword_2020[2 * a1];// IP The first 2 Paragraph is key Exclusive or , The first 3 Segment is serial number , Two bytes at a time and byte_2020 Exclusive or
byte_4060[2 * a1 + 1] = v10[1] ^ qword_2020[2 * a1 + 1];
*(_DWORD *)a5 = (unsigned __int8)v10[2] >> 4;
*(_DWORD *)(a5 + 4) = (unsigned __int8)v10[3] >> 1;
strcpy((char *)(a5 + 8), off_4120[a1]);
return (unsigned __int8)v10[3] >> 7;
}In the beginning IP Address segmentation into array v10 in , When the first 1 Is it a paragraph 127 Return , This should be a statement to filter packets , Follow flag Irrelevant items are filtered out here
if ( *v10 != 127 || (v10[3] & 1) != 0 || a1 != (v10[2] & 0xF) )// IP The last bit of the address is 1 The error of 3 A low 4 Bits are serial numbers
return 2LL;v10[3]&1 != 0 This is also filtered together , There is still data left after filtering 15 A package .
and a1 Is the parameter brought in , I don't know here a1 How much is the , But guess according to the name, it should be the serial number of the package . After entering the function, check the package content and serial number .
The next two sentences should deal with flag 了 ,a1 If it is serial number , Process two bytes at a time , The secret is bytes_2020, The key is IP Address No 2 Segments
byte_4060[2 * a1] = v10[1] ^ qword_2020[2 * a1];// IP The first 2 Paragraph is key Exclusive or , The first 3 Segment is serial number , Two bytes at a time and byte_2020 Exclusive or
byte_4060[2 * a1 + 1] = v10[1] ^ qword_2020[2 * a1 + 1];Through this writing program
<?php
$str = file_get_contents("capture.txt");
preg_match_all("|response (0x[0-9a-f]{1,6}) A ([0-9a-z\-]{10,20}).game-of-thrones.flare-on.com A ([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+) NS ns1.game-of-thrones.flare-on.com|iUms", $str, $arg);
#print_r($arg);
$unk_2020 =[0x79,0x5A,0xB8,0xBC,0xEC,0xD3,0xDF,0xDD,0x99,0xA5,0xB6,0xAC,0x15,0x36,0x85,0x8D,0x09,0x08,0x77,0x52,0x4D,0x71,0x54,0x7D,0xA7,0xA7,0x08,0x16,0xFD,0xD7];
$b = [];
foreach($arg[1] as $i=>$v){
if ($arg[3][$i] != 127 || $arg[6][$i]&1 !=0)continue;
$a = $arg[5][$i]&0xf;
$key = $arg[4][$i];
$b[$a] = chr($unk_2020[2*$a]^$key ).chr($unk_2020[2*$a+1]^$key);
echo "$a,".$arg[2][$i]."\r\n";
}
ksort($b);
$flag = "";
foreach($b as $v)$flag .=$v;
print_r($b);
print($flag);
// LooksLikeYouLockedUpTheLookupZ
// flag{[email protected]}
?>边栏推荐
猜你喜欢

偷窃他人漏洞报告变卖成副业,漏洞赏金平台出“内鬼”

admas零件名重复

杰理之AD 系列 MIDI 功能说明【篇】

Billions of citizens' information has been leaked! Is there any "rescue" for data security on the public cloud?

Detailed explanation of multi-mode input event distribution mechanism

Huawei ENSP simulator configures DHCP for router

多模输入事件分发机制详解

网件r7000梅林系统虚拟内存创建失败,提示USB磁盘读写速度不满足要求解决办法,有需要创建虚拟内存吗??

Difference between ApplicationContext and beanfactory (MS)

Quelques suggestions pour la conception de l'interface
随机推荐
网络命名空间
ACM组合计数入门
杰理之AD 系列 MIDI 功能说明【篇】
[Shenbo introduction] VI How to contact your favorite doctoral tutor
软件开发过中的采购
【解决方案】PaddlePaddle 2.x调用静态图模式
网件r7000梅林系统虚拟内存创建失败,提示USB磁盘读写速度不满足要求解决办法,有需要创建虚拟内存吗??
[server data recovery] a case of RAID5 data recovery stored in a brand of server
华为ensp模拟器 实现多个路由器的设备可以相互访问
五子棋 上班摸鱼工具 可局域网/人机
Play the music of youth
render函数与虚拟dom
福昕PDF编辑器v10.1.8绿色版
Procurement in software development
接口设计时的一些建议
HWiNFO硬件检测工具v7.26绿色版
Poster cover of glacier
Gobang go to work fishing tools can be LAN / man-machine
Redis:Redis配置文件相关配置、Redis的持久化
Remember to build wheels repeatedly at one time (the setting instructions of obsidian plug-in are translated into Chinese)