有一个是当年发了 10 几年的文章的站点已经无耻到极点! 处理方案有很多,正好最近做相关项目用到 anyproxy ,就先用他临时处理。分享下规则,主要是找复制相关的关键词,其他拦截转发工具也可以用。
const replaceList = ['contextmenu ','contextMenu ', 'contextMenu', 'SelectStart', 'selectStart', 'selectstart','dragstart', 'onCopy', 'user-select', 'keypress', 'mousedown', 'keydown', 'keyup', 'keyCode', 'KeyCode', 'which', 'copy']
const replaceCssList = ['xxx']
module.exports={
*beforeSendResponse(requestDetail,responseDetail) {
const url = requestDetail.url
if(url.indexOf('我发了文章,不登录自己都不能复制!那些 xx 网站') > 0 ) {
const contype = responseDetail.response.header['Content-Type']
console.log('isHtml:::::::', contype);
const isHtml = contype.indexOf('html') > -1
const isJs = contype.indexOf('javascript') > -1
console.log('js =>', url);
const newResponse = responseDetail.response;
if(isJs){
// newResponse.body +='-- AnyProxy Hacked! --';
newResponse.body +='';
replaceList.map(s => {
console.log('替换 js=>', s, url);
const ns = new RegExp(s, 'ig')
newResponse.body = newResponse.body.replace(ns, '_fk_' + s)
})
}
if(url.substr(url.length-3, 3) == 'css' || isHtml) {
console.log('?????', newResponse.body.toString());
replaceCssList.map(s => {
const ns = new RegExp(s, 'ig')
newResponse.body = newResponse.body.toString().replace(ns, '')
})
}
return new Promise((resolve,reject)=>{
resolve({ response:newResponse });
});
}
}
};
anyproxy -i --rule 脚本文件
自己弄个服务器挂上去
1
israinbow 2022-09-20 20:13:39 +08:00 via Android
|