[ACTF新生赛2020]crypto-classic1

题目
hint

哇,这里有压缩包的密码哦,于是我低下了头,看向了我的双手,试图从中找到某些规律
xdfv ujko98 edft54 xdfv pok,.; wsdr43

解题
看向自己的双手,xdfv ujko98 edft54 xdfv pok,.; wsdr43

键盘加密,每组字母包围起来的字母分别为:circle

解压,得到:SRLU{LZPL_S_UASHKXUPD_NXYTFTJT}

提示是维吉尼亚加密,

c='SRLU{LZPL_S_UASHKXUPD_NXYTFTJT}'
m='ACTF{'
a=[]
for i in range(4):a.append(str(ord(c[i])-ord(m[i])))
print(m,end='')
for i in range(5,len(c)):if 'A'<= c[i]<= 'Z':print(chr((ord(c[i])-int(a[i%4])-ord('A'))%26+ord('A')),end='')else:print(c[i],end='')

得到:ACTF{WHAT_A_CLASSICAL_VIGENERE}
最后将其中字母换成小写就行了

答案
flag{what_a_classical_vigenere}

[AFCTF2018]你听过一次一密么?

题目

Problem

25030206463d3d393131555f7f1d061d4052111a19544e2e5d
0f020606150f203f307f5c0a7f24070747130e16545000035d
1203075429152a7020365c167f390f1013170b1006481e1314
0f4610170e1e2235787f7853372c0f065752111b15454e0e09
081543000e1e6f3f3a3348533a270d064a02111a1b5f4e0a18
0909075412132e247436425332281a1c561f04071d520f0b11
4116111b101e2170203011113a69001b475206011552050219
041006064612297020375453342c17545a01451811411a470e
021311114a5b0335207f7c167f22001b44520c15544801125d
06140611460c26243c7f5c167f3d015446010053005907145d
0f05110d160f263f3a7f4210372c03111313090415481d49

解题
一次一密是无条件安全的。

那这道题应该是二次密码本加密了

参考关于Many-Time-Pad的某大佬笔记、关于ACTF解题笔记

写脚本中、、、、

算了,我放弃,还是来看大佬的吧:

import string
import collections
import sets, sys# 11 unknown ciphertexts (in hex format), all encrpyted with the same keyc1='25030206463d3d393131555f7f1d061d4052111a19544e2e5d'
c2='0f020606150f203f307f5c0a7f24070747130e16545000035d'
c3='1203075429152a7020365c167f390f1013170b1006481e1314'
c4='0f4610170e1e2235787f7853372c0f065752111b15454e0e09'
c5='081543000e1e6f3f3a3348533a270d064a02111a1b5f4e0a18'
c6='0909075412132e247436425332281a1c561f04071d520f0b11'
c7='4116111b101e2170203011113a69001b475206011552050219'
c8='041006064612297020375453342c17545a01451811411a470e'
c9='021311114a5b0335207f7c167f22001b44520c15544801125d'
c10='06140611460c26243c7f5c167f3d015446010053005907145d'
c11='0f05110d160f263f3a7f4210372c03111313090415481d49'
ciphers = [c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11]
# The target ciphertext we want to crack
#target_cipher = "0529242a631234122d2b36697f13272c207f2021283a6b0c7908"# XORs two string
def strxor(a, b):     # xor two strings (trims the longer input)return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b)])def target_fix(target_cipher):# To store the final keyfinal_key = [None]*150# To store the positions we know are brokenknown_key_positions = set()# For each ciphertextfor current_index, ciphertext in enumerate(ciphers):counter = collections.Counter()# for each other ciphertextfor index, ciphertext2 in enumerate(ciphers):if current_index != index: # don't xor a ciphertext with itselffor indexOfChar, char in enumerate(strxor(ciphertext.decode('hex'), ciphertext2.decode('hex'))): # Xor the two ciphertexts# If a character in the xored result is a alphanumeric character, it means there was probably a space character in one of the plaintexts (we don't know which one)if char in string.printable and char.isalpha(): counter[indexOfChar] += 1 # Increment the counter at this indexknownSpaceIndexes = []# Loop through all positions where a space character was possible in the current_index cipherfor ind, val in counter.items():# If a space was found at least 7 times at this index out of the 9 possible XORS, then the space character was likely from the current_index cipher!if val >= 7: knownSpaceIndexes.append(ind)#print knownSpaceIndexes # Shows all the positions where we now know the key!# Now Xor the current_index with spaces, and at the knownSpaceIndexes positions we get the key back!xor_with_spaces = strxor(ciphertext.decode('hex'),' '*150)for index in knownSpaceIndexes:# Store the key's value at the correct positionfinal_key[index] = xor_with_spaces[index].encode('hex')# Record that we known the key at this positionknown_key_positions.add(index)# Construct a hex key from the currently known key, adding in '00' hex chars where we do not know (to make a complete hex string)final_key_hex = ''.join([val if val is not None else '00' for val in final_key])# Xor the currently known key with the target cipheroutput = strxor(target_cipher.decode('hex'),final_key_hex.decode('hex'))print ("Fix this sentence:")print (''.join([char if index in known_key_positions else '*' for index, char in enumerate(output)])+"n")# WAIT.. MANUAL STEP HERE # This output are printing a * if that character is not known yet# fix the missing characters like this: "Let*M**k*ow if *o{*a" = "cure, Let Me know if you a"# if is too hard, change the target_cipher to another one and try again# and we have our key to fix the entire text!#sys.exit(0) #comment and continue if u got a good keytarget_plaintext = "cure, Let Me know if you a"print ("Fixed:")print (target_plaintext+"n")key = strxor(target_cipher.decode('hex'),target_plaintext)print ("Decrypted msg:")for cipher in ciphers:print (strxor(cipher.decode('hex'),key))print ("nPrivate key recovered: "+key+"n")for i in ciphers:target_fix(i)

