原理如下
- surge 安装根证书
- 开启 https 请求修改
- surge 添加如下脚本
- 开启 MitM 解密 HTTP 流量
- 在脚本中设置 URL 正则
已经在某西部城市测试成功。但这个发现比较晚,现在已经放开了,即便不再做核酸。 原理是基于 https 的中间人攻击
Date.prototype.format = function(fmt) {
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};
if(/(y+)/.test(fmt)) {
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
}
for(var k in o) {
if(new RegExp("("+ k +")").test(fmt)){
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
}
}
return fmt;
}
let body = JSON.parse($response.body);
let currentTime = body.data.currentTime
var checkTime = new Date().format("yyyy/MM/dd 18:21:01");
body.data.detTime = checkTime;
body.data.collectTime = checkTime;
body.data.todayCollectTime = checkTime;
body.data.detOrg="xx 检验所"
body.data.cardNum=24;
body = JSON.stringify(body);
$done({body});