zoukankan      html  css  js  c++  java
  • 攻防世界-密码学-sherlock

    1. 题目信息

    附件是网页上的一篇文章,先复制到txt中保存。

    2. 分析

    如下是文章开头:

    (additional editing by jose menendeZ)
    
    thE adventuRes Of
    sherlOck holmes
    
    by
    
    sir arthur coNan doylE
    

    奇怪之处是有些位置不应该使用大写字母,但是使用了大写字母,推断这些大写字母是用来传递消息的。将文章中的所有大写字母提取出来,得到一串全部由ZERO与ONE组成的字符串,ZERO替换为数字0,ONE替换为数字1,从而得到一个二进制表示的数,再将此数转换为字符串即可。

    3. 解题

    Python代码如下:

    from string import uppercase
    from Crypto.Util.number import long_to_bytes
    
    def solve():
        with open('paper','r') as f:
            data=f.read()
        cip=''
        for c in data:
            if c in uppercase:
                cip+=c
        cip=cip.replace('ZERO','0')
        cip=cip.replace('ONE','1')
        return long_to_bytes(long(cip,2))
    
    if __name__=='__main__':
        print solve()
    

    程序运行结果如下:

    $ python solve.py
    BITSCTF{h1d3_1n_pl41n_5173}
    
  • 相关阅读:
    MySQL 必知必会学习笔记
    jemter 之cookies管理器
    linux shell通配符、元字符、转义符
    linux cut 、awk、grep、sed
    shell脚本的执行方式
    shell概述
    linux 查看用户常用命令
    linux的挂载命令
    linux关机和重启命令
    linux常用压缩格式
  • 原文地址:https://www.cnblogs.com/coming1890/p/13498359.html
Copyright © 2011-2022 走看看