运行得到:
afctf{OPT_1s_Int3rest1ng}

答案

flag{OPT_1s_Int3rest1ng}

2021-07-12相关推荐

  1. [2021.07.12]Android系统广播机制(Broadcast Receiver)

    广播(Broadcast)是一种在组件之间进行消息传递的方式.这些组件可以运行在同一个进程中,也可以在不同的进程中.事实上,广播机制就是在Binder进程间通信的基础上实现的.那么,有了Binder通 ...

  2. Ubuntu下载安装EDB1.3.0 2021.07

    Ubuntu16.04x64下载安装EDB1.3.0 2021.07 1.更新gcc和g++ > 7 $ sudo add-apt-repository ppa:ubuntu-toolchain ...

  3. 2021.07.16【普及组】模拟赛C组

    2021.07.16[普及组]模拟赛C组 文章目录 2021.07.16[普及组]模拟赛C组 前言 花生采摘 题目 解析 代码 FBI树 题目 解析 代码 火星人 题目 解析 代码 麦森数 题目 解析 ...

  4. 2021年12月国产数据库排行榜: openGauss节节攀升拿下榜眼,GaussDB与TDSQL你争我夺各进一位

    2021年12月的国产数据库流行度排行榜已在墨天轮发布,本月共有189家数据库参与排名.为使国产数据库排名更加专业与客观,本月起,排行榜加入了三方评测.生态.专利数.论文数等新的指标.其中三方测评方面 ...

  5. 2021年12月国产数据库排行榜: openGauss节节攀升拿下榜眼,GaussDB与TDSQL你争我夺各进一位...

    点击蓝字 关注我们 2021年12月的国产数据库流行度排行榜已在墨天轮发布,本月共有189家数据库参与排名.为使国产数据库排名更加专业与客观,本月起,排行榜加入了三方评测.生态.专利数.论文数等新的指 ...

  6. GMOJ - 2021.07.20【普及组】模拟赛C组 - 排座椅(seat)、传球游戏(ball)、立体图(drawing)、间谍派遣、seek

    文章目录 luogu博客链接 GMOJ - 2021.07.20[普及组]模拟赛C组 - 排座椅(seat).传球游戏(ball).立体图(drawing).间谍派遣.seek T1 排座椅(seat ...

  7. Neovim开发环境搭建(2021.07.01)

    Neovim开发环境搭建(2021.07.01) 一.搭建环境 Ubuntu 21.04 Neovim 0.4.4 二.Neovim安装 # 下载 neovim,如遇网络问题可以采用 https:// ...

  8. 【Vegas原创】导出Excel时,如何将数字格式转为文本格式?(07.12.13 Update)

    DataGrid: Asp.Net WebForm中DataGrid导出的时候,在ItemDataBound内  if(e.Item.ItemType == ListItemType.Item ||  ...

  9. win10每次开机都会自检系统盘(非硬件故障)——解决方案2019.07.12

    win10每次开机都会自检系统盘(非硬件故障)--解决方案2019.07.12 参考文章: (1)win10每次开机都会自检系统盘(非硬件故障)--解决方案2019.07.12 (2)https:// ...

  10. 电动力学每日一题 2021/10/12

    电动力学每日一题 2021/10/12 (a) To make the EM field trapped inside a perfectly electric conducting cavity, ...

最新文章

  1. [转][android深入学习]android窗口管理机制
  2. 查询linux kafka安装目录,Linux下安装并(单节点)配置启动Kafka
  3. 解决javah生成c头文件时找不到android类库的问题
  4. 计算机主板在哪里找,台式电脑主板型号在哪里看
  5. JavaScript学习总结(二)——逻辑Not运算符详解
  6. Mybatis学习之单表增删改查
  7. java: 十六进制转八进制
  8. jQuery必知要点(一)
  9. Unity3D 场景与C# Control进行结合
  10. MySQL之语法入门与基础命令
  11. 管理信息系统(MIS)概述
  12. vim的大小写转换方法总结
  13. 2021年CKA考试真题(一)CKA考试介绍
  14. 实验一 网络侦查与网络扫描
  15. C语言从入门到入土---初识C语言
  16. Win10系统在当前文件夹下打开cmd(命令行)窗口
  17. 丝裂原活化蛋白激酶TaMPK3抑制植物对ABA的反应
  18. Premier Bob的算法模板库(II)
  19. Seq2Seq模型及Attention机制
  20. html手机端一键复制,一键粘贴复制功能-兼容IE9+及其移动端-clipboard.js

热门文章

  1. ubuntu 打开ssh登陆_Ubuntu 开启远程登录 SSH 的安装和配置
  2. Java游戏地下城_地下城与勇士DNF-鬼剑士
  3. Py之configobj:configobj的简介、安装、使用方法之详细攻略
  4. 成功解决softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be
  5. ML之回归预测:利用九大类机器学习算法对无人驾驶汽车系统参数(2018年的data,18+2)进行回归预测值VS真实值
  6. 解密虚拟 DOM——snabbdom 核心源码解读
  7. 原生js获取css样式
  8. 数据结构实验之链表一:顺序建立链表(SDUT 2116)
  9. CentOS7修改默认运行级别
  10. 关于$_SERVER['PHP_AUTH_USER']