1 | local function scanBackdoors() |
2 | if remoteInfo.foundBackdoor then return end |
3 | local remotesList = getRemotes() |
4 | local nonce = generateRandString(32, true) |
5 | |
6 | local connection; |
7 | connection = logService.AttributeChanged:Connect(function(attributeName) |
8 | if attributeName ~= nonce then return end connection:Disconnect() |
9 | local remoteResult = string.split(logService:GetAttribute(nonce), "|") |
10 | local remoteObj = remotesList[remoteResult[1]] |
11 | local payloadInfo = config.backdoorPayloads[remoteResult[2]] |
12 | |
13 | task.spawn(onAttached, { |
14 | ["instance"] = remoteObj, |
15 | ["args"] = payloadInfo.Args, |
16 | ["argSrcIndex"] = table.find(payloadInfo.Args, "source"), |
17 | ["payloadName"] = remoteResult[2] |
18 | }) |
19 | end) |
20 | |
21 | for remoteObjId, remoteObj in remotesList do runService.Heartbeat:Wait() |
22 | if remoteInfo.foundBackdoor then break end |
23 | |
24 | logToConsole("print", string.format(msgOutputs.printRemote, getFullNameOf(remoteObj), remoteObjId, remoteObj.ClassName)) |
25 | testRemote(nonce, remoteObj, remoteObjId) |
26 | end |
27 | |
28 | waitUntil(2.5, function() return not connection.Connected end) |
29 | task.defer(connection.Disconnect, connection) |
30 | end |
31 | -- main |
32 | do -- config initialization |
33 | if not isfolder(CONSTANTS.FOLDER_NAME) then |
34 | makefolder(CONSTANTS.FOLDER_NAME) |
35 | end |
36 | |
37 | local rawConfigFile = ( |
38 | if isfile(`{CONSTANTS.FOLDER_NAME}/config.lua`) then |
39 | readfile(`{CONSTANTS.FOLDER_NAME}/config.lua`) |
40 | else game:HttpGet(CONSTANTS.CONFIG_URL) |
41 | ) |
42 | local loadSuccess, loadedConfig do |
43 | loadSuccess, loadedConfig = pcall(loadstring(rawConfigFile)) |
44 | |
45 | if (not loadSuccess) then |
46 | newNotification(msgOutputs.configLoadFailed) |
47 | rawConfigFile = game:HttpGet(CONSTANTS.CONFIG_URL) |
48 | loadedConfig = loadstring(rawConfigFile)() |
49 | end |
50 | end |
51 | local successCount = 0 |
52 | |
53 | successCount += (if typeof(loadedConfig.autoExec) == "table" then 1 else 0) |
54 | successCount += (if typeof(loadedConfig.remoteFilters) == "table" then 1 else 0) |
55 | successCount += (if typeof(loadedConfig.scriptMacros) == "table" then 1 else 0) |
56 | successCount += (if typeof(loadedConfig.backdoorPayloads) == "table" then 1 else 0) |
57 | successCount += (if typeof(loadedConfig.cachedPlaces) == "table" then 1 else 0) |
58 | |
59 | if (loadedConfig.configVer < 9 or successCount < 5) then newNotification(msgOutputs.outdatedConfig) end |
60 | config = loadedConfig |
61 | |
62 | for payloadName, payloadInfo in config.backdoorPayloads do |
63 | local payloadInfoClone = table.clone(payloadInfo) |
64 | payloadInfoClone.Name = payloadName |
65 | |
66 | table.insert(payloadList, payloadInfoClone) |
67 | end |
68 | |
69 | table.sort(payloadList, function(tbl1, tbl2) |
70 | local tbl1Priority, tbl2Priority = |
71 | math.clamp((tbl1.Priority or 1024), 1, 1024), math.clamp((tbl2.Priority or 1024), 1, 1024) |
72 | return tbl1Priority < tbl2Priority |
73 | end) |
74 | end |
75 | do -- backdoor finding |
76 | local placeCacheData = config.cachedPlaces[game.PlaceId] |
77 | |
78 | if placeCacheData then |
79 | local successCount = 0 |
80 | local remoteObj = (if typeof(placeCacheData.Remote) == "string" then pathToInstance(placeCacheData.Remote) else placeCacheData.Remote) |
81 | local argSrcIndex = (if typeof(placeCacheData.Args) == "table" then table.find(placeCacheData.Args, "source") else nil) |
82 | |
83 | successCount += (if (typeof(remoteObj) == "Instance" and (remoteObj:IsA("RemoteEvent") or remoteObj:IsA("RemoteFunction"))) then 1 else 0) |
84 | successCount += (if typeof(argSrcIndex) == "number" then 1 else 0) |
85 | |
86 | if successCount >= 2 then |
87 | newNotification(string.format(msgOutputs.cacheLoaded, game.PlaceId)) |
88 | onAttached({ |
89 | ["instance"] = remoteObj, |
90 | ["srcFunc"] = placeCacheData.SourceFunc, |
91 | ["args"] = placeCacheData.Args, |
92 | ["argSrcIndex"] = argSrcIndex |
93 | }) |
94 | else |
95 | newNotification(string.format(msgOutputs.cacheFailed, game.PlaceId)) |
96 | end |
97 | else |
98 | local startTime = os.clock() |
99 | |
100 | newNotification(msgOutputs.scanMsg1);newNotification(msgOutputs.scanMsg2) |
101 | scanBackdoors() |
102 | newNotification(string.format(msgOutputs.scanBenchmark, os.clock() - startTime)) |
103 | |
104 | if not remoteInfo.foundBackdoor then -- if no backdoor found |
105 | logToConsole("warn", msgOutputs.noBackdoorRemote) |
106 | newNotification(msgOutputs.noBackdoorRemote) |
107 | end |
108 | end |
109 | end |
110 | end) |
111 | end |
112 | coroutine.wrap(VHLYAY_fake_script)() |