CTF百密一疏——凯撒密码

题目:大概就是这样吧,不能告诉你再多了。。
U8Y]:8KdJHTXRI>XU#?!K_ecJH]kJG*bRH7YJH7YSH]=93dVZ3^S8:8"&:9U]RH;g=8Y!U92'=j*KH]ZSj&[S#!gU#*dK9.
分析:凯撒移位密码。发现字符串中有单引号双引号,不好用C,C++,于是想到python,用三个引号括起来。ASCII码有128个,十进制0到127。但是一般的只是用33-126,因为其他的都不是单个字符,见ASCII表,http://www.96yx.com/tool/ASC2.htm
以下代码参考网上大神的,但个人把第6行取余改成了128而不是127,不过对于这道题,取余127也没什么问题,因为ASCII码127取余之后作为127和0都是一类的,即不属于33-126,不与考虑,所以也不影响。

>>>str='''U8Y]:8KdJHTXRI>XU#?!K_ecJH]kJG*bRH7YJH7YSH]*=93dVZ3^S8*$:8"&:9U]RH;g=8Y!U92'=j*$KH]ZSj&[S#!gU#*dK9\.'''
>>> for p in range(127):
    str1=''
    for i in str:
        temp=chr((ord(i)+p)%128)
        if 32127:
            str1+=temp
            flag=1
        else:
            flag=0
            break
    if flag==1:
        print(str1)

for p in range(127):p从0-126,移位了所有的情况,因为后面有取余,所以移动是循环的
str1=”先是空字符,后面若合要求再添加
temp=chr((ord(i)+p)%128)取余总个数128
if flag==1:只要有非33-126的字符就不考虑了,不然就可以输出

得到:

U8Y]:8KdJHTXRI>XU#?!K_ecJH]kJG*bRH7YJH7YSH]*=93dVZ3^S8*$:8"&:9U]RH;g=8Y!U92'=j*$KH]ZSj&[S#!gU#*dK9\.
V9Z^;9LeKIUYSJ?YV$@"L`fdKI^lKH+cSI8ZKI8ZTI^+>:4eW[4_T9+%;9#';:V^SI9Z"V:3(>k+%LI^[Tk'\T$"hV$+eL:]/
W:[_<:MfLJVZTK@ZW%A#MageLJ_mLI,dTJ9[LJ9[UJ_,?;5fX\5`U:,&<:$(<;W_TJ=i?:[#W;4)?l,&MJ_\Ul(]U%#iW%,fM;^0
X;\`=;NgMKW[ULA[X&B$NbhfMK`nMJ-eUK:\MK:\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GFbj_UHtJEf.bF?4Jw71XUjg`w3h`0.tb07qXFi;
cFgkHFYrXVbf`WLfc1M/YmsqXVkyXU8p`VEgXVEgaVk8KGArdhAlaF82HF04HGck`VIuKFg/cG@5Kx82YVkhax4ia1/uc18rYGj<
dGhlIGZsYWcgaXMgd2N0ZntrYWlzYV9qaWFhYWFhbWl9LHBseiBmbG93IG15IHdlaWJvLGh0dHA6Ly93ZWliby5jb20vd29sZHk=
eHimJH[tZXdhbYNhe3O1[ousZXm{ZW:rbXGiZXGicXm:MICtfjCncH:4JH26JIembXKwMHi1eIB7Mz:4[Xmjcz6kc31we3:t[Il>
fIjnKI\u[YeicZOif4P2\pvt[Yn|[X;scYHj[YHjdYn;NJDugkDodI;5KI37KJfncYLxNIj2fJC8N{;5\Ynkd{7ld42xf4;u\Jm?
gJkoLJ]v\Zfjd[Pjg5Q3]qwu\Zo}\Y\ZIkeZo]Zole|8me53yg5]Kn@
hKlpMK^w][gke\Qkh6R4^rxv][p~]Z=ue[Jl][Jlf[p=PLFwimFqfK=7MK59MLhpe[NzPKl4hLE:P}=7^[pmf}9nf64zh6=w^LoA

倒数第五行

dGhlIGZsYWcgaXMgd2N0ZntrYWlzYV9qaWFhYWFhbWl9LHBseiBmbG93IG15IHdlaWJvLGh0dHA6Ly93ZWliby5jb20vd29sZHk=

发现是Base64密文,(“=”结尾)用万能转化器converter进行转化,Base64 to text:
The flag is wctf{kaisa_jiaaaaami},plz flow my weibo,http://weibo.com/woldy,得到答案

你可能感兴趣的:(CTF)