当前位置:网站首页>[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]}
?>边栏推荐
- Go language notes (2) some simple applications of go
- Remember to build wheels repeatedly at one time (the setting instructions of obsidian plug-in are translated into Chinese)
- Some suggestions for interface design
- Routing configuration and connectivity test of Huawei simulator ENSP
- JS卡牌样式倒计时天数
- Billions of citizens' information has been leaked! Is there any "rescue" for data security on the public cloud?
- GVM use
- 【解决方案】PaddlePaddle 2.x调用静态图模式
- WinCC7.5 SP1如何通过交叉索引来寻找变量及其位置?
- Google colab踩坑
猜你喜欢

Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"

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

B站视频 声音很小——解决办法

华为ensp模拟器 实现多个路由器的设备可以相互访问

接口設計時的一些建議

哈希表、哈希函数、布隆过滤器、一致性哈希

Huawei ENSP simulator configures ACL access control list

WGCNA分析基本教程总结

每日一题-LeetCode1200-最小绝对差-数组-排序

Redis:Redis配置文件相关配置、Redis的持久化
随机推荐
搭建一个仪式感点满的网站,并内网穿透发布到公网 1/2
NetWare r7000 Merlin system virtual memory creation failed, prompting that the USB disk reading and writing speed does not meet the requirements. Solution, is it necessary to create virtual memory??
shp数据制作3DTiles白膜
网件r7000梅林系统5g不稳定 5g信号经常掉线解决方法
admas零件名重复
Routing configuration and connectivity test of Huawei simulator ENSP
Hands on deep learning (III) -- convolutional neural network CNN
杰理之增加进关机前把触摸模块关闭流程【篇】
Leetcode+ 81 - 85 monotone stack topic
[observation] Lenovo: 3x (1+n) smart office solution, releasing the "multiplier effect" of office productivity
每日一题-LeetCode1200-最小绝对差-数组-排序
2021 CCPC 哈尔滨 B. Magical Subsequence(思维题)
RFID仓储管理系统解决方案的优点
多模输入事件分发机制详解
[micro service SCG] use of predict
Huawei ENSP simulator realizes communication security (switch)
Jekins initialization password not found or not found
In the face of the same complex test task, why can the elder sort out the solution quickly? Ali's ten-year test engineers showed their skills
In the release version, the random white screen does not display the content after opening the shutter
Idea plug-in