-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
134 lines (108 loc) · 4.54 KB
/
index.ts
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
import puppeteer, { EvaluateFn } from 'puppeteer';
import rand from 'randomstring';
import axios from 'axios';
import pageProxy from 'puppeteer-page-proxy';
import path from 'path';
const sleep = async(ms: number) => new Promise(r => setTimeout(r, ms));
const main = async() => {
const browser = await puppeteer.launch({
headless: false,
devtools: false
});
console.log('start');
launchPage(await browser.newPage());
launchPage(await browser.newPage());
launchPage(await browser.newPage());
};
const REGISTER_URL = 'https://flyosforum.huoyinetwork.cn/index.php?app=user&ac=register';
const launchPage = async(page: puppeteer.Page) => {
let start = Date.now();
while(true) {
// const proxy = await axios.get('http://demo.spiderpy.cn/get/', {
// responseType: 'json'
// });
// console.log('proxy', proxy.data);
// await pageProxy(page, proxy.data.https ? 'https://' : 'http://' + proxy.data.proxt);
console.log('goto register')
await page.goto(REGISTER_URL);
console.log('wait');
const submit = await page.waitForSelector('#comm-submit');
const email = await page.waitForSelector('#comm-form > div:nth-child(1) > input'),
password = await page.waitForSelector('#comm-form > div:nth-child(2) > input'),
passwordAgain = await page.waitForSelector('#comm-form > div:nth-child(3) > input'),
username = await page.waitForSelector('#comm-form > div:nth-child(4) > input');
console.log('ready');
const rand0 = rand.generate({
readable: true,
charset: 'FLYOSFUCKYOUflyosfuckyou',
length: 5
}), rand1 = rand.generate({
readable: true,
charset: 'abcdefghijklmnopqrst1234567890',
length: 8
}), rand2 = rand.generate({
readable: true,
length: 10
});
console.log([`${rand0}@${rand1}.com`, rand0, rand2])
await email!.evaluate((node: any, r0, r1) => {
node.value = `${r0}@${r1}.com`;
}, rand0, rand1);
await password!.evaluate((node: any, r2) => {
node.value = r2;
}, rand2);
await passwordAgain!.evaluate((node: any, r2) => {
node.value = r2;
}, rand2);
await username!.evaluate((node: any, r0) => {
node.value = r0;
}, rand0);
await submit!.click();
// console.log('set image')
// await sleep(2000);
// const picker = await page.waitForSelector('body > div:nth-child(4) > div > div.col-md-6 > div > div > form > div:nth-child(2) > div:nth-child(2) > input[type=file]');
// const picker_ok = await page.waitForSelector('body > div:nth-child(4) > div > div.col-md-6 > div > div > form > div:nth-child(3) > button');
// await picker!.uploadFile(path.resolve(__dirname, 'R.jpg'));
// await sleep(1000);
// await picker_ok!.click();
// await sleep(1000);
// await page.goto('https://flyosforum.huoyinetwork.cn/index.php?app=article&ac=add');
// await sleep(8000);
// console.log('send art')
// const art_title = await page.waitForSelector('body > div:nth-child(5) > div > div > div > div.col-md-8 > form > div:nth-child(1) > input');
// const art_content = await page.waitForSelector('#tseditor');
// const art_submit = await page.waitForSelector('body > div:nth-child(5) > div > div > div > div.col-md-8 > form > button');
// await art_title!.evaluate((node: any, rnd) => {
// node.value = `${rnd}`
// }, rand.generate({
// readable: true,
// length: 10
// }));
// await art_content!.evaluate((node: any, rnd) => {
// node.value = `${rnd}<br/>`;
// }, rand.generate({
// readable: true,
// length: 1000
// }));
// await art_submit!.click();
// await sleep(1000);
// await page.goto('https://flyosforum.huoyinetwork.cn/index.php?app=weibo');
// await sleep(8000);
// const wb_title = await page.waitForSelector('#title');
// const wb_submit = await page.waitForSelector('#comm-form > div.d-flex.justify-content-between.align-content-center.mt-2 > div:nth-child(2) > button');
// await wb_title!.evaluate((node: any, rnd) => {
// node.value = 'xdm说实话我也懒得浪费流量.' + rnd
// }, rand.generate({
// readable: true,
// length: 800
// }));
// await wb_submit!.click();
// await sleep(1000);
await page.deleteCookie(
...((await page.cookies()).map(({name}) => ({ name })))
);
if ((Date.now() - start) >= (25*60*1000)) break;
await sleep(1000);
}
}
main();