跳至主要內容

Misc

LPrincess大约 2 分钟ctfmisc

CNIS_2024 MISC WP

第一天_Tough_DNS

通过脚本 exp1:

from scapy.all import rdpcap,DNSQR,DNS  
def extract_txt_records(pcap_file):  
    packets = rdpcap(pcap_file)  
    dns_queries = []  
    for packet in packets:  
        if packet.haslayer(DNS):  
            dns_layer = packet[DNS]  
            if isinstance(dns_layer.qd, DNSQR):  
                dns_queries.append(dns_layer.qd.qname.decode('utf-8'))  
  
    return dns_queries  
  
pcap_file = 'Tough_DNS.pcapng'  
queries = extract_txt_records(pcap_file)  
print(queries)

exp2:

from scapy.all import rdpcap,DNSQR,DNS,DNSRR  
  
data = []  
  
def extract_txt_records(pcap_file):  
    packets = rdpcap(pcap_file)  
    txt_recoards = []  
    for packet in packets:  
        if packet.haslayer(DNS):  
            dns_layer = packet[DNS]  
            if dns_layer.an:  
                for i in range(dns_layer.ancount):  
                    record = dns_layer.an[i]  
                    if isinstance(record, DNSRR) and record.type == 16:  
                        txt_content = record.rdata  
                        if isinstance(txt_content, bytes):  
                            txt_recoards.append(txt_content.decode('utf-8',errors = 'ignore'))  
                        elif isinstance(txt_content,list):  
                            for entry in txt_content:  
                                txt_recoards.append(entry.decode('utf-8',errors = 'ignore'))  
    return txt_recoards  
  
pcap_file = 'Tough_DNS.pcapng'  
data = extract_txt_records(pcap_file)  
print(data)  
  
for i in data:  
    print(i,end='')

得到
# 58......

exp3:

