diff --git a/doc/sqlmap-泛读报告.docx b/doc/sqlmap-泛读报告.docx
new file mode 100644
index 0000000..c87ed17
Binary files /dev/null and b/doc/sqlmap-泛读报告.docx differ
diff --git a/src/sqlmap-master/extra/beep/beep.py b/src/sqlmap-master/extra/beep/beep.py
index 788bafd..4ed4a29 100644
--- a/src/sqlmap-master/extra/beep/beep.py
+++ b/src/sqlmap-master/extra/beep/beep.py
@@ -9,96 +9,114 @@ See the file 'LICENSE' for copying permission
import os
import sys
-import wave
+import wave # 用于处理 WAV 文件格式
+# 指定蜂鸣音频文件的路径
BEEP_WAV_FILENAME = os.path.join(os.path.dirname(__file__), "beep.wav")
def beep():
+ """根据操作系统播放蜂鸣声。"""
try:
+ # 检测操作系统并调用相应的播放方法
if sys.platform.startswith("win"):
- _win_wav_play(BEEP_WAV_FILENAME)
+ _win_wav_play(BEEP_WAV_FILENAME) # Windows 系统使用 WAV 播放
elif sys.platform.startswith("darwin"):
- _mac_beep()
+ _mac_beep() # macOS 系统使用系统蜂鸣
elif sys.platform.startswith("cygwin"):
- _cygwin_beep(BEEP_WAV_FILENAME)
+ _cygwin_beep(BEEP_WAV_FILENAME) # Cygwin 使用音频文件播放
elif any(sys.platform.startswith(_) for _ in ("linux", "freebsd")):
- _linux_wav_play(BEEP_WAV_FILENAME)
+ _linux_wav_play(BEEP_WAV_FILENAME) # Linux 和 FreeBSD 系统使用 WAV 播放
else:
- _speaker_beep()
+ _speaker_beep() # 其他系统使用控制台蜂鸣
except:
+ # 捕获异常并使用控制台蜂鸣
_speaker_beep()
def _speaker_beep():
- sys.stdout.write('\a') # doesn't work on modern Linux systems
+ """在控制台播放蜂鸣声(警报声)。"""
+ sys.stdout.write('\a') # 在现代 Linux 系统上可能无效
try:
- sys.stdout.flush()
+ sys.stdout.flush() # 尝试刷新标准输出
except IOError:
- pass
+ pass # 忽略任何 I/O 错误
-# Reference: https://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00815.html
+# Cygwin 使用系统命令播放音频文件
def _cygwin_beep(filename):
os.system("play-sound-file '%s' 2>/dev/null" % filename)
+# macOS 系统使用 Carbon 库的 SysBeep 函数
def _mac_beep():
- import Carbon.Snd
- Carbon.Snd.SysBeep(1)
+ import Carbon.Snd # 导入 Carbon 库
+ Carbon.Snd.SysBeep(1) # 播放系统蜂鸣声
+# Windows 系统播放 WAV 文件
def _win_wav_play(filename):
- import winsound
+ import winsound # 导入 winsound 库
- winsound.PlaySound(filename, winsound.SND_FILENAME)
+ winsound.PlaySound(filename, winsound.SND_FILENAME) # 播放指定的 WAV 文件
+# Linux 系统播放 WAV 文件的实现
def _linux_wav_play(filename):
+ # 尝试使用不同的命令播放音频文件
for _ in ("aplay", "paplay", "play"):
if not os.system("%s '%s' 2>/dev/null" % (_, filename)):
- return
+ return # 成功播放音乐后返回
- import ctypes
+ import ctypes # 导入 ctypes 库以调用 C 函数
+ # PulseAudio 的相关常量定义
PA_STREAM_PLAYBACK = 1
PA_SAMPLE_S16LE = 3
- BUFFSIZE = 1024
+ BUFFSIZE = 1024 # 缓冲区大小
+ # 定义 PulseAudio 样本规格的结构
class struct_pa_sample_spec(ctypes.Structure):
_fields_ = [("format", ctypes.c_int), ("rate", ctypes.c_uint32), ("channels", ctypes.c_uint8)]
try:
- pa = ctypes.cdll.LoadLibrary("libpulse-simple.so.0")
+ pa = ctypes.cdll.LoadLibrary("libpulse-simple.so.0") # 加载 PulseAudio 库
except OSError:
- return
+ return # 如果加载失败,则返回
+ # 打开 WAV 文件
wave_file = wave.open(filename, "rb")
+ # 设置 PulseAudio 样本规格
pa_sample_spec = struct_pa_sample_spec()
- pa_sample_spec.rate = wave_file.getframerate()
- pa_sample_spec.channels = wave_file.getnchannels()
- pa_sample_spec.format = PA_SAMPLE_S16LE
+ pa_sample_spec.rate = wave_file.getframerate() # 获取采样频率
+ pa_sample_spec.channels = wave_file.getnchannels() # 获取声道数
+ pa_sample_spec.format = PA_SAMPLE_S16LE # 设置样本格式
error = ctypes.c_int(0)
- pa_stream = pa.pa_simple_new(None, filename, PA_STREAM_PLAYBACK, None, "playback", ctypes.byref(pa_sample_spec), None, None, ctypes.byref(error))
+ # 创建 PulseAudio 流
+ pa_stream = pa.pa_simple_new(None, filename, PA_STREAM_PLAYBACK, None,
+ "playback", ctypes.byref(pa_sample_spec), None, None, ctypes.byref(error))
if not pa_stream:
raise Exception("Could not create pulse audio stream: %s" % pa.strerror(ctypes.byref(error)))
while True:
+ # 获取延迟
latency = pa.pa_simple_get_latency(pa_stream, ctypes.byref(error))
if latency == -1:
raise Exception("Getting latency failed")
- buf = wave_file.readframes(BUFFSIZE)
+ buf = wave_file.readframes(BUFFSIZE) # 从 WAV 文件读取帧
if not buf:
- break
+ break # 如果没有更多帧可读,退出循环
+ # 播放读取的帧
if pa.pa_simple_write(pa_stream, buf, len(buf), ctypes.byref(error)):
raise Exception("Could not play file")
- wave_file.close()
+ wave_file.close() # 关闭 WAV 文件
+ # 确保所有数据都已播放完成
if pa.pa_simple_drain(pa_stream, ctypes.byref(error)):
raise Exception("Could not simple drain")
- pa.pa_simple_free(pa_stream)
+ pa.pa_simple_free(pa_stream) # 释放 PulseAudio 流资源
if __name__ == "__main__":
- beep()
+ beep() # 调用蜂鸣函数
\ No newline at end of file
diff --git a/src/sqlmap-master/extra/cloak/cloak.py b/src/sqlmap-master/extra/cloak/cloak.py
index 8f361a0..ee8a396 100644
--- a/src/sqlmap-master/extra/cloak/cloak.py
+++ b/src/sqlmap-master/extra/cloak/cloak.py
@@ -7,82 +7,99 @@ Copyright (c) 2006-2024 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
-from __future__ import print_function
+from __future__ import print_function # 兼容 Python 2 和 3 的 print 函数
import os
import struct
import sys
-import zlib
+import zlib # 用于数据压缩和解压缩
from optparse import OptionError
from optparse import OptionParser
+# 在 Python 3 中定义 xrange 和 ord 的兼容
if sys.version_info >= (3, 0):
- xrange = range
- ord = lambda _: _
+ xrange = range # 使用 Python 3 的 range
+ ord = lambda _: _ # 在 Python 3 中直接使用字符
-KEY = b"E6wRbVhD0IBeCiGJ"
+KEY = b"E6wRbVhD0IBeCiGJ" # 定义加密/解密的密钥
def xor(message, key):
+ """执行 XOR 操作,返回加密或解密后的字节序列。"""
+ # 对 message 的每个字节进行 XOR 运算,并返回字节串
return b"".join(struct.pack('B', ord(message[i]) ^ ord(key[i % len(key)])) for i in range(len(message)))
def cloak(inputFile=None, data=None):
+ """对输入文件或数据进行加密和压缩。"""
if data is None:
+ # 如果没有提供数据,则读取文件内容
with open(inputFile, "rb") as f:
- data = f.read()
+ data = f.read() # 以二进制模式读取文件数据
+ # 对数据进行压缩后再使用 XOR 加密
return xor(zlib.compress(data), KEY)
def decloak(inputFile=None, data=None):
+ """对输入文件或数据进行解密和解压缩。"""
if data is None:
+ # 如果没有提供数据,则读取文件内容
with open(inputFile, "rb") as f:
data = f.read()
+
try:
+ # 首先对数据进行 XOR 解密,然后解压缩
data = zlib.decompress(xor(data, KEY))
except Exception as ex:
+ # 如果解压缩过程中发生异常,打印错误信息并退出
print(ex)
print('ERROR: the provided input file \'%s\' does not contain valid cloaked content' % inputFile)
sys.exit(1)
finally:
- f.close()
+ f.close() # 确保文件流被关闭
- return data
+ return data # 返回解密后的数据
def main():
- usage = '%s [-d] -i [-o