-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoneplus.js
86 lines (78 loc) · 1.75 KB
/
oneplus.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
85
86
const socket = require("socket.io-client")("wss://socket-unlock.oneplus.com", {
transports: ['websocket'],
upgrade: false
});
console.log("Connecting");
socket.on('connect', async () => {
// Authenticate user on socket
socket.emit('authenticate user',
{
count: '0',
username: "anandamritraj",
token: "YOUR_TOKEN",
squad: "",
locale: "en-gb",
csrf: "YOUR_CSRF_TOKEN"
},
(error, data) => {
if (error) {
console.log(
'Could not authenticate user on socket connection. Error was:',
error,
data
);
}
else {
console.log("Authenticated!");
run();
}
}
);
});
emmited = 0;
/**
* Run an infinte JS Loop
*/
async function run() {
while (true) {
await sleep(RandomBetween(20, 100));
EmitTap();
emmited += 1;
if (emmited % 100 === 0) {
console.log("emited: " + emmited);
}
}
}
/**
*
* @param {time} ms
*/
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
/**
* Emit a tap using socket.io
*/
function EmitTap() {
socket.emit(
'tap_logs',
{
username: "anandamritraj",
timestamp: Date.now(),
touchX: RandomBetween(30, 970),
touchY: RandomBetween(50, 1700)
},
error => {
if (error) {
console.error(error);
}
}
);
}
/**
* @return {number}
*/
function RandomBetween(min, max) // min and max included
{
return Math.floor(Math.random() * (max - min + 1) + min);
}