data = '580448bc003305411445070604940d056d380b017b65a031b0d35f6f04449b3bacb0d2fa219f0f6a0908060fe29c0e74060e0f0e0aab0f070fb8070a7e37675b6d307e2e675d794b2be26b7e7709617a09119d9d0f7e0e010318000d4d1b485f0e360a8e030956f1cc5ec1e982f7655b73849e4096a4f57ae523bbc551cf7e5d46da01d74e561bf4e6027db160971d00c630c99544d27d357163e872cad14d4c697076aa5c8698b655312c456d83c2f099ebef514165cbc5b718d571524fc5e4a6e50a960103cfbffcfc4fbab19646a935305598aeea7eeaf4857befa6d7faa723063ebde644dd7169ca0c2dfbad3b78342837f3ecd84f216067fde2751a422a0777dce1e6103ab5bc17f6b526626b924250ec5241284ece4afe71c2dd52f62bd0617538718850c03794068589c5b75cb0866496e41f6551148c6754f314e163f1d3a26b412a4441f85c23ac9b2939a5158ce140c5a21c3fd6676c5d12591eec2465618e0ed093d5e2cbef757201cfcfa870609a93777848b88d210a335a3faf624ff56250f2a6d2658b8f902845cfa118ce825907587090125bc01946efc00c73843c9d8909b9bf97b06b7e787916b86b007f552a8c625fb23b38e962bce4caf965b050904a40d90eea34bb3f112839cb35089d40f81b94a42b152892a20fd58133d4cba43c45af3f9dfe97f3e1a45b0e8a8dfab5a15050a0d0b09050d0c060602010c0903030202060c02060f03000c0f00030b0b010a03090a030c0f070f0a0004020b050b01030c060d0e0a000c01080200030b0e0d030c070e080e0301060f05010d0a060b08020a040b0004020e0f0f0908060d0a0203010c0305070a09020c0a0d020b01070b04030f0b0c09030e0406040e0f0c0004030a04020207000c050e0e070b04090809050e0d03050e040e000300080d0e0a01070c0f030a0c0e0005010507060d02050e060b040b00020a050c0d0e0a010e0f050105060a040f0804050e010a0c09070906010c0b020a0f050b040e0a050e030e060704080c070f060c0501050e04080c03050c0e0f060706010f0e0f0c05010d0c0f0a0e0f0c06000f05090e010c090c0d0f0e070a04090d070b030c0c0d060f020200000e050509030e040402030a010c0608060b080b07020d0202000f0e0b01030809030809080a01080c0f040e05060f0f0f020a000e0300040003000f0e040b0a0c0803070700050f0f070f0f08070e030e0708000006010a0805080502030c0c0c01060e0d06060d050f0e0c0f070a05020802010207090804070a0a0f0a090b04050e030d0e010500060d00000f0c02080d0c05000e070d0a02020b040b040201020e0b01080c000c0f060700010e0a0e0f0b010305070905070b0e0b0c080d0d05080d04070b0a0d00090a07010b0d060004010e0202030302000a0a0d0c0903070404090e0a0e0c0e0a080d070a070e0a0b0d0b0d0f03000c01010703060c060a0f05080807010103090b0906030b0f09030f0a090a02080c0e0c0f0b02010504020004040a05000e040a0307040f060106090f0d06000e010f0505050907010a0a070609030d0a040c0d09010b080f000707090b08030701060403040f05030b0a0405050e0b0b0c0d0a03000102090a060b010a0005070b060d010b050f0a0a060b08030d0a0a0f0a0004070a030a010c0406040f0a030e0c010408040d05090d070c0d00020005090c050b02010c030708050d0d0b0e0d0d030a0f02010907090a06040800000e070905030d0205030304020e05030c0e0d080b06090d06010602080b07040a0c0f090100030a000e0b060a090c00040402010b020a0f0f05000701060d080d0c0a04080500030a0e0b02080f000506060c07070b050c070300020006030c0e0d0304040d0f0f0e0e0a0a020e080b0107030b030a00050a0f0003050a0f020e020405000f04090c0e0a0c090d0a0f04070d0c0307090a0606050908020707080b050a0b020a020c0e080109030e00010b0c060307050c030c0a000b090c0a0f000d080e0e0e070f060c0e0901080008070009000d0a0c0904040b0c0e020a0606010204090e090f020e030f0d0c0d070a0006010f040a0c0e000d020d050602090406020f0e0a0c0c010506080d03070f05030907020a04070501090a06030c0c070c060c07050f0e010507090b000d090d070205020e0d000d02090f0e0b070f04030c000401010908080b040b080106050d06090c0b050d0c0e0707060306040a0108040c0f040307080f0a03050f04040e0f0f0503070d000f010a0a090a030407070f0b00040a05030b0b0a0d030708050a0b07000c020b0d000e0f0a0b0f070c060204050f09050d03010d0004040c0b0a0d09010c0c030c030b01050a07070300010d05080a0e030202050a000d0e0e0d03090d0b0e06020a050c0a020f0c0d0a040e080f0d040e040a0e05070608020903020b000405070d020803030f0504010a0b030908030500090400010c070108020100030f050c0b0c05090a05000c070c0c00020d04080b070e0c0d070b03070c04010109040305060d080b0704060e0e03060a090e0f0b04070c010f0b010e060f080d050f0a020b05010a01030d02040d01000e010a07050507070e00060a0e040f06020b0001080f0d0105030c080b010c02020a00030d0f0a0c0102070e00000e0d030c040d0b0d050d030101060b04000c0a0b0b0b0709020c0e07010a020d0a090f030f0f0104030606050f020a02030107010f000a010f020d00030b0702050f01040c050c0705060401020a040b030c0806030801080e0e0b0c090c000f08070b0c0f03060d0406020d0f0d01050f070f0f04010509070f03010b020b0c0805060c08000e050f020006090003010f0a0a030a010303030f020201000806050808090e0a0309010b0e080801080c0b010f0b010f070c080801030d0c050b0e040a060f0f0c04000a0a0f020408070904030b0c040b0203050e08040b07050c040509040a0c020a0f0d02070a020e00080c030b01070805030e0b02010907010701050a060e0700080f03010804010c08000600010400070b070e0b080d0803080c03000e0906080906000307030c0a020c050b0404070a0f040306030a0d08040d0109030c0106090f00090f010e0b020e020d030501090d0f0a08070d0e0604040a0d02010b020e04040a01030e0f0c0e0a020d0a05060e070f0e0e0709010c020f0b0307030607080e070d09090c0a070a0d0002000201080f05030d07010300040d090b0e060d0105040f0f040508060a0d090b0a030a000204020b00060205030309060a0b0f02010409040f0907060707020d0b0f000c06090e0c0e06040d06060f0a0004040e010c0b060d09070b0d05070f04000d0d040d040202010a01020a000b030f050e030e080305060a0406060d000103040f0a0f0a07030c040d0d05070705060a03010709070c0a020b0c0b010b0d0c070800050e010f03040c0e090f0e02000b060b0709060e080504050e030b0d0a080f0700060f07020d0b0a000303070a0c020e090d0b0e0004050e080401060700030a070c09010c010f0a09050e050e060e03010808080304030f01010206070a040600040103010f0c040607050202020f0d0e040d0e07060f0f030108090f0c0e00070d030401060209040403050a0c0102070f030c0f080800050800040b050a090308070306090905010b0b0c0f0b0504080c0106090a0d070e030f0a0e00060c040c0a0e0b080e010f0b040f0602090d00070103090f0b0b070d0b0301090a070d040708030b030e060b000c040b080a0c0108050e0f0b080d0e070e060f0a040f0c01010e01020700020603010808090001060d00090b04020507070d0b0c02020f0b07060407050d0b010a0f0809060e090600060c0d040000060a030204010c030705050c090f070d030c070f0a0d0a0d050d090b07040f0f0a02070d0704040d0b0a0708020d0501020b0f0e0c04000107050d090a090a0c0501010c0b0008070a0b01010b0e050408050702020d0a04080a0b09090f0d0b030305010c0b0703080600090b050d000606020a0f040d0308080d0e020409030c04090b030a050d080f04050908020602070d00020900060403060c06060f0e0c09060b0f0a05080104040d060106050b0d0105010305080a0104080d0c080c00080e0b0a020d020105040707050f000c0f03080e010205050d0d0f060503030101000908010f0c0b0704060a0d0f0e0502020504050f020f0a090b06090a0f050e07010f01040c04090005090a08090a0d030a060409010b0e02050a030405040602040b0c07070b0e080404060107060209090408080f05040f0e0600010a0d0001020b050a050e0006070409080c0b0e02020f080e0b080c010f0a060b0d060d04020b050e05050701070b0b050905010a0d090f050209080b030e0c0f040702080f020108000e05090008040806030c050f080209020801010b01040005020f0500030d0e08090b00040d0606040a0302020005050c0d040e0309010602040504010500040b00070008000409030a0b0d0f02090006000000000e090007000000000500040b00010002010f000001040000000900000603000007060a030b0d0506000409030a0b0d0f02090006000000000e09000700000000000a0000020f000000000000000000000000000002000000000000000000000000000000070306050603070206050704020e060707000607000a00000200000000000000000000000001000001080000090e020003000f08020809020d0900010d0a0a0b06080703020909020d0900010708090806080703020909020d090001000109090007000000010000040104050003000800000500040b00050006000000000000000000010000000100000607000000000000060c000600000000000000000'  
# for i in range(1,len(data),1):
for i in range(1,len(data),2): 
    print(data[i],end='')

