首页 > 其他分享 >day20

day20

时间:2023-08-01 17:26:55浏览次数:34  
标签:day20 35 flag 异或 print txt fl

一、[MoeCTF 2022]想听点啥

1.使用MuseScore可以打开whatdoyouliketohear.mscz(查了一下是乐谱文件),在乐谱的最后可以看到由音符拼成的一段字串,提示MOECTFI1iKE是密码

image

MOECTFI1iKE

2.密码解压得到一个脚本和一个txt,简单看一下代码,就是一个flag字串,逐位异或,输出字串存到txt中,利用异或的特点,异或回去,写个脚本

image

点击查看代码
flag = 'm'
with open("./flag.txt","rb") as f:
    fl = f.read()
for i in range(len(fl)):
    flag += chr(ord(flag[i]) ^ fl[i])
print(flag)

3.得到flag

moectf{Want_s0me_mor3_mus1c?}

二、[MoeCTF 2022]usb

1.根据特点发现是USB中的键盘流量,先使用UsbKeyboardDataHacker工具,发现无法提取数据

image

2.那就只能使用麻烦一点的方法了,先使用tshark提取其中的data数据

tshark -r usb.pcapng -T fields -e usbhid.data -Y "frame.len == 35" > data1.txt

3.把数据处理一下,0000000000000000和0200000000000000全部删去,否则会报错,使用之前积累的分析脚本和data1.txt,得到flag

点击查看代码
normalKeys = {"04":"a", "05":"b", "06":"c", "07":"d", "08":"e", "09":"f", "0a":"g", "0b":"h", "0c":"i", "0d":"j", "0e":"k", "0f":"l", "10":"m", "11":"n", "12":"o", "13":"p", "14":"q", "15":"r", "16":"s", "17":"t", "18":"u", "19":"v", "1a":"w", "1b":"x", "1c":"y", "1d":"z","1e":"1", "1f":"2", "20":"3", "21":"4", "22":"5", "23":"6","24":"7","25":"8","26":"9","27":"0","28":"<RET>","29":"<ESC>","2a":"<DEL>", "2b":"\t","2c":"<SPACE>","2d":"-","2e":"=","2f":"[","30":"]","31":"\\","32":"<NON>","33":";","34":"'","35":"<GA>","36":",","37":".","38":"/","39":"<CAP>","3a":"<F1>","3b":"<F2>", "3c":"<F3>","3d":"<F4>","3e":"<F5>","3f":"<F6>","40":"<F7>","41":"<F8>","42":"<F9>","43":"<F10>","44":"<F11>","45":"<F12>"}

shiftKeys = {"04":"A", "05":"B", "06":"C", "07":"D", "08":"E", "09":"F", "0a":"G", "0b":"H", "0c":"I", "0d":"J", "0e":"K", "0f":"L", "10":"M", "11":"N", "12":"O", "13":"P", "14":"Q", "15":"R", "16":"S", "17":"T", "18":"U", "19":"V", "1a":"W", "1b":"X", "1c":"Y", "1d":"Z","1e":"!", "1f":"@", "20":"#", "21":"$", "22":"%", "23":"^","24":"&","25":"*","26":"(","27":")","28":"<RET>","29":"<ESC>","2a":"<DEL>", "2b":"\t","2c":"<SPACE>","2d":"_","2e":"+","2f":"{","30":"}","31":"|","32":"<NON>","33":"\"","34":":","35":"<GA>","36":"<","37":">","38":"?","39":"<CAP>","3a":"<F1>","3b":"<F2>", "3c":"<F3>","3d":"<F4>","3e":"<F5>","3f":"<F6>","40":"<F7>","41":"<F8>","42":"<F9>","43":"<F10>","44":"<F11>","45":"<F12>"}

keys = open('data1.txt')
output = ""
for line in keys:
    k = line[1]
    n = line[4:6]
    if k == '0':
        print(normalKeys[n], end='')
    elif k == '2':
        print(shiftKeys[n], end='')

image

4.得到的flag中为大写,为删除,整理一下flag

moectf{Learned_a6ou7_USB_tr@ffic}

标签:day20,35,flag,异或,print,txt,fl
From: https://www.cnblogs.com/120211P/p/17595650.html

相关文章

  • Day20-spring
    Spring(容器框架)官网:https://spring.io/projects/spring-framework导入spring的包——-SpringWebMVC<!--https://mvnrepository.com/artifact/org.springframework/spring-webmvc--><dependency><groupId>org.springframework</groupId><ar......
  • 算法练习-day20
    二叉树669.修剪二叉搜索树题意:给你二叉搜索树的根节点root,同时给定最小边界low和最大边界high。通过修剪二叉搜索树,使得所有节点的值在[low,high]中。修剪树不应该 改变保留在树中的元素的相对结构(即如果没有被移除,原有的父代子代关系都应当保留)。可以证明,存在唯一的答案 ......
  • vue-day20---收集表单数据
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><title>收集表单数据</title><scriptty......
  • day20| 654+617+700+98
    654.最大二叉树 题目简述:给定一个不重复的整数数组 nums。 最大二叉树 可以用下面的算法从 nums递归地构建:创建一个根节点,其值为 nums中的最大值。递归地在最大值 左边 的 子数组前缀上 构建左子树。递归地在最大值右边的 子数组后缀上 构建右子树。 思......
  • 代码随想录Day20-Leetcode654.最大二叉树,617.合并二叉树,700.二叉搜索树中的搜索,98.验
    654.最大二叉树题目链接:https://leetcode.cn/problems/maximum-binary-tree/基本的模拟思路很快/***Definitionforabinarytreenode.*functionTreeNode(val,left,right){*this.val=(val===undefined?0:val)*this.left=(left===undefined......
  • day20
    day20快捷键:Ctrl+q;Ctrl+q;可以显示函数参数1.特殊文件两种特殊的文本文件,一种是properties文件,还有一种是xml文件后缀为.properties的文件,称之为属性文件,它可以很方......
  • go学习 day207 继承
    编写一个学生考试系统packagemainimport( "fmt")//编写一个学生考试系统typestudentstruct{ Namestring Ageint Scoreint}//将Pupil和Graduate......
  • go day200
    结构体变量的赋值点击查看代码packagemainimport"fmt"typeStustruct{ Namestring Ageint}funcmain(){ //方式一:在创建结构体变量时,直接指定字段......
  • 03_17_JavaWeb||day20_JQuery基础||day20_JQuery基础(选择器:筛选具有相似特征的元素(
    今日内容1.JQuery基础:1.概念2.快速入门3.JQuery对象和JS对象区别与转换4.选择器5.DOM操作6.案例JQuery基础:概念:一个JavaScript框架。简化JS开发jQuer......
  • 代码随想录算法训练营Day20 二叉树| 235. 二叉搜索树的最近公共祖先 701.二叉搜索树中
    代码随想录算法训练营235.二叉搜索树的最近公共祖先题目链接:235.二叉搜索树的最近公共祖先给定一个二叉搜索树,找到该树中两个指定节点的最近公共祖先。百度百科中......