355 字
2 分钟
反沙箱:国外沙箱时区对抗
2026-01-04
统计加载中...

对于国外沙箱,其实直接看时区就行了,如果在中国时区,就对 www.baidu.com 发起 Get 请求,如果不在,就直接 panic

use windows::Win32::System::Time::*;
/// 编译时加密字符串字面量的宏(XOR 密钥: 0x7A)
macro_rules! encrypted_string {
($str:expr) => {{
// 编译时计算加密后的字节数组
const INPUT: &[u8] = $str.as_bytes();
const LEN: usize = INPUT.len();
// 手动展开 XOR 加密(编译时计算)
const ENCRYPTED: [u8; 32] = {
let mut data = [0u8; 32];
let mut i = 0;
while i < LEN {
data[i] = INPUT[i] ^ 0x7A;
i += 1;
}
data
};
// 运行时解密
{
let mut decrypted = Vec::with_capacity(LEN);
for i in 0..LEN {
decrypted.push(ENCRYPTED[i] ^ 0x7A);
}
String::from_utf8(decrypted).expect("Invalid UTF-8")
}
}};
}
fn is_beijing_timezone() -> bool {
unsafe {
let mut tz_info = DYNAMIC_TIME_ZONE_INFORMATION::default();
let _result = GetDynamicTimeZoneInformation(&mut tz_info);
// 转换时区名称
let tz_name = String::from_utf16_lossy(&tz_info.TimeZoneKeyName)
.trim_end_matches('\0')
.to_string();
// 检查两个条件:
// 1. 时区名称为 "China Standard Time"
// 2. UTC 偏移量为 -480 分钟 (UTC+8)
tz_name == "China Standard Time" && tz_info.Bias == -480
}
}
fn main() {
// 检测时区
if !is_beijing_timezone() {
panic!("检测到非北京时间,可能运行在国外沙箱环境");
}
// 使用加密域名(运行时解密)
let url = encrypted_string!("https://www.baidu.com");
// 发起 HTTP 请求验证
match reqwest::blocking::get(&url) {
Ok(response) => {
if response.status().is_success() {
println!("成功连接,状态码: {}", response.status());
} else {
println!("连接返回非成功状态码: {}", response.status());
}
}
Err(e) => {
println!("请求失败: {}", e);
}
}
}

微步沙箱:

微步沙箱

VT 沙箱:

VT沙箱

成功绕过 VT

反沙箱:国外沙箱时区对抗
https://www.trtyr.top/posts/anti-sandbox-foreign-sandbox-timezone-evasion/
作者
特让他也让
发布于
2026-01-04
许可协议
CC BY-NC-SA 4.0

部分信息可能已经过时