复制到010:得到压缩包,打开是密钥文件

压缩包密码:

压缩包:

解出来得到私钥文件

xxd命令是Linux中一个非常有用的工具,它可以将文件转换为十六进制格式进行查看、编辑和保存

gpg ./file_name
gpg --import secret.gpg

有个小坑,要把文件名后缀改成.asc

两次反转:

得到flag

flag{79830a47-faf7-4067-b585-145776f833cd}

第一天_Power Trajectory Diagram

exp:

import numpy as np  
import matplotlib.pyplot as plt  
  
datas = np.load('attachment.npz')  
print(datas.files)  
print(datas['index'])  
print(datas['input'])  
print(datas['output'])  
print(datas['trace'])  
  
  
print(datas['trace'].shape)  
print(datas['input'].shape)  
print(datas['index'].shape)  
  
# trace = datas['trace']  
input = datas['input']  
# index = datas['index']

# print("l: {}".format(l))  
# l = list(set(l))  
# ls = []  
# print("l: {}".format(l))  
# for i in l:  
#     ls.append(index[i])  
#  
# ls = list(set(ls))  
# l.sort()  
# print("ls: {}".format(ls))  
# print('flag{',end='')  
# for i in l:  
#     print(input[i],end='')  
# print('}')  
#  
# # # 绘制功耗轨迹  
# # plt.figure(figsize=(10, 6))  
# # plt.plot(trace.T, color='blue', alpha=0.5)  # 使用alpha参数增加轨迹的透明度  
# # plt.scatter(min_indices, trace[min_indices, np.arange(len(min_indices))], color='red', label='Min Value')  # 绘制极小值点  
# # plt.title('Power Consumption Trace')  
# # plt.xlabel('Time Steps')  
# # plt.ylabel('Power')  
# # plt.grid(True)  
# # plt.legend()  
# # plt.show()

绘制轨迹

  • 发现异常点
  • 提取数组将异常点
  • 发现都是520

对应input:

a = [35,41,87,137,161,212,275,307,345,387,429,475]  
for i in a:  
    print(input[i+1],end='')

输出flag

flag{_ciscn_2024_}
上次编辑于:
贡献者: L-mj0