Repository navigation
Expand file tree
/
Copy pathituring.js
More file actions
237 lines (221 loc) · 13.6 KB
/
Copy pathituring.js
File metadata and controls
237 lines (221 loc) · 13.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
// var express = require('express');
// var http = require('http');
// var querystring = require('querystring');
// var jsdom = require('jsdom');
var iproxy = require('./proxy.js');
iproxy.test(function (result) {
// console.log(result);
});
return;
var app = express();
app.use(express.static('views'));
var host = 'www.ituring.com.cn';
app.get('/getremote', function (request, response) {
console.log([request.constructor.remoteAddress, request.socket.remoteAddress]);
response.send('ok');
});
app.get('/proxy', function (request, response) {
var req = http.request({
host: '120.52.72.24',
port: 80,
path: 'http://www.ituring.com.cn',
method: 'GET'
}, function (res) {
res.setEncoding('utf8');
var result = '';
res.on('data', function (data) {
result += data;
});
res.on('end', function () {
console.log(result);
});
});
req.on('error', function (err) {
console.log(err);
});
req.end();
response.send(req.toString());
});
app.get('/logon', function (request, response) {
var path = 'http://www.ituring.com.cn/account/logon';
/**
* 请求token
* @param callback
*/
var getlogon = function (callback) {
var req = http.request({
host: '120.52.72.24',
port: 80,
path: path,
method: 'GET'
}, function (res) {
res.setEncoding('utf8');
var html = '';
res.on('data', function (data) {
html += data;
});
res.on('end', function () {
callback({
html: html,
cookie: res.headers['set-cookie']
});
});
});
req.end();
};
/**
* 请求登录
* @param token
* @param callback
*/
var postlogon = function (paras, callback) {
var req = http.request({
host: '120.52.72.24',
port: 80,
path: path,
method: 'POST',
headers: {
"content-type": "application/x-www-form-urlencoded",
"cookie": paras.cookie
}
}, function (res) {
res.setEncoding('utf8');
var html = '';
res.on('data', function (data) {
html += data;
});
res.on('end', function () {
callback(res.headers['set-cookie']);
});
});
req.write(querystring.stringify({
__RequestVerificationToken: paras.token,
UserName: 'will_wyx',
Password: '******',
RememberMe: true
}));
req.end();
};
var getuser = function (paras, callback, count) {
var proxy = randomProxy();
var req = http.request({
host: proxy.ip,
port: proxy.port,
path: 'http://www.ituring.com.cn/users/' + paras.id,
method: 'GET',
headers: {
"cookie": paras.cookie
}
}, function (res) {
res.setEncoding('utf8');
var html = '';
res.on('data', function (data) {
html += data;
});
res.on('end', function () {
callback(html, paras.id);
});
});
req.on('error', function () {
if (count < 10) {
console.log('errorgetuser ' + count++);
getuser(paras, callback, count);
} else {
console.log('getuser ' + paras.id);
}
});
req.end();
};
var postfollow = function (paras, callback, count) {
var proxy = randomProxy();
var req = http.request({
host: proxy.ip,
port: proxy.port,
path: 'http://www.ituring.com.cn/users/follow/' + paras.id,
method: 'POST',
headers: {
"cookie": paras.cookie
}
}, function (res) {
res.setEncoding('utf8');
var html = '';
res.on('data', function (data) {
html += data;
});
res.on('end', function () {
callback(html);
});
});
req.on('error', function () {
if (count < 10) {
console.log('errorfollow ' + count++);
postfollow(paras, callback, count);
} else {
console.log('postfollow ' + paras.id);
}
});
req.end();
};
getlogon(function (paras) {
jsdom.env(paras.html, [], function (err, window) {
if (!err) {
var token = window.document.getElementsByName('__RequestVerificationToken')[0].value;
var cookie = paras.cookie;
postlogon({
token: token,
cookie: cookie
}, function (result) {
var reg = /\.AUTH=(\w+);/;
// 登录成功COOKIE
var auth = '';
for (var i in result) {
var item = result[i];
var regres = reg.exec(item);
if (regres) {
auth = (regres[1]);
}
}
for (var uid = 7500; uid < 8000; ++uid) {
getuser({
id: uid,
cookie: '.AUTH=' + auth + ';'
}, function (userhtml, uid) {
var reg = new RegExp('<a data-ajax="true" data-ajax-method="post" data-ajax-mode="replace" data-ajax-update="#follow-' + uid + '" href="/users/follow/' + uid + '">加关注</a>')
jsdom.env(userhtml, [], function (error, window) {
if (!error) {
var element = window.document.getElementById('follow-' + uid);
if (element) {
var follow = element.innerHTML;
if (reg.test(follow)) {
// 加关注
postfollow({
id: uid,
cookie: '.AUTH=' + auth + ';'
}, function (followres) {
console.log('success ' + uid);
}, 0);
} else {
console.log(uid);
}
}
}
});
}, 0);
}
response.send('followd');
});
}
});
});
});
var proxies = ['120.52.72.24:80', '120.55.245.47:80', '203.223.143.51:8080', '120.52.72.21:80', '60.194.100.51:80', '202.100.167.145:80', '120.52.72.20:80', '120.52.72.19:80', '101.99.22.40:3128', '120.52.72.23:80', '202.100.167.182:80', '219.255.197.90:3128', '202.100.167.144:80', '114.215.150.13:3128', '124.206.133.227:80', '120.25.171.183:8080', '200.29.191.149:3128', '202.100.167.142:80', '202.100.167.180:80', '202.100.167.149:80', '183.61.236.55:3128', '112.112.70.115:80', '123.56.28.196:8888', '223.68.1.38:8000', '202.100.167.160:80', '61.174.10.22:8080', '112.74.25.121:3128', '101.66.253.22:8080', '88.132.10.72:8088', '112.112.70.118:80', '193.194.69.36:3128', '218.7.170.190:3128', '202.106.16.36:3128', '202.167.248.186:80', '222.122.9.46:80', '124.133.230.254:80', '113.107.57.76:8101', '124.192.97.241:3128', '58.247.125.205:80', '118.244.239.2:3128', '116.211.19.201:8008', '103.250.58.52:3128', '124.192.252.165:3128', '183.61.236.53:3128', '221.224.163.28:80', '124.88.67.9:80', '178.22.148.122:3129', '218.90.174.167:3128', '223.67.136.218:80', '96.44.162.26:80', '124.193.33.233:3128', '124.192.7.228:3128', '118.144.7.242:3128', '121.139.156.58:3128', '115.29.34.2:3128', '60.191.166.130:3128', '101.201.235.141:8000', '61.175.220.4:3128', '120.52.73.96:8080', '106.38.251.62:8088', '124.192.87.16:3128', '124.206.167.250:3128', '183.61.71.112:8888', '118.144.104.254:3128', '60.191.180.38:3128', '117.169.4.133:80', '117.169.4.136:80', '117.169.4.156:80', '117.169.4.134:80', '61.166.56.177:3128', '117.169.4.139:80', '190.202.82.238:3128', '112.90.72.83:80', '183.62.206.210:3128', '58.18.50.10:3128', '59.39.88.190:8080', '14.23.109.2:3128', '122.226.128.251:3128', '115.236.7.178:3128', '185.5.64.70:8080', '122.96.59.104:81', '112.199.65.190:3128', '159.226.224.180:3128', '60.191.170.122:3128', '202.77.57.124:3128', '220.179.178.88:3128', '79.188.42.46:8080', '221.206.154.23:3128', '60.191.153.12:3128', '124.206.186.161:3128', '60.11.11.163:3128', '122.226.141.67:3128', '125.212.217.215:80', '222.165.135.198:3128', '124.193.9.6:3128', '124.42.7.103:80', '190.185.165.225:3128', '134.196.214.127:3128', '202.21.116.13:3128', '103.43.44.61:3128', '218.56.0.158:3128', '115.146.123.219:8080', '101.255.60.126:80', '202.118.8.13:3128', '219.145.244.250:3128', '80.77.29.22:80', '45.32.189.83:8080', '119.6.136.122:80', '118.180.15.152:8102', '117.169.4.45:81', '222.161.209.168:8102', '117.169.4.42:81', '218.191.247.51:80', '124.244.157.209:80', '211.143.45.216:3128', '89.250.207.195:80', '110.84.128.143:3128', '222.161.209.164:8102', '124.88.67.9:82', '220.225.245.109:8000', '35.58.0.102:3128', '111.13.136.46:80', '180.249.2.8:80', '88.157.149.250:8080', '139.59.212.212:8080', '117.169.4.43:843', '111.13.136.36:80', '222.161.209.167:8102', '36.75.131.193:80', '119.6.136.122:83', '117.169.17.242:80', '61.168.11.25:8080', '125.162.208.172:80', '165.183.168.14:80', '124.88.67.9:81', '203.210.8.41:80', '124.88.67.9:843', '71.92.222.98:3128', '180.252.73.29:80', '47.89.53.92:3128', '117.169.4.43:81', '108.59.10.129:55555', '117.169.4.43:82', '201.241.88.63:80', '12.202.111.4:8080', '50.254.4.194:3128', '47.88.104.219:80', '190.215.50.62:8080', '43.224.234.86:80', '36.83.235.202:80', '47.88.195.233:3128', '182.35.164.81:8888', '41.190.95.80:80', '200.255.220.211:8080', '124.88.67.30:843', '183.39.158.51:80', '41.71.112.22:3128', '139.162.36.131:8080', '36.83.233.41:80', '112.255.179.92:8888', '212.185.87.53:443', '183.33.200.135:8888', '111.192.140.98:81', '182.38.107.254:81', '88.191.174.188:80', '183.239.167.122:8080', '190.205.215.147:8080', '74.50.27.229:80', '5.30.172.39:80', '125.94.181.211:81', '120.9.9.110:8888', '123.57.190.51:7777', '82.165.151.230:80', '213.159.214.193:80', '58.247.30.222:8080', '191.242.76.4:8088', '111.222.227.254:8118', '49.248.29.54:8080', '91.121.146.90:3128', '111.224.12.212:8888', '46.231.117.154:90', '221.199.203.106:3128', '47.88.102.97:8000', '123.112.68.84:81', '183.47.157.199:8888', '168.63.24.174:8145', '218.191.247.51:8380', '36.37.81.130:8080', '119.254.84.90:80', '220.101.93.3:3128', '182.254.208.116:8080', '218.103.42.105:1080', '190.107.206.1:8080', '58.23.94.192:8888', '190.7.71.62:80', '200.26.134.237:8080', '82.198.197.62:80', '46.231.117.154:80', '87.120.162.222:3128', '123.124.168.107:80', '128.123.226.59:8080', '39.80.207.94:81', '80.178.157.116:5555', '182.254.158.12:8080', '200.9.220.37:3128', '14.139.213.183:3128', '210.72.14.142:80', '51.254.106.65:80', '112.232.114.207:8080', '120.234.46.114:8118', '201.91.248.145:80', '61.224.174.201:8080', '193.124.184.171:80', '115.159.201.179:80', '61.144.194.151:3128', '113.122.78.30:8888', '45.65.11.53:3128', '122.96.59.104:80', '112.253.14.146:8080', '176.31.165.141:3128', '177.184.199.250:80', '182.74.243.46:3128', '37.144.90.197:8888', '202.75.210.45:7777', '80.178.157.115:5555', '175.182.138.22:8998', '124.124.228.50:3128', '117.135.250.89:80', '179.185.63.230:8080', '197.242.184.33:3128', '149.202.195.236:80', '101.93.225.63:81', '36.66.211.167:8080', '36.224.253.54:8998', '213.57.89.97:18000', '177.87.241.226:8080', '183.131.76.27:8888', '183.196.9.132:2226', '42.48.100.67:81', '109.251.162.7:8080', '119.202.173.240:80', '220.88.36.150:80', '52.29.95.106:80', '113.10.206.156:80', '221.4.169.82:8080', '111.126.245.230:8888', '54.186.33.114:80', '186.220.33.174:8080', '111.56.49.30:8118', '173.161.0.227:80', '113.204.136.50:8080', '51.254.106.68:80', '183.239.194.148:8080', '23.24.89.194:7004', '106.124.197.30:8888', '182.38.100.56:81', '117.103.173.98:80', '45.32.54.126:80', '122.13.163.109:81', '213.57.89.62:18000', '178.62.118.19:8118', '14.139.213.179:3128', '51.254.106.66:80', '105.235.106.59:8080', '110.179.18.77:8888', '191.101.12.234:80', '51.254.106.64:80', '45.40.143.57:80', '210.129.22.168:3128', '124.133.240.88:8080', '89.98.24.196:80', '121.167.151.57:8080', '168.63.20.19:8125', '117.239.146.218:8080', '203.130.228.60:8080', '85.204.229.47:81', '181.143.65.117:80', '43.240.138.31:8080', '152.26.91.86:8080', '188.164.203.26:80', '39.76.217.114:8888', '184.69.67.122:80', '114.109.111.105:80', '101.69.178.145:7777', '186.227.186.146:8080', '149.56.111.145:80', '86.100.118.44:81', '86.100.118.44:80', '36.250.186.100:8888', '27.8.61.173:8888', '149.202.95.110:80', '113.254.104.207:80', '107.158.196.18:3128', '5.45.105.223:80', '120.9.53.5:81', '77.87.174.8:3128', '188.191.30.115:8080', '164.132.222.249:80', '51.254.106.78:80', '51.254.106.76:80'];
function randomProxy() {
var i = parseInt(Math.random() * (proxies.length));
var item = proxies[i];
var itemArr = item.split(':');
return {
ip: itemArr[0],
port: +itemArr[1]
};
}
app.listen(3000);