-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver
More file actions
265 lines (217 loc) · 8.89 KB
/
server
File metadata and controls
265 lines (217 loc) · 8.89 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
local USER_CREDENTIALS = {
username = "akagikay",
password = "12345t"
}
-- TOGGLE DEBUG MODE HERE
local DEBUG_MODE = false
local PING_INTERVAL = 120
local INVENTORY_INTERVAL = 120
local INITIAL_WAIT = 120
-- CHUNKING CONFIG (Safe size for Executors)
local CHUNK_SIZE = 50 * 1024 -- 50 KB chunks
local URLS = {
RECEPTOR = "https://raw.githubusercontent.com/akagikay/adoptmemanager/refs/heads/main/receptor_url.txt",
KEEPALIVE = "https://raw.githubusercontent.com/akagikay/adoptmemanager/refs/heads/main/keepalive_url.txt"
}
local TARGET_MODULE_PATH = "ClientStore"
local BASE_SERVICE_PATH = game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("Core")
--================================================================================
-- HTTP & UTILITIES
--================================================================================
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer or Players.PlayerAdded:Wait()
local http_request = (syn and syn.request) or (http and http.request) or (fluxus and fluxus.request) or request
if not http_request then
warn("CRITICAL: This script requires an executor with a custom request() function.")
return
end
local function fetch_dynamic_url(github_url)
local success, response = pcall(function()
return game:HttpGet(github_url)
end)
if success and response then
return response:gsub("^%s*(.-)%s*$", "%1")
end
return nil
end
--================================================================================
-- CHUNKING LOGIC
--================================================================================
local function chunk_and_send(serverUrl, dataTable)
-- 1. Encode the full data to JSON first
local success, jsonString = pcall(function()
return HttpService:JSONEncode(dataTable)
end)
if not success then
return warn("[Chunking] JSON Encode failed. Data might be recursive or invalid.")
end
local totalLen = #jsonString
local transferId = HttpService:GenerateGUID(false)
local chunkCount = math.ceil(totalLen / CHUNK_SIZE)
print(string.format("[Chunking] Payload size: %.2f MB. Splitting into %d chunks.", totalLen / 1024 / 1024, chunkCount))
for i = 1, chunkCount do
-- Calculate substring indices
local startIdx = ((i - 1) * CHUNK_SIZE) + 1
local endIdx = math.min(i * CHUNK_SIZE, totalLen)
local chunkData = string.sub(jsonString, startIdx, endIdx)
-- Create the metadata payload
local payload = {
transfer_id = transferId,
chunk_index = i - 1, -- Python uses 0-based indexing usually, but logic handles it
total_chunks = chunkCount,
data = chunkData
}
local chunkJson = HttpService:JSONEncode(payload)
-- Send Chunk
local response = http_request({
Url = serverUrl .. "/receive-data",
Method = "POST",
Headers = { ["Content-Type"] = "application/json" },
Body = chunkJson
})
if not response or (response.StatusCode ~= 200 and response.Status ~= 200) then
warn("[Chunking] Failed to send chunk " .. i .. ". Aborting transfer.")
return false
end
-- Small wait to prevent client freezing between HTTP calls
task.wait(0.1)
end
print("[Chunking] Transfer complete.")
return true
end
--================================================================================
-- DATA EXTRACTION & CLEANING
--================================================================================
local function clean_inventory(rawData)
if type(rawData) ~= "table" then return rawData end
local cleaned = {}
for category, items in pairs(rawData) do
if type(items) == "table" then
cleaned[category] = {}
for uid, itemData in pairs(items) do
if type(itemData) == "table" then
local newItem = {}
newItem.id = itemData.id
newItem.oid = itemData.oid
newItem.count = itemData.count
if itemData.properties then
newItem.age = itemData.properties.age
newItem.rideable = itemData.properties.rideable
newItem.flyable = itemData.properties.flyable
newItem.neon = itemData.properties.neon -- NEW
newItem.mega_neon = itemData.properties.mega_neon -- NEW
newItem.pumping = itemData.properties.pumping
else
newItem.age = itemData.age
newItem.rideable = itemData.rideable
newItem.flyable = itemData.flyable
newItem.neon = itemData.neon -- NEW
newItem.mega_neon = itemData.mega_neon -- NEW
newItem.pumping = itemData.pumping
end
cleaned[category][uid] = newItem
else
cleaned[category][uid] = itemData
end
end
else
cleaned[category] = items
end
end
return cleaned
end
local function getModuleFromPath(base, path)
local current = base
for segment in path:gmatch("[^.]+") do
if not current then return nil end
current = current:FindFirstChild(segment)
end
return current
end
local function extractInventory(data)
if type(data) == "table" and data.store and data.store._state and data.store._state.inventory then
return data.store._state.inventory
end
return nil
end
local function getBucksValue()
local success, result = pcall(function()
local playerGui = LocalPlayer:WaitForChild("PlayerGui", 20)
local bucksApp = playerGui:WaitForChild("BucksIndicatorApp", 20)
local indicator = bucksApp:WaitForChild("CurrencyIndicator", 20)
local container = indicator:WaitForChild("Container", 20)
local label = container:WaitForChild("Amount", 20)
local cleanText = string.gsub(label.Text, "[^%d%.]", "")
return tonumber(cleanText)
end)
if success and result then return result end
return nil
end
--================================================================================
-- SENDING FUNCTIONS
--================================================================================
local function sendInventory()
print("[Inventory] Collecting data...")
local serverUrl = fetch_dynamic_url(URLS.RECEPTOR)
if not serverUrl then return warn("[Inventory] Could not fetch Server URL") end
local moduleScript = getModuleFromPath(BASE_SERVICE_PATH, TARGET_MODULE_PATH)
if not moduleScript then return warn("[Inventory] ClientStore not found") end
local success, result = pcall(require, moduleScript)
if not success then return warn("[Inventory] Failed to require ClientStore") end
local rawInv = extractInventory(result)
if not rawInv then return warn("[Inventory] Inventory table is nil") end
local finalInv = nil
if DEBUG_MODE then
print("[Inventory] DEBUG MODE ON: Sending RAW data.")
finalInv = rawInv -- Send the raw table without cleaning
else
print("[Inventory] Processing and cleaning data...")
finalInv = clean_inventory(rawInv)
finalInv.bucks = getBucksValue()
end
-- Final Object
local dataObj = {
creds = string.format("%s:%s:%s", USER_CREDENTIALS.username, USER_CREDENTIALS.password, LocalPlayer.Name),
inv = finalInv,
debug = DEBUG_MODE -- Tell server how to handle this
}
-- Send using the Chunking System
chunk_and_send(serverUrl, dataObj)
end
local function sendPing()
local tunnelUrl = fetch_dynamic_url(URLS.KEEPALIVE)
if not tunnelUrl then return end
local payload = {
user = USER_CREDENTIALS.username,
password = USER_CREDENTIALS.password,
roblox_username = LocalPlayer.Name
}
http_request({
Url = tunnelUrl .. "/ping",
Method = "POST",
Headers = { ["Content-Type"] = "application/json" },
Body = HttpService:JSONEncode(payload)
})
end
--================================================================================
-- THREAD EXECUTION
--================================================================================
if not game:IsLoaded() then game.Loaded:Wait() end
-- Ping Loop
task.spawn(function()
while true do
sendPing()
task.wait(PING_INTERVAL)
end
end)
-- Inventory Loop
task.spawn(function()
print("Inventory Thread Started - Waiting " .. INITIAL_WAIT .. "s for GUI load...")
task.wait(INITIAL_WAIT)
while true do
sendInventory()
print("Inventory sent (Chunked). Sleeping for 12 hours...")
task.wait(INVENTORY_INTERVAL)
end
end)