-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsnippet.js
85 lines (75 loc) · 2.43 KB
/
snippet.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
const [getTeams, getPlayers] = (() => {
const playersSet = [];
const ws = new WebSocket('ws://chat2.ixagar.net:4590/');
//
// ─── WEBSOCKET LISTENERS ─────────────────────────────────────────
//
ws.onopen = () => {
ws.send(JSON.stringify({
op: "JoinToServer"
}));
};
ws.onmessage = (e) => {
const obj = JSON.parse(e.data);
if (obj.op === "SelfUserId") {
ws.send(JSON.stringify({
"op": "UpdateUserInfo",
"userId": obj.userId,
"data": {
"siteSig": "ix",
"serverSig": "EA-SAO1",
"name": "-",
"team": "",
"code": "",
"skinUrl": "http://ixagar.net/skins/ghost.png",
"envSig": "000000",
"profileComment": "",
"showTripKey": false
}
}));
}
if (obj.op === "UpdateUserInfos") {
obj.infos.forEach(i => {
const idx = playersSet.map(j => j.userId).indexOf(i.userId);
if (idx < 0) {
playersSet.push(i);
} else {
playersSet[idx] = i;
}
});
}
};
return [(() => {
const decrypt = (code) => {
const secret = "FnLtRzX5dBjHpNvT1Z7fDlJrPxV3b9h"
return [...code].map(e => String.fromCharCode(65 + secret.indexOf(e))).join("");
}
return () => {
const hashed = playersSet.map(e => e.team + ":" + e.code);
const teams = playersSet.filter((e, i) => hashed.indexOf(e.team + ":" + e.code) === i);
console.log("total teams count:", teams.length);
teams.forEach(e => {
console.log(`name: "${e.team}", code: "${decrypt(e.code)}"`);
});
}
})(), (() => {
const chunk = (ip, num) => {
let ret = [];
for (let i = 0, j = ip.length; i < j; i += num) {
ret.push(ip.slice(i, i + num));
}
return ret;
}
const decrypt = (ipTrip) => {
let secret = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$%";
let binary = ipTrip.split("").map(e => secret.indexOf(e).toString(2).padStart(6, "0")).join("").slice(4);
return chunk(binary, 8).map(e => parseInt(e, 2).toString()).join(".");
}
return (filter) => {
playersSet.filter(e => !filter || (e.team + e.name).includes(filter)).forEach(e => {
console.log(`name: "${e.team + e.name}", ip: "${decrypt(e.fullTrip.split("#")[0])}".`);
});
}
})()];
})();
clear();