2022_领航杯_Crypto-1
Tags:凯撒位移
,Base64
0x01. 题目
The flag is here:
tata mb xwhvxw mlnX sTRtI4JNqEfuaa7LnT5MyJVA046GnTRt54Twg9UAd4JtyXLNUF6E :xkxa lb ztey xaH
0x02. WP
先对密文进行倒序重排,根据提示发现大写字母T
->H
偏移量为-12
,小写字母h
->a
偏移量为-7
,数字偏移量不详
import base64
sCipher="tata mb xwhvxw mlnX sTRtI4JNqEfuaa7LnT5MyJVA046GnTRt54Twg9UAd4JtyXLNUF6E :xkxa lb ztey xaH"
tCiper=''.join(reversed(sCipher))
print(tCiper)
# Hax yetz bl axkx: E6FUNLXytJ4dAU9gwT45tRTnG640AVJyM5TnL7aaufEqNJ4ItRTs Xnlm wxvhwx bm atat
fs1=""
for c in tCiper:
if c.islower():
# 小写字母+7
t=ord(c)+7
if t>ord('z'):
t=t-26
fs1+=chr(t)
elif c.isupper():
# 大写字母+12
t=ord(c)+12
if t>ord('Z'):
t=t-26
fs1+=chr(t)
else:
fs1+=c
print(fs1)
# The flag is here: Q6RGZXJfaV4kMG9ndF45aDFuS640MHVfY5FuX7hhbmQxZV4UaDFz Just decode it haha
# 对数字偏移量进行爆破后Base64解码
for i in range(10):
fs2=''
for c in fs1:
if c.isdigit():
t=ord(c)+i
if t>ord('9'):
t=t-10
fs2+=chr(t)
else:
fs2+=c
print(base64.b64decode(fs2[fs2.find("Q"):fs2.find("z")+1]))
'''
b'C\xa4Fer_i^$0ogt^9h1nK\xae40u_c\x91n_\xb8and1e^\x14h1s'
b"C\xb4Fer_i^d0m't^zh1nK\xbeu0u_c\xa1n_\xc8and1e^Th1s"
b'C\xc4Fer_i^\xa40mgt^\xbbh1nK\xce\xb60u_c\xb1n_\xd8and1e^\x94h1s'
b'C\xd4Fer_i^\xe40m\xa7t^\xfch1nK\xde\xf70u_c\xc1n_Hand1e^\xd4h1s'
b'CDFer_i_$0m\xe7t_=h1nKO80u_c\xd1n_Xand1e_\x14h1s'
b"CTFer_i_d0n't_th1nK_y0u_cAn_hand1e_Th1s"
b'CdFer_i]$0ngt]5h1nKm:0u_cQn_xand1e]\x14h1s'
b'CtFer_i]d0n\xa7t]vh1nK}{0u_can_\x88and1e]Th1s'
b'C\x84Fer_i]\xa40n\xe7t]\xb7h1nK\x8d\xbc0u_cqn_\x98and1e]\x94h1s'
b"C\x94Fer_i]\xe40o't]\xf8h1nK\x9d\xfd0u_c\x81n_\xa8and1e]\xd4h1s"
'''
最终得到flag
为CTFer_i_d0n't_th1nK_y0u_cAn_hand1e_Th1s