Crypto
滴答~滴
-... -.- -.-. - ..-. -- .. ... -.-.
答案格式KEY{xxxxxxxxx}
————————————
摩斯密码,直接解密得到flag:
KEY{bkctfmisc}
聪明的小羊
一只小羊翻过了2个栅栏
KYsd3js2E{a2jda}
————————————
根据题目提示,密码为栅栏密码,直接解密得到flag:
KEY{sad23jjdsa2}
ok
内容是一大堆Ook!Ook?
————————————
是OOK!混淆/编码,直接解码
解密网址
得到flag:
flag{ok-ctf-1234-admin}
这不是摩斯密码
————————————
这个是 brainfuck ,直接解码
[解密网址]([https://www.splitbrain.org/services/ook]
得到flag:
flag{ok-c2tf-3389-admin}
easy_crypto
0010 0100 01 110 1111011 11 11111 010 000 0 001101 1010 111 100 0 001101 01111 000 001101 00 10 1 0 010 0 000 1 01111 10 11110 101011 1111101
————————————
看着有点像二进制,但这个其实是摩斯密码的另一种表现形式,写个python脚本转换成标准的摩斯:
c = '0010 0100 01 110 1111011 11 11111 010 000 0 001101 1010 111 100 0 001101 01111 000 001101 00 10 1 0 010 0 000 1 01111 10 11110 101011 1111101'
cipher = ''
for i in range(len(c)):
if c[i] == '0':
cipher += '.'
elif c[i] == '1':
cipher += '-'
else:
cipher += ' '
print cipher
解密后得到flag:
flag{m0rse_code_1s_interest1n9!}
简单加密
e6Z9i~]8R~U~QHE{RnY{QXg~QnQ{^XVlRXlp^XI5Q6Q6SKY8jUAA
————————————
提示是简单加密再加上末尾的AA引起了我的怀疑,猜测是base64,写python脚本解码:
import base64
c1 = 'e6Z9i~]8R~U~QHE{RnY{QXg~QnQ{^XVlRXlp^XI5Q6Q6SKY8jUAA'
cipher = ''
for i in range(len(c1)):
cipher += chr(ord(c1[i])-4)
pt = base64.b64decode(cipher)
print(pt)
得到flag:
key{68743000650173230e4a58ee153c68e8}
散乱的密文
lf5{ag024c483549d7fd@@1}
一张纸条上凌乱的写着2 1 6 5 3 4
————————————
一眼就可以看到 flag 字样只是按照数字打乱了,排序:
2 1 6 5 3 4
l f 5 { a g
0 2 4 c 4 8
3 5 4 9 d 7
f d @ @ 1 }
得到flag(这里的@只是为了凑整):
flag{52048c453d794df1}
凯撒部长的奖励
就在8月,超师傅出色地完成了上级的特遣任务,凯撒部长准备给超师傅一份特殊的奖励,兴高采烈的超师傅却只收到一长串莫名的密文,超师傅看到英语字串便满脸黑线,帮他拿到这份价值不菲的奖励吧。 密文:MSW{byly_Cm_sIol_lYqUlx_yhdIs_Cn_Wuymul_il_wuff_bcg_pCwnIl_cm_u_Yrwyffyhn_guh_cz_sio_quhn_ni_ayn_bcm_chzilguncihm_sio_wuh_dich_om}
————————————
根据题目提示是凯撒密码,用 CTFtools 解密:
得到flag:
SYC{here_Is_yOur_rEwArd_enjOy_It_Caesar_or_call_him_vIctOr_is_a_Excellent_man_if_you_want_to_get_his_informations_you_can_join_us}
一段Base64
密文实在太长了就不贴出来了,在Converter 里解密的顺序是 Base64 to Text --> Unescape --> Dec to Text --> Hex to Text --> Unescape --> (把括号里的)Dec to Text --> Decode HTML --> Decode HTML --> flag%7Bctf_tfc201717qwe%7D
得到flag:
flag{ctf_tfc201717qwe}
.!?
..... ..... ..... ..... !?!!. ?.... ..... ..... ..... .?.?! .?... .!...
..... ..... !.?.. ..... !?!!. ?!!!! !!?.? !.?!! !!!.. ..... ..... .!.?.
..... ...!? !!.?. ..... ..?.? !.?.. ..... .!.?. ..... ..... !?!!. ?!!!!
!!!!! !?.?! .?!.? ..... ....! ?!!.? ..... ...?. ?!.?. ..... !.?.. .....
!?!!. ?!!!! !!?.? !.?!! !!!!! !!!!. ..... ...!. ?.... ...!? !!.?. .....
?.?!. ?..!. ?.... ..... !?!!. ?!!!! !!!!? .?!.? !!!!! !!!!! !!!.? .....
..!?! !.?.. ....? .?!.? ....! .!!!. !!!!! !!!!! !!!!! !!.?. ..... .!?!!
.?... ...?. ?!.?. ..... !.!!! !!!!! !.?.. ..... ..!?! !.?.. ..... .?.?!
.?... ..... !.?.
————————————
还是Ook,解密得到flag:
flag{bugku_jiami}
+[]-
+++++ +++++ [->++ +++++ +++<] >++.+ +++++ .<+++ [->-- -<]>- -.+++ +++.<
++++[ ->+++ +<]>+ +++.< +++++ [->-- ---<] >.<++ ++[-> ++++< ]>+++ .<+++
[->-- -<]>- ----. ++++. <+++[ ->+++ <]>+. <++++ [->-- --<]> ----- -.<++
+[->+ ++<]> ++.-. ----- ---.< +++[- >+++< ]>+++ .---- .<+++ [->-- -<]>-
.<+++ +++[- >---- --<]> ----- ----. +.<++ +++++ +[->+ +++++ ++<]> +++++
+++++ .<
————————————
这个是 Brainfuck 编码,解密得到flag:
flag{bugku_jiami_23}
奇怪的密码
突然天上一道雷电
gndk€rlqhmtkwwp}z
————————————
对比一下 gdnk 和 flag ,他们的adcii码分别为 103 110 100 107 , 102 108 97 103。发现ascii码递增变化,写python脚本解密(python3):
c1 = 'gndk€rlqhmtkwwp}z'
flag = ''
for i in range(0,len(c1)):
flag += chr(ord(c1[i])-i-1)
print(flag)
得到 flag₧lei_ci_jiami
提交flag:
flag{lei_ci_jiami}
托马斯.杰斐逊
1: <ZWAXJGDLUBVIQHKYPNTCRMOSFE <
2: <KPBELNACZDTRXMJQOYHGVSFUWI <
3: <BDMAIZVRNSJUWFHTEQGYXPLOCK <
4: <RPLNDVHGFCUKTEBSXQYIZMJWAO <
5: <IHFRLABEUOTSGJVDKCPMNZQWXY <
6: <AMKGHIWPNYCJBFZDRUSLOQXVET <
7: <GWTHSPYBXIZULVKMRAFDCEONJQ <
8: <NOZUTWDCVRJLXKISEFAPMYGHBQ <
9: <QWATDSRFHENYVUBMCOIKZGJXPL <
10: <WABMCXPLTDSRJQZGOIKFHENYVU <
11: <XPLTDAOIKFZGHENYSRUBMCQWVJ <
12: <TDSWAYXPLVUBOIKZGJRFHENMCQ <
13: <BMCSRFHLTDENQWAOXPYVUIKZGJ <
14: <XPHKZGJTDSENYVUBMLAOIRFCQW <
密钥: 2,5,1,3,6,4,9,7,8,14,10,13,11,12
密文:HCBTSXWCRQGLES
flag格式 flag{你解密的内容}
————————————
这是托马斯杰斐逊 转轮加密,根据密钥排序:
2: <KPBELNACZDTRXMJQOYHGVSFUWI <
5: <IHFRLABEUOTSGJVDKCPMNZQWXY <
1: <ZWAXJGDLUBVIQHKYPNTCRMOSFE <
3: <BDMAIZVRNSJUWFHTEQGYXPLOCK <
6: <AMKGHIWPNYCJBFZDRUSLOQXVET <
4: <RPLNDVHGFCUKTEBSXQYIZMJWAO <
9: <QWATDSRFHENYVUBMCOIKZGJXPL <
7: <GWTHSPYBXIZULVKMRAFDCEONJQ <
8: <NOZUTWDCVRJLXKISEFAPMYGHBQ <
14:<XPHKZGJTDSENYVUBMLAOIRFCQW <
10:<WABMCXPLTDSRJQZGOIKFHENYVU <
13:<BMCSRFHLTDENQWAOXPYVUIKZGJ <
11:<XPLTDAOIKFZGHENYSRUBMCQWVJ <
12:<TDSWAYXPLVUBOIKZGJRFHENMCQ <
然后按照密文转动:
2: <HGVSFUWIKPBELNACZDTRXMJQOY<
5: <CPMNZQWXYIHFRLABEUOTSGJVDK<
1: <BVIQHKYPNTCRMOSFEZWAXJGDLU<
3: <TEQGYXPLOCKBDMAIZVRNSJUWFH<
6: <SLOQXVETAMKGHIWPNYCJBFZDRU<
4: <XQYIZMJWAORPLNDVHGFCUKTEBS<
9: <WATDSRFHENYVUBMCOIKZGJXPLQ<
7: <CEONJQGWTHSPYBXIZULVKMRAFD<
8: <RJLXKISEFAPMYGHBQNOZUTWDCV<
14:<QWXPHKZGJTDSENYVUBMLAOIRFC<
10:<GOIKFHENYVUWABMCXPLTDSRJQZ<
13:<LTDENQWAOXPYVUIKZGJBMCSRFH<
11:<ENYSRUBMCQWVJXPLTDAOIKFZGH<
12:<SWAYXPLVUBOIKZGJRFHENMCQTD<
发现倒数第6列有BUGKU字样,得到flag;
flag{xsxsbugkuadmin}
zip伪加密
题目给了一个zip文件
————————————
根据题目的提示,是zip伪加密,用 winhex 打开压缩包,把图中标记的 09 改为 00 :
解压得到flag:
flag{Adm1N-B2G-kU-SZIP}
告诉你个秘密(ISCCCTF)
636A56355279427363446C4A49454A7154534230526D6843
56445A31614342354E326C4B4946467A5769426961453067
————————————
十六进制转换为字符串得到:
cjV5RyBscDlJIEJqTSB0RmhCVDZ1aCB5N2lKIFFzWiBiaE0g
base64解密得到:
r5yG lp9I BjM tFhBT6uh y7iJ QsZ bhM
发现是键盘加密,如 r5yG 在键盘上圈出 T ,解密得到flag:
TONGYUAN
这不是md5
666c61677b616537333538376261353662616566357d
————————————
十六进制转字符串得到flag:
flag{ae73587ba56baef5}
贝斯家族
@iH<,{bdR2H;i6*Tm,Wx2izpx2!
————————————
根据题目提示发现居然还有 base91,base92等等,这题是 base91,解密得到flag:
flag{554a5058c9021c76}
富强民主
公正公正公正诚信文明公正民主公正法治法治友善平等和谐敬业和谐富强和谐富强和谐文明和谐平等公正公正和谐法治公正公正公正文明和谐民主和谐敬业和谐平等和谐敬业和谐敬业和谐和谐和谐公正法治友善法治
————————————
非常有趣的加密,这个是核心价值观编码,解密链接放在下面:
核心价值观编码
解密得到flag:
flag{90025f7fb1959936}
python(N1CTF)
challenge.py
from N1ES import N1ES
import base64
key = "wxy191iss00000000000cute"
n1es = N1ES(key)
flag = "N1CTF{*****************************************}"
cipher = n1es.encrypt(flag)
print base64.b64encode(cipher) # HRlgC2ReHW1/WRk2DikfNBo1dl1XZBJrRR9qECMNOjNHDktBJSxcI1hZIz07YjVx
N1ES.py
# -*- coding: utf-8 -*-
def round_add(a, b):
f = lambda x, y: x + y - 2 * (x & y)
res = ''
for i in range(len(a)):
res += chr(f(ord(a[i]), ord(b[i])))
return res
def permutate(table, block):
return list(map(lambda x: block[x], table))
def string_to_bits(data):
data = [ord(c) for c in data]
l = len(data) * 8
result = [0] * l
pos = 0
for ch in data:
for i in range(0,8):
result[(pos<<3)+i] = (ch>>i) & 1
pos += 1
return result
s_box = [54, 132, 138, 83, 16, 73, 187, 84, 146, 30, 95, 21, 148, 63, 65, 189, 188, 151, 72, 161, 116, 63, 161, 91, 37, 24, 126, 107, 87, 30, 117, 185, 98, 90, 0, 42, 140, 70, 86, 0, 42, 150, 54, 22, 144, 153, 36, 90, 149, 54, 156, 8, 59, 40, 110, 56,1, 84, 103, 22, 65, 17, 190, 41, 99, 151, 119, 124, 68, 17, 166, 125, 95, 65, 105, 133, 49, 19, 138, 29, 110, 7, 81, 134, 70, 87, 180, 78, 175, 108, 26, 121, 74, 29, 68, 162, 142, 177, 143, 86, 129, 101, 117, 41, 57, 34, 177, 103, 61, 135, 191, 74, 69, 147, 90, 49, 135, 124, 106, 19, 89, 38, 21, 41, 17, 155, 83, 38, 159, 179, 19, 157, 68, 105, 151, 166, 171, 122, 179, 114, 52, 183, 89, 107, 113, 65, 161, 141, 18, 121, 95, 4, 95, 101, 81, 156, 17, 190, 38, 84, 9, 171, 180, 59, 45, 15, 34, 89, 75, 164, 190, 140, 6, 41, 188, 77, 165, 105, 5, 107, 31, 183, 107, 141, 66, 63, 10, 9, 125, 50, 2, 153, 156, 162, 186, 76, 158, 153, 117, 9, 77, 156, 11, 145, 12, 169, 52, 57, 161, 7, 158, 110, 191, 43, 82, 186, 49, 102, 166, 31, 41, 5, 189, 27]
def generate(o):
k = permutate(s_box,o)
b = []
for i in range(0, len(k), 7):
b.append(k[i:i+7] + [1])
c = []
for i in range(32):
pos = 0
x = 0
for j in b[i]:
x += (j<<pos)
pos += 1
c.append((0x10001**x) % (0x7f))
return c
class N1ES:
def __init__(self, key):
if (len(key) != 24 or isinstance(key, bytes) == False ):
raise Exception("key must be 24 bytes long")
self.key = key
self.gen_subkey()
def gen_subkey(self):
o = string_to_bits(self.key)
k = []
for i in range(8):
o = generate(o)
k.extend(o)
o = string_to_bits([chr(c) for c in o[0:24]])
self.Kn = []
for i in range(32):
self.Kn.append(map(chr, k[i * 8: i * 8 + 8]))
return
def encrypt(self, plaintext):
if (len(plaintext) % 16 != 0 or isinstance(plaintext, bytes) == False):
raise Exception("plaintext must be a multiple of 16 in length")
res = ''
for i in range(len(plaintext) / 16):
block = plaintext[i * 16:(i + 1) * 16]
L = block[:8]
R = block[8:]
for round_cnt in range(32):
L, R = R, (round_add(L, self.Kn[round_cnt]))
L, R = R, L
res += L + R
return res
————————————
经过观察算法
解密脚本:
# -*- coding: utf-8 -*-
import base64
def round_add(a, b):
f = lambda x, y: x + y - 2 * (x & y)
res = ''
for i in range(len(a)):
res += chr(f(ord(a[i]), ord(b[i])))
return res
def permutate(table, block):
return list(map(lambda x: block[x], table))
def string_to_bits(data):
data = [ord(c) for c in data]
l = len(data) * 8
result = [0] * l
pos = 0
for ch in data:
for i in range(0,8):
result[(pos<<3)+i] = (ch>>i) & 1
pos += 1
return result
s_box = [54, 132, 138, 83, 16, 73, 187, 84, 146, 30, 95, 21, 148, 63, 65, 189, 188, 151, 72, 161, 116, 63, 161, 91, 37, 24, 126, 107, 87, 30, 117, 185, 98, 90, 0, 42, 140, 70, 86, 0, 42, 150, 54, 22, 144, 153, 36, 90, 149, 54, 156, 8, 59, 40, 110, 56,1, 84, 103, 22, 65, 17, 190, 41, 99, 151, 119, 124, 68, 17, 166, 125, 95, 65, 105, 133, 49, 19, 138, 29, 110, 7, 81, 134, 70, 87, 180, 78, 175, 108, 26, 121, 74, 29, 68, 162, 142, 177, 143, 86, 129, 101, 117, 41, 57, 34, 177, 103, 61, 135, 191, 74, 69, 147, 90, 49, 135, 124, 106, 19, 89, 38, 21, 41, 17, 155, 83, 38, 159, 179, 19, 157, 68, 105, 151, 166, 171, 122, 179, 114, 52, 183, 89, 107, 113, 65, 161, 141, 18, 121, 95, 4, 95, 101, 81, 156, 17, 190, 38, 84, 9, 171, 180, 59, 45, 15, 34, 89, 75, 164, 190, 140, 6, 41, 188, 77, 165, 105, 5, 107, 31, 183, 107, 141, 66, 63, 10, 9, 125, 50, 2, 153, 156, 162, 186, 76, 158, 153, 117, 9, 77, 156, 11, 145, 12, 169, 52, 57, 161, 7, 158, 110, 191, 43, 82, 186, 49, 102, 166, 31, 41, 5, 189, 27]
def generate(o):
k = permutate(s_box,o)
b = []
for i in range(0, len(k), 7):
b.append(k[i:i+7] + [1])
c = []
for i in range(32):
pos = 0
x = 0
for j in b[i]:
x += (j<<pos)
pos += 1
c.append((0x10001**x) % (0x7f))
return c
class N1ES:
def __init__(self, key):
if (len(key) != 24 or isinstance(key, bytes) == False ):
raise Exception("key must be 24 bytes long")
self.key = key
self.gen_subkey()
def gen_subkey(self):
o = string_to_bits(self.key)
k = []
for i in range(8):
o = generate(o)
k.extend(o)
o = string_to_bits([chr(c) for c in o[0:24]])
self.Kn = []
for i in range(32):
self.Kn.append(map(chr, k[i * 8: i * 8 + 8]))
return
def decrypt(self, plaintext):
if (len(plaintext) % 16 != 0 or isinstance(plaintext, bytes) == False):
raise Exception("plaintext must be a multiple of 16 in length")
res = ''
for i in range(len(plaintext) / 16):
block = plaintext[i * 16:(i + 1) * 16]
L = block[:8]
R = block[8:]
for round_cnt in range(32):
L, R = R, (round_add(L, self.Kn[31 - round_cnt]))
L, R = R, L
res += L + R
return res
key = "wxy191iss00000000000cute"
n1es = N1ES(key)
flag = base64.b64decode("HRlgC2ReHW1/WRk2DikfNBo1dl1XZBJrRR9qECMNOjNHDktBJSxcI1hZIz07YjVx")
flag = n1es.decrypt(flag)
print flag
解密得到flag:
N1CTF{F3istel_n3tw0rk_c4n_b3_ea5i1y_s0lv3d_/--/}
进制转换
二进制、八进制、十进制、十六进制,你能分的清吗?
来源:第七届大学生网络安全技能大赛
d87 x65 x6c x63 o157 d109 o145 b100000 d116 b1101111 o40 x6b b1100101 b1101100 o141 d105 x62 d101 b1101001 d46 o40 d71 x69 d118 x65 x20 b1111001 o157 b1110101 d32 o141 d32 d102 o154 x61 x67 b100000 o141 d115 b100000 b1100001 d32 x67 o151 x66 d116 b101110 b100000 d32 d102 d108 d97 o147 d123 x31 b1100101 b110100 d98 d102 b111000 d49 b1100001 d54 b110011 x39 o64 o144 o145 d53 x61 b1100010 b1100011 o60 d48 o65 b1100001 x63 b110110 d101 o63 b111001 d97 d51 o70 d55 b1100010 d125 x20 b101110 x20 b1001000 d97 d118 o145 x20 d97 o40 d103 d111 d111 x64 d32 o164 b1101001 x6d o145 x7e
————————————
写出脚本转换进制:
import binascii
txt = 'd87 x65 x6c x63 o157 d109 o145 b100000 d116 b1101111 o40 x6b b1100101 b1101100 o141 d105 x62 d101 b1101001 d46 o40 d71 x69 d118 x65 x20 b1111001 o157 b1110101 d32 o141 d32 d102 o154 x61 x67 b100000 o141 d115 b100000 b1100001 d32 x67 o151 x66 d116 b101110 b100000 d32 d102 d108 d97 o147 d123 x31 b1100101 b110100 d98 d102 b111000 d49 b1100001 d54 b110011 x39 o64 o144 o145 d53 x61 b1100010 b1100011 o60 d48 o65 b1100001 x63 b110110 d101 o63 b111001 d97 d51 o70 d55 b1100010 d125 x20 b101110 x20 b1001000 d97 d118 o145 x20 d97 o40 d103 d111 d111 x64 d32 o164 b1101001 x6d o145 x7e'
list = txt.split(" ")
list1 = []
for i in list:
if i[0] == 'd':
list1.append(hex(int(i[1:])))
elif i[0] == 'x':
list1.append('0'+i)
elif i[0] == 'o':
list1.append(hex(int(i[1:],8)))
elif i[0] == 'b':
list1.append(hex(int(i[1:],2)))
p = ''
for j in list1:
p += j[2:]
print binascii.a2b_hex(p)
得到flag:
flag{1e4bf81a6394de5abc005ac6e39a387b}
affine
y = 17x-8 flag{szzyfimhyzd}
————————————
affine是仿射密码,是一种单一字母替换密码,简单的说就是把明文字母赋值后利用简单的数学公式加密成另一个值,得到密文,脚本解密:
list = 'abcdefghijklmnopqrstuvwxyz'
newlist = ''
for i in range(len(list)):
newlist += list[(17 * i - 8) % 26]
y = 'szzyfimhyzd'
x = ''
for j in y:
x += list[newlist.find(j)]
print('flag{' + x + '}')
得到flag:
flag{affineshift}
Crack it
给了一个名叫 shadow 的文件
破解该文件,获得密码,flag格式为:flag{*}
————————————
这是一个Linuxshadow文件,可以用Kali系统中的john工具爆破:
得到flag:
hellokitty
rsa
N : 460657813884289609896372056585544172485318117026246263899744329237492701820627219556007788200590119136173895989001382151536006853823326382892363143604314518686388786002989248800814861248595075326277099645338694977097459168530898776007293695728101976069423971696524237755227187061418202849911479124793990722597
e : 354611102441307572056572181827925899198345350228753730931089393275463916544456626894245415096107834465778409532373187125318554614722599301791528916212839368121066035541008808261534500586023652767712271625785204280964688004680328300124849680477105302519377370092578107827116821391826210972320377614967547827619
enc : 38230991316229399651823567590692301060044620412191737764632384680546256228451518238842965221394711848337832459443844446889468362154188214840736744657885858943810177675871991111466653158257191139605699916347308294995664530280816850482740530602254559123759121106338359220242637775919026933563326069449424391192
————————————
在e特别大的情况下,可以直接使用RsaCtfTool计算私钥:
得到了RSA的 c, n, d 就可以直接求解了:
from Crypto.Util.number import long_to_bytes
c = 38230991316229399651823567590692301060044620412191737764632384680546256228451518238842965221394711848337832459443844446889468362154188214840736744657885858943810177675871991111466653158257191139605699916347308294995664530280816850482740530602254559123759121106338359220242637775919026933563326069449424391192
d = 8264667972294275017293339772371783322168822149471976834221082393409363691895
n = 460657813884289609896372056585544172485318117026246263899744329237492701820627219556007788200590119136173895989001382151536006853823326382892363143604314518686388786002989248800814861248595075326277099645338694977097459168530898776007293695728101976069423971696524237755227187061418202849911479124793990722597
flag = long_to_bytes(pow(c, d, n))
print flag
得到flag;
flag{Wien3r_4tt@ck_1s_3AsY}
来自宇宙的信号
银河战队出击
flag格式 flag{字母小写}
————————————
这是一种叫银河标准字母的暗号,网上搜索一下就能找到:
对比得到flag:
flag{nopqrst}