中文 | English
API: wingman.security
Security module providing environment detection, encryption and decryption, random offsets, and other security-related functionality.
Module Overview
The security module provides security features:
- Environment detection - Debugger detection, virtual machine detection, integrity verification
- Humanized randomness - Random delays, random coordinate offsets
- Encryption and decryption - String encryption and decryption
- Hashing and randomness - String hashing, random string generation
- Sensitive information filtering - Filter sensitive fields
Detecting a Debugger
is_debugger_present() / isDebuggerPresent()
Description: Detects whether it is running under a debugger.
Signature:
is_debugger_present() -> boolisDebuggerPresent() -> booleanReturns:
- Whether a debugger was detected
Detecting a Virtual Machine
is_running_in_vm() / isRunningInVM()
Description: Detects whether it is running inside a virtual machine environment.
Signature:
is_running_in_vm() -> boolisRunningInVM() -> booleanReturns:
- Whether it is running in a virtual machine
Verifying Integrity
verify_integrity() / verifyIntegrity()
Description: Verifies program integrity. Currently a placeholder implementation: by default (integrity checking not enabled) it always returns True/true; when explicitly enabled, it takes the unimplemented branch, always returns False/false, and logs a warning. Do not rely on it to decide whether the program has been tampered with.
Signature:
verify_integrity() -> boolverifyIntegrity() -> booleanReturns:
- A placeholder value (see above), not a real integrity verification result
from wingman import security
# 检测是否在调试器中运行
if security.is_debugger_present():
print("警告: 检测到调试器")
# 检测是否在虚拟机中运行
if security.is_running_in_vm():
print("警告: 检测到虚拟机环境")
# 验证程序完整性
if not security.verify_integrity():
print("警告: 程序完整性验证失败")Getting a Random Delay
get_random_delay() / getRandomDelay()
Description: Gets a humanized random delay.
Signature:
get_random_delay() -> intgetRandomDelay() -> numberReturns:
- A random delay (in milliseconds)
Getting a Random Offset
get_random_offset() / getRandomOffset()
Description: Gets a humanized random coordinate offset.
Signature:
get_random_offset() -> list[float, float]getRandomOffset() -> tableReturns: A single array value [x_offset, y_offset] (same shape on both ends, not multiple return values):
- Index
1(Pythonresult[0]) - X offset - Index
2(Pythonresult[1]) - Y offset
from wingman import security, input
# 获取随机延迟(毫秒)
delay = security.get_random_delay()
# 获取随机坐标偏移(返回列表,可直接解包)
offset_x, offset_y = security.get_random_offset()
# 在目标坐标基础上添加随机偏移
input.click(100 + offset_x, 200 + offset_y)[The former
security.encryptString/security.decryptString(XOR obfuscation, not real encryption)] were removed in 2026-09. For encryption, use the crypto module'scrypto.encryptAES/crypto.decryptAES(AES-256-GCM); see crypto API.
Computing a Hash
hash_string(str) / hashString(str)
Description: Computes the hash of a string.
Signature:
hash_string(str: str) -> strhashString(str: string) -> stringParameters:
str- The string to hash
Returns:
- The hash value (a hexadecimal string)
Generating a Random String
generate_random_string(length) / generateRandomString(length)
Description: Generates a random string.
Signature:
generate_random_string(length: int) -> strgenerateRandomString(length: number) -> stringParameters:
length- String length
Returns:
- The random string
from wingman import security
# 计算字符串哈希
hash_value = security.hash_string("my_data")
print(f"哈希值: {hash_value}")
# 生成随机字符串
random_str = security.generate_random_string(16)
print(f"随机字符串: {random_str}")Filtering Sensitive Information
filter_sensitive(str) / filterSensitive(str)
Description: Filters sensitive information from a string. The current implementation does key-name masking: it replaces matched sensitive key names themselves (password/passwd/pwd/token/key/secret/api_key/apikey, case-insensitive) with ***; it does not mask values — whatever follows = is kept as-is.
Signature:
filter_sensitive(str: str) -> strfilterSensitive(str: string) -> stringParameters:
str- The string to filter
Returns:
- The string with sensitive key names replaced by
***(values are not replaced)
from wingman import security
# 键名打码(非值打码)
safe_string = security.filter_sensitive("password=123456&token=abc")
print(safe_string) # "***=123456&***=abc"Available APIs
| Python Function | Lua Function | Description | Parameters |
|---|---|---|---|
is_debugger_present() | isDebuggerPresent() | Detect a debugger | Returns: whether a debugger was detected |
is_running_in_vm() | isRunningInVM() | Detect a virtual machine | Returns: whether running in a VM |
verify_integrity() | verifyIntegrity() | Verify integrity | Returns: placeholder implementation (always true by default; always false when explicitly enabled) |
get_random_delay() | getRandomDelay() | Get a random delay | Returns: milliseconds |
get_random_offset() | getRandomOffset() | Get a random offset | Returns: [x, y] array (Lua uses offset[1]/offset[2]) |
hash_string(str) | hashString(str) | Compute a hash | str: the string Returns: hash value |
generate_random_string(length) | generateRandomString(length) | Generate a random string | length: string length Returns: the random string |
filter_sensitive(str) | filterSensitive(str) | Filter sensitive information | str: original string Returns: string with key names masked (values not replaced) |