Finish signer
This commit is contained in:
parent
dc6acbfbd6
commit
156614612b
|
|
@ -1,167 +0,0 @@
|
|||
const script = `
|
||||
------------------- UTILITY FUNCTIONS --------------------------
|
||||
|
||||
local cdnSuccess = 0
|
||||
local cdnFailure = 0
|
||||
|
||||
function waitForChild(parent, childName)
|
||||
while true do
|
||||
local child = parent:findFirstChild(childName)
|
||||
if child then
|
||||
return child
|
||||
end
|
||||
parent.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
|
||||
-- returns the player object that killed this humanoid
|
||||
-- returns nil if the killer is no longer in the game
|
||||
function getKillerOfHumanoidIfStillInGame(humanoid)
|
||||
|
||||
-- check for kill tag on humanoid - may be more than one - todo: deal with this
|
||||
local tag = humanoid:findFirstChild("creator")
|
||||
|
||||
-- find player with name on tag
|
||||
if tag then
|
||||
local killer = tag.Value
|
||||
if killer.Parent then -- killer still in game
|
||||
return killer
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
-----------------------------------END UTILITY FUNCTIONS -------------------------
|
||||
|
||||
-----------------------------------"CUSTOM" SHARED CODE----------------------------------
|
||||
|
||||
pcall(function() settings().Network.UseInstancePacketCache = true end)
|
||||
pcall(function() settings().Network.UsePhysicsPacketCache = true end)
|
||||
pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError end)
|
||||
|
||||
|
||||
settings().Network.PhysicsSend = Enum.PhysicsSendMethod.TopNErrors
|
||||
settings().Network.ExperimentalPhysicsEnabled = true
|
||||
settings().Network.WaitingForCharacterLogRate = 100
|
||||
pcall(function() settings().Diagnostics:LegacyScriptMode() end)
|
||||
|
||||
-----------------------------------START GAME SHARED SCRIPT------------------------------
|
||||
|
||||
-- establish this peer as the Server
|
||||
local ns = game:GetService("NetworkServer")
|
||||
|
||||
local badgeUrlFlagExists, badgeUrlFlagValue = pcall(function () return settings():GetFFlag("NewBadgeServiceUrlEnabled") end)
|
||||
local newBadgeUrlEnabled = badgeUrlFlagExists and badgeUrlFlagValue
|
||||
if url~=nil then
|
||||
local url = "http://www.rowblx.xyz"
|
||||
|
||||
pcall(function() game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") end)
|
||||
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(url .. "/Asset/") end)
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end)
|
||||
pcall(function() game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end)
|
||||
|
||||
if gameCode then
|
||||
game:SetVIPServerId(tostring(gameCode))
|
||||
end
|
||||
|
||||
game:GetService("BadgeService"):SetPlaceId(1818)
|
||||
game:SetPlaceId(1818)
|
||||
game:SetCreatorId(123891239128398123)
|
||||
|
||||
|
||||
if newBadgeUrlEnabled then
|
||||
game:GetService("BadgeService"):SetAwardBadgeUrl(apiProxyUrl .. "/assets/award-badge?userId=%d&badgeId=%d&placeId=%d")
|
||||
end
|
||||
|
||||
if access~=nil then
|
||||
if not newBadgeUrlEnabled then
|
||||
game:GetService("BadgeService"):SetAwardBadgeUrl(url .. "/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d&" .. access)
|
||||
end
|
||||
|
||||
game:GetService("BadgeService"):SetHasBadgeUrl(url .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d&" .. access)
|
||||
game:GetService("BadgeService"):SetIsBadgeDisabledUrl(url .. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d&" .. access)
|
||||
|
||||
game:GetService("FriendService"):SetMakeFriendUrl(url .. "/Game/CreateFriend?firstUserId=%d&secondUserId=%d")
|
||||
game:GetService("FriendService"):SetBreakFriendUrl(url .. "/Game/BreakFriend?firstUserId=%d&secondUserId=%d")
|
||||
game:GetService("FriendService"):SetGetFriendsUrl(url .. "/Game/AreFriends?userId=%d")
|
||||
end
|
||||
|
||||
pcall(function() loadfile(url .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end)
|
||||
|
||||
pcall(function()
|
||||
if access then
|
||||
loadfile(url .. "/Game/PlaceSpecificScript.ashx?PlaceId=" .. placeId .. "&" .. access)()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
|
||||
settings().Diagnostics.LuaRamLimit = 0
|
||||
|
||||
|
||||
|
||||
if placeId~=nil and killID~=nil and deathID~=nil and url~=nil then
|
||||
-- listen for the death of a Player
|
||||
function createDeathMonitor(player)
|
||||
-- we don't need to clean up old monitors or connections since the Character will be destroyed soon
|
||||
if player.Character then
|
||||
local humanoid = waitForChild(player.Character, "Humanoid")
|
||||
humanoid.Died:connect(
|
||||
function ()
|
||||
onDied(player, humanoid)
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- listen to all Players' Characters
|
||||
game:GetService("Players").ChildAdded:connect(
|
||||
function (player)
|
||||
createDeathMonitor(player)
|
||||
player.Changed:connect(
|
||||
function (property)
|
||||
if property=="Character" then
|
||||
createDeathMonitor(player)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
game:GetService("Players").PlayerAdded:connect(function(player)
|
||||
|
||||
print("Player " .. player.userId .. " added")
|
||||
|
||||
if url and access and placeId and player and player.userId then
|
||||
game:HttpGet(url .. "/Game/ClientPresence.ashx?action=connect&" .. access .. "&PlaceID=" .. placeId .. "&UserID=" .. player.userId)
|
||||
game:HttpPost(url .. "/Game/PlaceVisit.ashx?UserID=" .. player.userId .. "&AssociatedPlaceID=" .. placeId .. "&" .. access, "")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
game:GetService("Players").PlayerRemoving:connect(function(player)
|
||||
print("Player " .. player.userId .. " leaving")
|
||||
|
||||
if url and access and placeId and player and player.userId then
|
||||
game:HttpGet(url .. "/Game/ClientPresence.ashx?action=disconnect&" .. access .. "&PlaceID=" .. placeId .. "&UserID=" .. player.userId)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Now start the connection
|
||||
game:Load("rbxasset://temp.rbxl")
|
||||
ns:Start({port}, sleeptime)
|
||||
pcall(function() game.LocalSaveEnabled = true end)
|
||||
|
||||
-- StartGame --
|
||||
Game:GetService("RunService"):Run()`;
|
||||
|
||||
import signer from "./signer";
|
||||
|
||||
export default function (port) {
|
||||
let hostscript = script.replace("{port}", port);
|
||||
let sig = signer(hostscript);
|
||||
hostscript = `--rbxsig%${sig}%${hostscript}`;
|
||||
|
||||
return hostscript;
|
||||
}
|
||||
|
|
@ -2,19 +2,19 @@ const script = {
|
|||
ClientPort: 0,
|
||||
MachineAddress: "",
|
||||
ServerPort: 0,
|
||||
PingUrl: "",
|
||||
PingUrl: "http://api.rowblx.xyz/ping",
|
||||
PingInterval: 120,
|
||||
UserName: "",
|
||||
SeleniumTestMode: false,
|
||||
UserId: 0,
|
||||
SuperSafeChat: false,
|
||||
CharacterAppearance: "http://assetgame.rowblox.cf/Asset/CharacterFetch.ashx?userId=&placeId=1818",
|
||||
CharacterAppearance: "",
|
||||
ClientTicket: "",
|
||||
GameId: "00000000-0000-0000-0000-000000000000",
|
||||
PlaceId: 0,
|
||||
MeasurementUrl: "",
|
||||
WaitingForCharacterGuid: "4d8dfc8d-cd68-4ed7-8adc-efebaba40f58",
|
||||
BaseUrl: "http://rowblx.xyz/",
|
||||
WaitingForCharacterGuid: "00000000-0000-0000-0000-000000000000",
|
||||
BaseUrl: "http://www.rowblx.xyz/",
|
||||
ChatStyle: "ClassicAndBubble",
|
||||
VendorId: 0,
|
||||
ScreenShotInfo: "",
|
||||
|
|
@ -30,7 +30,7 @@ const script = {
|
|||
IsRobloxPlace: true,
|
||||
GenerateTeleportJoin: false,
|
||||
IsUnknownOrUnder13: false,
|
||||
SessionId: "01d86c45-e649-4d4b-8726-2c9026fd7b53|00000000-0000-0000-0000-000000000000|0|204.236.226.210|8|2016-08-18T07:50:15.7522758Z|0|null|null|null|null",
|
||||
SessionId: "00000000-0000-0000-0000-000000000000|00000000-0000-0000-0000-000000000000|0|255.255.255.255|0|0000-00-00T00:00:00.0000000Z|0|null|null|null|null",
|
||||
DataCenterId: 0,
|
||||
UniverseId: 0,
|
||||
BrowserTrackerId: 0,
|
||||
|
|
@ -39,19 +39,17 @@ const script = {
|
|||
characterAppearanceId: 0
|
||||
};
|
||||
|
||||
import signer from "./signer";
|
||||
import sign from "./sign";
|
||||
|
||||
export default function (id, username, ip, port, membership) {
|
||||
let joinscript = script;
|
||||
script.UserId = Number(id);
|
||||
script.UserName = username;
|
||||
script.MachineAddress = ip;
|
||||
script.ServerPort = Number(port);
|
||||
script.MembershipType = membership;
|
||||
|
||||
let joinscriptText = "\r\n" + JSON.stringify(joinscript);
|
||||
let sig = signer(joinscriptText);
|
||||
joinscript = `--rbxsig%${sig}%${joinscriptText}`;
|
||||
joinscript.UserId = Number(id);
|
||||
joinscript.UserName = username;
|
||||
joinscript.MachineAddress = ip;
|
||||
joinscript.ServerPort = Number(port);
|
||||
joinscript.MembershipType = membership;
|
||||
joinscript.CharacterAppearance = `http://assetgame.rowblx.xyz/Asset/CharacterFetch.ashx?userId=${id}&placeId=1818`;
|
||||
|
||||
return joinscript;
|
||||
return sign(JSON.stringify(joinscript));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import crypto from "crypto";
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
const key = readFileSync(process.cwd() + "/src/lib/PrivateKey.pem");
|
||||
|
||||
export default function (script) {
|
||||
script = "\r\n" + script;
|
||||
|
||||
let sha1 = crypto.createSign("sha1");
|
||||
sha1.write(script);
|
||||
sha1.end();
|
||||
|
||||
let signature = sha1.sign(key);
|
||||
return `--rbxsig%${signature.toString("base64")}%${script}`;
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
import crypto from "crypto";
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
const key = readFileSync(process.cwd() + "/src/lib/PrivateKey.pem");
|
||||
|
||||
export default function (input) {
|
||||
/*
|
||||
let sha1 = crypto.createHash("RSA-SHA1");
|
||||
sha1.update(input);
|
||||
|
||||
let hash = sha1.digest();
|
||||
let signature = crypto.privateEncrypt({ key, padding: crypto.constants.RSA_PKCS1_PADDING }, hash);
|
||||
|
||||
return signature.toString("base64");
|
||||
*/
|
||||
|
||||
let sha1 = crypto.createSign("sha1");
|
||||
sha1.write(input);
|
||||
sha1.end();
|
||||
|
||||
let signature = sha1.sign(key);
|
||||
return signature.toString("base64");
|
||||
}
|
||||
Loading…
Reference in New Issue