ctf-BugkuCTF-crypto
1.滴答~滴
很容易看出这是摩斯加密,直接解密即可,注意格式
#encode=utf-8
s='-... -.- -.-. - ..-. -- .. ... -.-. '
codebook = {
'A':".-",'B':"-...",'C':"-.-.",'D':"-..",'E':".",'F':"..-.",'G':"--.",'H':"....",'I':"..",'J':".---",'K':"-.-",'L':".-..",'M':"--",'N':"-.",'O':"---",'P':".--.",'Q':"--.-",'R':".-.",'S':"...",'T':"-",'U':"..-",'V':".--",'W':".--",'X':"-..-",'Y':"-.--",'Z':"--..",'1':".----",'2':"..---",'3':"...--",'4':"....-",'5':".....",'6':"-....",'7':"--...",'8':"---..",'9':"----.",'0':"-----",'.':".━.━.━",'?':"..--..",'!':"-.-.--",'(':"-.--.",'@':".--.-.",':':"---...",'=':"-...-",'-':"-....-",')':"-.--.-",'+':".-.-.",',':"--..--",'\'':".----.",'_':"..--.-",'$':"...-..-",';':"-.-.-.",'/':"-..-.",'\"':".-..-.",'&':"...."
}
cipher=""
ss = s.split(" ")
for c in ss:
for k in codebook.keys():
if codebook[k] == c:
cipher+=k
break
else:
cipher+=c
print(cipher)
2.聪明的小羊
栅栏加密,根据开头位key可知是以8个字符来分段
miwen="KYsd3js2E{a2jda}"
str1=""
for i in xrange(0,8):
k=0
while k*8+i<len(miwen):
str1+=miwen[k*8+i]
k+=1
print str1
3.ok
Ook解密,直接在https://www.splitbrain.org/services/ook在线解密即可
4.这不是摩斯密码
打开文件,是Brainfuck加密,在https://www.splitbrain.org/services/ook在线解密即可
5.简单加密
看题中字符毫无规律,但字符又可见,猜测可能是ascii的移位加密,尝试未发现比较流畅的句子,却发现比较像base64加密后的字符串,拿去解密发现答案
miwen="e6Z9i~]8R~U~QHE{RnY{QXg~QnQ{^XVlRXlp^XI5Q6Q6SKY8jUAA"
mingwen=""
sign=True
for j in xrange(1,256):
for i in miwen:
mingwen=mingwen+chr((ord(i)+j)%128)
for i in mingwen:
if ord(i)>126 or ord(i)<33:
sign=False
break
if sign:
print mingwen
print j
mingwen=""
sign=True
6.一段Base64
打开根据题意,应该会用base64解码,于是打开文件,看到结尾的“==”,于是将其中的字符复制出来进行base64解码,得到结果如图:
看到这样编码的形式,使用js的unescape解码,在网页控制台输入console.log(unescape("\....“))得到结果:
将16进制ascii码转为字符,在网页控制台输入console.log("\x.....")得到结果结果如图所示
明显是unicode编码,在网页控制台输入console.log("\u.....")得到结果结果如图所示
由提示可知是10进制ascii码转为字符
s="38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,48,59,38,35,120,51,50,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,48,59,38,35,120,51,56,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,57,59,38,35,120,51,55,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,48,59,38,35,120,51,51,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,51,59,38,35,120,51,55,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,53,59,38,35,120,51,53,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,54,59,38,35,120,51,54,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,57,59,38,35,120,51,57,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,49,59,38,35,120,51,54,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,48,59,38,35,120,51,50,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,57,59,38,35,120,51,53,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,49,59,38,35,120,51,54,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,48,59,38,35,120,51,50,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,57,59,38,35,120,51,57,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,53,59,38,35,120,51,48,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,52,59,38,35,120,51,56,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,52,59,38,35,120,51,57,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,53,59,38,35,120,51,53,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,52,59,38,35,120,51,57,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,53,59,38,35,120,51,53,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,49,59,38,35,120,51,51,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,49,59,38,35,120,51,57,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,49,59,38,35,120,51,48,59,38,35,120,51,49,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,51,59,38,35,120,51,55,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,53,59,38,35,120,51,53,59,38,35,120,51,98,59,38,35,120,50,54,59,38,35,120,50,51,59,38,35,120,51,54,59,38,35,120,51,56,59,38,35,120,51,98,59"
list1=s.split(",")
str1=""
for i in list1:
str1+=chr(int(i))
print str1
可获得 &#x开头的字符串,将&#x删除只留下16进制ascii,再转化为字符串
s="&#102;&#108;&#97;&#103;&#37;&#55;&#66;&#99;&#116;&#102;&#95;&#116;&#102;&#99;&#50;&#48;&#49;&#55;&#49;&#55;&#113;&#119;&#101;&#37;&#55;&#68;"
str1=""
list1=s.split(";")
for i in list1:
str1+=chr(int(i[3:5],16))
print str1
可获得 &#开头的字符串,将&#删除只留下10进制ascii,再转化为字符串flag%7Bctf_tfc201717qwe%7D,再使用urldecode解码可得结果
7..!?
Ook解密,直接在https://www.splitbrain.org/services/ook在线解密即可
8.+[]-
Brainfuck加密,在https://www.splitbrain.org/services/ook在线解密即可
9.
仔细看题,我们获得密文,**还有一个加密规则,加密规则的编号应该是和**的数字相关,应该是将密文加密后放在**对应的那一行上,而每一行的字符前后都有“<",且中间由26个字母随机组成的字符,猜测是移位加密,只不过不是按照正常字母顺序加密,而是根据给定字母顺序加密,
list1=["ZWAXJGDLUBVIQHKYPNTCRMOSFE","KPBELNACZDTRXMJQOYHGVSFUWI","BDMAIZVRNSJUWFHTEQGYXPLOCK","RPLNDVHGFCUKTEBSXQYIZMJWAO","IHFRLABEUOTSGJVDKCPMNZQWXY","AMKGHIWPNYCJBFZDRUSLOQXVET","GWTHSPYBXIZULVKMRAFDCEONJQ","NOZUTWDCVRJLXKISEFAPMYGHBQ","QWATDSRFHENYVUBMCOIKZGJXPL","WABMCXPLTDSRJQZGOIKFHENYVU","XPLTDAOIKFZGHENYSRUBMCQWVJ","TDSWAYXPLVUBOIKZGJRFHENMCQ","BMCSRFHLTDENQWAOXPYVUIKZGJ","XPHKZGJTDSENYVUBMLAOIRFCQW"]
minlist=[]
key=[2,5,1,3,6,4,9,7,8,14,10,13,11,12]
minstr="HCBTSXWCRQGLES"
i=0
#根据key调整规则字母顺序和规则顺序以便做移位解密
while i<14:
j=list1[(key[i]-1)].find(minstr[i])
str2=list1[(key[i]-1)][j:]+list1[(key[i]-1)][:j]
minlist.append(str2)
i=i+1
i=0
str1=""
#将移位的所有情况输出
while i<len(minlist[0]):
for j in minlist:
str1+=j[i]
print str1
str1=""
i=i+1
str1=""
可在其中找到一条相对通顺的句子即为答案
10.告诉你个秘密
题目给了一串16进制的数,尝试移位解密,失败,但发现直接转出的字符串由常见字符组成,且长度为48,猜测是不是base64解密,尝试得到r5yG lp9I BjM tFhBT6uh y7iJ QsZ bhM,看一下键盘,发现键盘加密,解密得到结果
11.来自宇宙的信号
找到密码表即可解出,找不到那只能凉凉了(附密码表)
下一篇: php GD库上传图片并创建缩略图的代码
推荐阅读