NSSCTF刷题wp——常用编码

NSSCTF Crypto 探索

常用编码

前两个题ID303,287在入门时做过了,详见另一篇wp链接

[AFCTF 2018]BASE ID:463

打开文件直接麻了,如果人工解码,估计黄花菜都要凉了,这就需要用到拥有强大数据处理能力的python了,下面是我借鉴得几个大佬的脚本。

首先是大佬xenny的,NSSCTF这个题的wp也有

import re, base64
s = open('/Users/x3nny/Downloads/flag_encode.txt', 'rb').read()
base16_dic = r'^[A-F0-9=]*$'
base32_dic = r'^[A-Z2-7=]*$'
base64_dic = r'^[A-Za-z0-9/+=]*$'
n= 0
while True:
    n += 1
    t = s.decode()
    if '{' in t:
        print(t)
        break
    elif re.match(base16_dic, t):
        s = base64.b16decode(s)
        print(str(n) + ' base16')
    elif re.match(base32_dic, t):
        s = base64.b32decode(s)
        print(str(n) + ' base32')
    elif re.match(base64_dic, t):
        s = base64.b64decode(s)
        print(str(n) + ' base64')

请添加图片描述

然后是看到另一个博主的脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值