网络安全技术期末考试
网络安全技术期末考试
理论部分
第一章 绪论
- 网络安全的三要素(CIA)
次要的属性:不可否认性、可靠性、可信性。
第二章 密码学基础知识
-
柯克霍夫原则
-
古典密码体制
-
单钥密码体制的基本原理(了解)
-
双钥密码体制的基本原理
5. RSA密钥产生过程(熟练掌握、可能大题)
-
密码分析的四种方式
第三章 信息认证技术
-
身份认证的工作原理
-
MD5码的特点
-
数字签名的工作流程(利用RSA实现保密的数字签名)
-
Hash(MD5)---->FLAG匹配(可能大题)
第四章 网络侦查技术
网络侦查网站扫描(可能大题)
https://www.shodan.io/
product:"Apache httpd" country:"CN" port:"80,443" org:"Tencent" city:"Shenzhen" after:"01-01-23"
https://fofa.info
https://www.zoomeye.org/
www.internic.net/whois.html
第五章 网络扫描技术
- 主机扫描的类型
- 端口扫描的三个方法
第六章 拒绝服务攻击
- 风暴型拒绝服务攻击、分类与区别
- 拒绝服务攻击的防范手段
第七章 口令攻击
- 口令攻击的方法
2.== 暴力破解工具的使用(可能大题)==
第八章 访问控制技术
- 访问控制的类型
第九章 防火墙技术
-
包过滤技术ACL的命令(两种访问控制列表的设计)
-
四种防火墙体系结构的区别
第十章 特洛伊木马
-
特洛伊木马的特点
-
恶意代码的区别
实操部分
-
常识
-
Hash---->Flag
-
RSA的破解与加密
-
隐写
LSB
import base64
import binascii
import struct
import re
import os
import subprocessdef analyze_stego_image(base64_file):"""分析Base64编码的PNG图像中的隐写信息"""try:# 读取Base64数据并解码为PNGwith open(base64_file, 'r') as f:base64_data = f.read().strip()try:png_data = base64.b64decode(base64_data)except binascii.Error:return ["Base64解码失败,请检查数据格式是否正确"]# 保存解码后的图像output_file = 'image.png'with open(output_file, 'wb') as f:f.write(png_data)print(f"图像已成功保存为 {output_file}")# 执行快速隐写分析results = []# 1. 检查文件末尾附加数据if check_trailing_data(png_data):results.append("发现文件末尾附加数据")# 2. 检查PNG块结构if check_png_chunks(png_data):results.append("发现异常PNG数据块")# 3. 搜索可打印字符串text_flags = search_text_flags(png_data)if text_flags:results.append(f"发现文本标志: {text_flags}")# 4. 尝试使用外部工具分析tools_results = run_external_tools(output_file)results.extend(tools_results)return results or ["未发现明显隐写信息,建议使用专业工具深度分析"]except Exception as e:return [f"处理过程中出错: {str(e)}"]def check_trailing_data(data):"""检查PNG文件末尾是否有附加数据"""# PNG文件以IEND块结束iend = b'IEND'iend_pos = data.rfind(iend)if iend_pos == -1:return False# IEND块固定12字节长 (4字节长度 + 4字节类型 + 4字节CRC)iend_end = iend_pos + 12# 检查文件末尾是否有额外数据return len(data) > iend_enddef check_png_chunks(data):"""检查异常PNG数据块"""# 跳过PNG签名 (8字节)pos = 8while pos < len(data):# 读取块长度 (4字节)if pos + 4 > len(data):breaklength = struct.unpack('>I', data[pos:pos + 4])[0]pos += 4# 读取块类型 (4字节)if pos + 4 > len(data):breakchunk_type = data[pos:pos + 4]pos += 4# 跳过数据if pos + length > len(data):breakpos += length# 跳过CRCif pos + 4 > len(data):breakpos += 4# 检查可疑块类型if chunk_type not in [b'IHDR', b'IDAT', b'IEND', b'PLTE', b'tRNS', b'gAMA', b'cHRM']:return Truereturn Falsedef search_text_flags(data):"""在二进制数据中搜索文本标志"""# 尝试不同编码try:text = data.decode('ascii', errors='ignore')except UnicodeDecodeError:text = ""flags = []# 常见CTF标志格式patterns = [r'CTF\{.*?\}',r'flag\{.*?\}',r'FLAG\{.*?\}',r'[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}']for pattern in patterns:matches = re.findall(pattern, text)flags.extend(matches)return flagsdef run_external_tools(image_path):"""尝试使用外部工具进行分析"""results = []# 1. 使用strings命令搜索文本try:strings_output = subprocess.check_output(['strings', image_path],text=True,stderr=subprocess.DEVNULL)# 在strings输出中搜索标志text_flags = []patterns = [r'CTF\{.*?\}',r'flag\{.*?\}',r'FLAG\{.*?\}']for pattern in patterns:matches = re.findall(pattern, strings_output)text_flags.extend(matches)if text_flags:results.append(f"使用strings发现文本标志: {text_flags}")except (subprocess.CalledProcessError, FileNotFoundError):pass# 2. 尝试使用exiftool查看元数据try:exiftool_output = subprocess.check_output(['exiftool', image_path],text=True,stderr=subprocess.DEVNULL)# 检查是否有可疑元数据if "Comment" in exiftool_output or "Description" in exiftool_output:results.append("ExifTool发现可疑元数据")except (subprocess.CalledProcessError, FileNotFoundError):pass# 3. 使用file命令检查文件类型try:file_output = subprocess.check_output(['file', image_path],text=True,stderr=subprocess.DEVNULL)if "data" in file_output.lower():results.append("File命令发现文件包含附加数据")except (subprocess.CalledProcessError, FileNotFoundError):passreturn resultsif __name__ == "__main__":base64_file = "file.txt" # 包含Base64数据的文件print("开始分析隐写图像...")results = analyze_stego_image(base64_file)print("\n分析结果:")for i, result in enumerate(results, 1):print(f"{i}. {result}")print("\n建议下一步操作:")print("1. 使用zsteg检测LSB隐写: zsteg image.png")print("2. 使用steghide尝试提取嵌入文件: steghide extract -sf image.png")print("3. 使用binwalk检查文件嵌入: binwalk image.png")print("4. 使用hex编辑器检查文件: hexdump -C image.png | less")print("5. 尝试各种隐写密码: steghide extract -sf image.png -p 'password'")
PNG
import osdef separate_files(input_file):with open(input_file, 'rb') as f:data = f.read()# 查找PNG文件的IEND块结尾位置iend_pos = data.rfind(b'IEND\xaeB`\x82')if iend_pos == -1:raise ValueError("无效的PNG文件或未找到IEND标记")# IEND块完整结束位置(IEND标记 + 4字节CRC)png_end = iend_pos + 8# 分离PNG主体和隐藏文件png_data = data[:png_end]hidden_data = data[png_end:]if not hidden_data:print("未检测到隐藏文件")return# 生成输出文件名base_name = os.path.splitext(input_file)[0]png_output = f"{base_name}_visible.png"hidden_output = f"{base_name}_hidden.bin"# 保存分离后的文件with open(png_output, 'wb') as f:f.write(png_data)with open(hidden_output, 'wb') as f:f.write(hidden_data)print(f"分离成功!\n- 可见部分: {png_output}\n- 隐藏数据: {hidden_output}")print(f"隐藏文件大小: {len(hidden_data)} 字节")# 检测常见文件类型if hidden_data.startswith(b'PK\x03\x04'):print("检测到ZIP文件格式,尝试重命名...")os.rename(hidden_output, f"{base_name}_hidden.zip")print("重命名为ZIP文件")elif hidden_data.startswith(b'Rar!'):print("检测到RAR文件格式,尝试重命名...")os.rename(hidden_output, f"{base_name}_hidden.rar")print("重命名为RAR文件")if __name__ == "__main__":input_filename = "QR_code.png"separate_files(input_filename)
- gif文件的拆分
- 音频分析
- 流量包的分析
- 编码
文言文网站:https://ide.wy-lang.org/
http://ctf.ssleye.com/