标题 简介 类型 公开时间
关联规则 关联知识 关联工具 关联文档 关联抓包
参考1(官网)
参考2
参考3
详情
[SAFE-ID: JIWO-2020-2694]   作者: future 发表于: [2020-06-11]

本文共 [17] 位读者顶过

#!/usr/bash/env python3
# -*- coding:utf-8 -*-
#Author:later_future
#程序设计目的:部分CTF猜测是凯撒加密还要去挨个试偏移位数着实麻烦,想着直接都输出一下[出自:jiwo.org]
#百度说凯撒密码是不区分大小写的,这里就不对输出进行进行大写或小写的整理了
flag=""
miwen=input("请输入密文:")
pianyi=input("请输入偏移位数,如不指定全部输出")
if pianyi!="":
    for i in miwen:
        a=ord(i)
        if (a>=65 and a<=90):
            c=ord(i)+int(pianyi)
            if c>90:
                c=c-26
                temp=chr(c)
                flag+=temp
            else:
                temp=chr(c)
                flag+=temp
        if (a>=97 and a<=122):
            c=ord(i)+int(pianyi)
            if c>122:
                c=c-26
                temp=chr(c)
                flag+=temp
            else:
                temp=chr(c)
                flag+=temp          
    print(flag)
if pianyi=="":
    for gaoshi in range (1,27):
        flag=""
        for i in miwen:
            a=ord(i)
            if (a>=65 and a<=90):
                c=ord(i)+int(gaoshi)
                if c>90:
                    c=c-26
                    temp=chr(c)
                    flag+=temp
                else:
                    temp=chr(c)
                    flag+=temp
            if (a>=97 and a<=122):
                c=ord(i)+int(gaoshi)
                if c>122:
                    c=c-26
                    temp=chr(c)
                    flag+=temp
                else:
                    temp=chr(c)
                    flag+=temp
        print("偏移位数为%d,输出结果为%s" %(gaoshi,flag))
        
        
    

评论

暂无
发表评论
 返回顶部 
热度(17)
 关注微信