forked from TheCrazyInsanity/nodeblox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
150 lines (148 loc) · 5.13 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
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
var children = [];
//Why have many file, when can have one big file?
async function openclient(cookiehere, gameid, jobid) {
let authticket = null
let version = null
const delay = require('delay');
const {
exec
} = require("child_process");
const noblox = require('noblox.js')
const cookie = cookiehere
var XCSRF = "If you see this something fucked up"
async function xscrffuckin() {
const currentUser = await noblox.setCookie(cookie)
//Use noblox to set the cookie it is going to use
console.log(`Preparing to join using ${currentUser.UserName} [${currentUser.UserID}]`)
XCSRF = await noblox.getGeneralToken()
//Get the xcsrf token using noblox, would have helped to know this earlier :/
console.log(`Got XCSRF token: ${XCSRF}`);
}
await xscrffuckin()
const axios = require('axios')
async function authticketfuckin() {
let dumb = 1
//Axios post request to get an auth ticket
dumb = axios({
method: 'POST',
url: 'https://auth.roblox.com/v1/authentication-ticket',
maxRedirects: 0,
//Prevent redirects, useless but has no reason to be removed
data: {},
headers: {
'x-csrf-token': XCSRF,
'referer': 'https://www.roblox.com/', //>:(
Cookie: `.ROBLOSECURITY=${cookie}`
}
}).then(response => {
console.log(`YOOO AUTH TICKET LETS GO ${response.headers['rbx-authentication-ticket']}`) //Also fuck you but less
authticket = response.headers['rbx-authentication-ticket']
}).catch(err => {
console.log(err.response.data)
})
}
await authticketfuckin()
//Axios get request to get the version number of roblox, so you dont have to update the script everytime you update roblox
async function versionfuckin() {
axios({
method: 'GET',
url: 'https://s3.amazonaws.com/setup.roblox.com/version',
maxRedirects: 0,
//Prevent redirects, useless but has no reason to be removed
data: {},
headers: {}
}).then(response => {
console.log(`Current roblox version: ${response.data}`)
version = response.data
}).catch(err => {
console.log(err.response.data)
})
}
await versionfuckin()
//Set variable time to current time in utc
let time = new Date().getTime()
//Get browser id ( >:( )
var browseridlinksex = "Oops"
async function urlfuckin() {
browseridlinksex = `https://assetgame.roblox.com/game/PlaceLauncher.ashx?request=RequestGameJob^&browserTrackerId=${time}^&placeId=${gameid}^&gameId=${jobid}^&isPlayTogetherGame=false`
console.log(browseridlinksex)
}
await urlfuckin()
await delay(1000)
async function openfuckin() {
await delay(1000)
var launchoptions = `"C:/Program Files (x86)/Roblox/Versions/${version}/RobloxPlayerBeta.exe" --play -t ${authticket} -j ${browseridlinksex} -b ${time} --launchtime=${time} --rloc en_us --gloc en_us`
console.log(launchoptions)
children.push(exec(launchoptions).pid)
}
openfuckin()
//func end, dont place below here
}
//openclient(cookie, gameid, jobid)
exports.openclient = openclient
function execute(filelocation, scriplets) {
//Function taken from burkino, many thanks!
function chunk(s, maxBytes) {
let buf = Buffer.from(s);
const result = [];
while (buf.length) {
result.push(buf.slice(0, maxBytes).toString());
buf = buf.slice(maxBytes);
}
return result;
}
const fs = require('fs');
//Stolen example code from ws, idk how to use it
const WebSocketServer = require('ws').Server;
const wss = new WebSocketServer({
port: 123
});
wss.on('connection', function connection(ws) {
ws.on('message', function message(data) {
console.log('received: %s', data);
//Should be a switch statement, but doing the smart thing broke it
if (data == "ready") {
console.log("client is ready, send the script")
ws.send("start")
//Script procesing and stuff here idk
var rawscript = fs.readFileSync(filelocation)
var scripletarr = scriplets.split(",")
var index = 1
scripletarr.forEach((scripletarr) => {
rawscript = `scripletarg` + index + `=` + scripletarr + `
` + rawscript
index = index + 1
})
console.log(rawscript)
var script = chunk(rawscript, 60000)
script.forEach((script) => {
ws.send(script);
});
ws.send("end")
}
if (data == "ok kys") {
console.log("client is done, close the connection")
//Close the connection
ws.close()
}
if (data != "ready" && data != "ok kys") {
console.log("unrecognized message, saved as a return (when i add it lol)")
}
});
});
}
//execute(location to script, scriplets)
//execute("./scripletexample.lua", `"1","2","3"`) Check example scripletexample.lua, this would print 1 2 3 seperately in console
exports.execute = execute
function killall() {
console.log("If This ever says killing 2, something is broken very bad")
console.log('killing', children.length, 'child processes');
children.forEach(function(child) {
var spawn = require('child_process').spawn;
spawn("taskkill", ["/pid", children, '/f', '/t']);
//Remove the child process from the array
children.splice(children.indexOf(child), 1);
});
};
//killall() No arguments as of yet
exports.killall = killall