Lab0 of CTF
Lab0
1.1 Challange1
在kali-linux-2023上进行
1.1.1 路径相关命令
cd filename
cd .. #上一级路径
cd ~ #home
cd . #当前路径
1.1.2 文件目录操作命令
ls -a #列出所有文件和目录
ls -l #列出详细信息
touch file #创建文件
mkdir dir #创建目录
1.1.3 文件内容查看命令
cat file
head -n lines file #显示前lines行
tail -n lines file #显示后lines行
1.1.4 其他命令
whoami #获取当前用户
date #获取当前时间
ps #显示进程信息
1.2 challenge2
1.2.1 解释代码
#!/usr/bin/python3
data = input("give me your string: ") #data存储输入
print("length of string:", len(data)) #输出data长度
data_old = data #存储未更新的data
data_new = ""
for d in data:
if d in 'abcdefghijklmnopqrstuvwxyz': #大小写互换后存入data_new
data_new += chr(ord(d) - 32)
elif d in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
data_new += chr(ord(d) + 32)
else:
data_new += d #非字母不修改
print("now your string:", data_new) #输出结果
1.2.2calculator
import socket
lPOST = '10.214.160.13'
rHOST = 11002
client_socket = socket.socket()
client_socket.connect((lPOST, rHOST))
while 1:
data1 = client_socket.recv(1024)
data2 = client_socket.recv(1024)
print(data1)
print(data2)
new_data = data2[:-2]
print(new_data)
client_socket.send((format(eval(new_data))+'\n').encode())
print(format(eval(new_data)).encode())
AAA{melody_loves_doing_calculus_qq_qun_386796080}
2.1 Crypto
for i in range(4):
for j in range(4):
result[i][j] = s[i][j] ^ k[i][j]
for i in range(4):
for j in range(4):
result[i][j] = inv_s_box[s[i][j]]
AAA{AE5_aEs_a1s}
3.1 Misc
AAA{wELCOm3_7o_CTf_5umMeR_c0uR5E_2023}
AAA{gr3@t_J08!_1et’5_P1@y_m1S C_TOG3Th3R}
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.