【前言】
最近被抓取快手和最右APP搞得焦头烂额,其中最困恼的就是他的sig值,做了加密导致无法直接修改参数进行请求。
但是在研究的过程中我也发现了一些好玩的,比如用模拟器抓取,用anyproxy代理+fiddler进行抓取。
【现记录fiddler抓取抓发代码:】
if (oSession.uriContains("tbapi.ixiaochuan.cn/index/recommend")){
var fso;
var file;
fso = new ActiveXObject("Scripting.FileSystemObject");
//文件保存路径,可自定义
file = fso.OpenTextFile("D:\\Sessions.txt",8 ,true, true);
file.writeLine("Request url: " + oSession.url);
file.writeLine("Request header:" + "\n" + oSession.oRequest.headers);
file.writeLine("Request body: " + oSession.GetRequestBodyAsString());
file.writeLine("\n");
file.close();
var _xhr = new ActiveXObject('Microsoft.XMLHTTP');
var url = 'http://localhost:8080/getZuiYouToken';
//发送的数据参数
var param = {
url: oSession.url,
body: oSession.GetRequestBodyAsString()
};
var par = '';
for (var i in param) {
var _data = escape(param[i]);
par += par ? ("&" + i + "=" + _data) : (i + "=" + _data);
}
//不需要返回值所以写啦个空回调
_xhr.onreadystatechange = function() {}
_xhr.open('POST', url, true);
_xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
_xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
_xhr.send(par);
}
if (oSession.uriContains("/rest/n/nearby/roaming")){
var _xhr = new ActiveXObject('Microsoft.XMLHTTP');
var url = 'http://localhost:8080/test.do';
//发送的数据参数
var param = {
url: oSession.url,
body: oSession.GetRequestBodyAsString()
};
var par = '';
for (var i in param) {
var _data = escape(param[i]);
par += par ? ("&" + i + "=" + _data) : (i + "=" + _data);
}
//不需要返回值所以写啦个空回调
_xhr.onreadystatechange = function() {}
_xhr.open('POST', url, true);
_xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
_xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
_xhr.send(par);
}
【按键精灵脚本:】
Do
KeepScreen True
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Home"
Delay 1000
If gethour()>0 And gethour()<=6 then //要在几点运行,这里就改成几
ShowMessage("非执行脚本时间段")
Delay 30 * 60 * 1000
Else
ShowMessage("脚本开始执行")
RunApp "com.tencent.mm", ".plugin.brandservice.ui.BrandServiceIndexUI"
Delay 4000
Tap 150,250
// End If
Delay 3000
Tap 50 ,50
Delay 3000
Tap 500, 300
// End If
Delay 30 * 60 * 1000
Tap 40, 80
End If
Loop Until 2>3
Function gethour()
Dim shijian,ymdt(4),hms(2),hour
shijian = now()
hour=CLng(Mid(shijian,12,2))
gethour() = hour
End Function
================================
Do
KeepScreen True
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Back"
Delay 1000
KeyPress "Home"
Delay 1000
If gethour()>0 And gethour()<=6 then
ShowMessage("非执行脚本时间段")
Delay 30*60*1000
Else
ShowMessage("脚本开始执行")
RunApp "cn.xiaochuankeji.tieba"
Delay 10000
Tap 30,450
Tap 30,450
Delay 2000
Tap 100,450
Delay 2000
TouchDown 100,422,1
TouchMove 600,422,1,800
TouchMove 1000,422,1,800
TouchUp 1
Delay 2000
Tap 30,450
Delay 2000
Tap 200,450
Delay 2000
TouchDown 100,422,2
TouchMove 600,422,2,800
TouchMove 1000,422,2,800
TouchUp 2
Tap 30,450
Delay 2000
Tap 250,450
Delay 2000
TouchDown 100,422,3
TouchMove 600,422,3,800
TouchMove 1000,422,3,800
TouchUp 3
Delay 60*60*1000
End If
Loop Until 2>3
Function gethour()
Dim shijian,ymdt(4),hms(2),hour
shijian = now()
hour=CLng(Mid(shijian,12,2))
gethour() = hour
End Function
=========================================
【anyproxy】
function getZuiYouToken(req,data){
if (/tbapi.ixiaochuan.cn/i.test(req.url)){ //如果是最右的来的请求
try{
data = {
url: encodeURI(req.url),
body: data.toString("utf8")
};
//console.log("data=" + data['url']);
//console.log("body=" + data['body']);
content = require('querystring').stringify(data);//将文章列表发送到服务端
//console.log("content=" + content);
var http = require('http');
var options = {
method: "POST",
host: "172.30.157.90",//注意没有http://,这是服务器的域名。
port: 8080,
path: "/getZuiYouToken",//接收程序的路径和文件名
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
"Content-Length": content.length
}
};
var req = http.request(options, function (res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
req.on('error', function (e) {
console.log('problem with request: ' + e.message);
});
req.write(content);
req.end();
} catch (e) {
console.log(e)
}
}
}