-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.lua
More file actions
319 lines (242 loc) · 8.6 KB
/
Test.lua
File metadata and controls
319 lines (242 loc) · 8.6 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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
local PandaAuth = (function()
--[[
PandaAuth authentification library version : 5.0.0
ETA : Under Development
Developer: Sponsoparnordvpn
--]]
local service = setmetatable({}, {
__index = function(self, key)
return cloneref(game.GetService(game, key))
end
})
local LibVersion = "Panda AAL"
local request = clonefunction(request)
local HttpService = cloneref(service.HttpService)
local RbxAnalyticsService = cloneref(service.RbxAnalyticsService)
local StarterGui = cloneref(service.StarterGui)
local Players = cloneref(service.Players)
local Host = "https://pandadevelopment.net"
local AuthHost = "https://auth.pandadevelopment.net"
local LocalPlayer = Players.LocalPlayer
local Internal = {}
local PandaAuth = {["Version"] = LibVersion}
local Identity = {}
local Crypt = {}
local Time = {}
function Identity.GetID(self)
local JSONData = HttpService:JSONDecode(game:HttpGet(AuthHost .. "/serviceapi?service=" .. Internal.Service .. "&command=getconfig"))
local client_id = RbxAnalyticsService:GetClientId()
if JSONData and JSONData.AuthMode then
if JSONData.AuthMode:lower() == "playerid" then
return tostring(LocalPlayer.UserId)
elseif JSONData.AuthMode:lower() == "hwidplayer" then
return client_id --.. tostring(LocalPlayer.UserId)
elseif JSONData.AuthMode:lower() == "hwidonly" then
return client_id
else
return tostring(LocalPlayer.UserId)
end
end
end
function Crypt.EncryptC(self, PlainText, Key)
PlainText = string.upper(PlainText)
Key = string.upper(Key)
local EncryptedText = ""
for i = 1, #PlainText do
local char = string.byte(PlainText, i)
if char >= 65 and char <= 90 then
EncryptedText = EncryptedText .. string.char(
((char + Key:byte(i % #Key + 1) - 2 * 65) % 26) + 65
)
else
EncryptedText = EncryptedText .. string.char(char)
end
end
return EncryptedText
end
function Crypt.Bitxor(self, a, b)
local Xor_result = 0
local Bitval = 1
while a > 0 or b > 0 do
local a_bit = a % 2
local b_bit = b % 2
if a_bit ~= b_bit then
Xor_result = Xor_result + Bitval
end
Bitval = Bitval * 2
a = math.floor(a / 2)
b = math.floor(b / 2)
end
return Xor_result
end
function Crypt.XorDecrypt(self, Encrypted, Key)
local Decrypted = ''
for i = 1, #Encrypted do
Decrypted = Decrypted .. string.char(Crypt:Bitxor(string.byte(Encrypted, i), string.byte(Key, (i - 1) % #Key + 1)))
end
return Decrypted
end
local GivenDate = "2027-01-21T00:00:00.000Z"
function Time.CompareDate(self, givenDateStr)
local givenYear, givenMonth, givenDay, givenHour, givenMin, givenSec =
givenDateStr:match("(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+).%d+Z")
givenYear, givenMonth, givenDay, givenHour, givenMin, givenSec =
tonumber(givenYear), tonumber(givenMonth), tonumber(givenDay),
tonumber(givenHour), tonumber(givenMin), tonumber(givenSec)
local currentYear, currentMonth, currentDay, currentHour, currentMin, currentSec =
os.date("!%Y,%m,%d,%H,%M,%S"):match("(%d+),(%d+),(%d+),(%d+),(%d+),(%d+)")
currentYear, currentMonth, currentDay, currentHour, currentMin, currentSec =
tonumber(currentYear), tonumber(currentMonth), tonumber(currentDay),
tonumber(currentHour), tonumber(currentMin), tonumber(currentSec)
local isToday = givenYear == currentYear and givenMonth == currentMonth and givenDay == currentDay
if isToday then
return true
elseif givenYear < currentYear or
(givenYear == currentYear and (givenMonth < currentMonth or
(givenMonth == currentMonth and (givenDay < currentDay or
(givenDay == currentDay and
(givenHour < currentHour or
(givenHour == currentHour and
(givenMin < currentMin or
(givenMin == currentMin and
givenSec < currentSec))))))))) then
return false
else
return true
end
end
function PandaAuth.Set(self, Settings)
Internal.Service = string.lower(Settings.Service) or error("Please make sure to set your service.")
Internal.APIToken = Settings.APIToken or error("Please make sure to set APIToken")
Internal.TrueEndpoint = Settings.TrueEndpoint and string.lower(Settings.TrueEndpoint) or "true"
Internal.FalseEndpoint = Settings.FalseEndpoint and string.lower(Settings.FalseEndpoint) or "false"
Internal.Debug = Settings.Debug or false
Internal.ViginereKey = Settings.ViginereKey
if Internal.Debug == true then
warn("=======================================")
warn("Welcome to PandaAuth Development!")
warn("Library Version:", (LibVersion or "Unknown"))
warn("Utility:", tostring(identifyexecutor()))
warn("=======================================")
end
end
function PandaAuth.Get(self)
return {PandaAuth = PandaAuth, Internal = Internal, Identity = Identity, Crypt = Crypt, Time = Time}
end
function PandaAuth.Debug(self, ...)
if Internal.Debug then
warn("[DEBUG]", ...)
end
end
function PandaAuth.SHA256(self, Str)
local Hashed = game:HttpGet(AuthHost .. "/serviceapi?service=" .. Internal.Service .. "&command=hashed¶m=" .. Str)
if Hashed then
PandaAuth:Debug("Successfully hashed the data to:", string.upper(Hashed))
return string.upper(Hashed)
else
return PandaAuth:Debug("Couldn't hash the data")
end
end
function PandaAuth.ValidateKey(self, Key)
local Url = AuthHost .. "/validate?service=" .. Internal.Service .. "&hwid=" .. Identity:GetID() .. "&key=" .. Key
local response = request({
Url = Url;
Method = "GET";
})
local success, result = pcall(function()
local Decrypted = Crypt:XorDecrypt(response.Body, Internal.APIToken)
return HttpService:JSONDecode(Decrypted)
end)
PandaAuth:Debug("Response Status Code:", response.StatusCode)
local function New(Endpoint)
local Hashed = PandaAuth:SHA256(Endpoint)
return {
["Encrypted"] = Crypt:EncryptC(Hashed, Internal.ViginereKey);
["Premium"] = result["isPremium"];
}
end
if response.StatusCode == 200 and success then
if result["service"] ~= Internal.Service then
PandaAuth:Debug("\xE2\x9D\x8C - Service Mismatch.")
return New(Internal.FalseEndpoint)
end
local time = result["expiresAt"]
if result["success"] == "Authorized_" .. Internal.Service and Time:CompareDate(time) then
PandaAuth:Debug("\xE2\x9C\x85 - Successfully validated key.", "\nPremium:", result["isPremium"])
return New(Internal.TrueEndpoint)
end
else
if response.StatusCode == 401 then
PandaAuth:Debug("\xE2\x9D\x8C - Your key is not valid.")
return New(Internal.FalseEndpoint)
elseif response.StatusCode == 404 then
PandaAuth:Debug("\xE2\x9D\x8C - Could not find the server.")
return New(Internal.FalseEndpoint)
elseif response.StatusCode == 406 then
PandaAuth:Debug("\xF0\x9F\x94\xA8 - User Account banned.")
return New(Internal.FalseEndpoint)
elseif not success then
PandaAuth:Debug("\xE2\x9D\x8C - Could not decrypt the server data.", "\n", result)
return New(Internal.FalseEndpoint)
else
PandaAuth:Debug("\xE2\x9A\xA0\ - Unknown response, please contact us.", response.StatusCode)
return New(Internal.FalseEndpoint)
end
end
end
function PandaAuth.ResetHWID(self, Key)
local success, result = pcall(function()
return HttpService:JSONDecode(request({Url = Host .. "/serviceapi/edit/hwid/?service=" .. Internal.Service.."&key=" .. Key .. "&newhwid=" .. Identity:GetID(), Method = "POST"}).Body)
end)
if success then
PandaAuth:Debug("\xE2\x9C\x85 - Successfully reinitialised your HWID !")
return true
else
PandaAuth:Debug("\xE2\x9D\x8C - Something went wront while reinitialising your HWID !")
for i, v in pairs(result) do
PandaAuth:Debug("Data : " .. i, v)
end
return false
end
end
function PandaAuth.GetKey(self)
local Url = AuthHost .. "/getkey?service=" .. Internal.Service .. "&hwid=" .. Identity:GetID();
PandaAuth:Debug("\xE2\x9C\x85 - Generated link successfully:", Url)
return Url
end
do
setmetatable(PandaAuth,
{
__index = function(self, key)
return rawget(self, key)
end,
__newindex = function(self,key,value)
error("Don't try to modify \xF0\x9F\x92\x80", 2)
end,
__metatable = "This metatable is protected."
}
)
end
return PandaAuth
end)()
PandaAuth:Set({
ViginereKey = "Meow?",
Service = "Infinix",
APIToken = "Meow?",
Debug = false,
})
local True = PandaAuth:Get().Crypt:EncryptC(PandaAuth:SHA256(PandaAuth:Get().Internal.TrueEndpoint), PandaAuth:Get().Internal.ViginereKey)
local False = PandaAuth:Get().Crypt:EncryptC(PandaAuth:SHA256(PandaAuth:Get().Internal.FalseEndpoint), PandaAuth:Get().Internal.ViginereKey)
local function ValidateKey(Key)
print("Validating", Key)
local result = PandaAuth:ValidateKey(Key)
if result["Encrypted"] == True then
print("Validated", Key)
if result["Premium"] == true then
print("Key is premium.")
else
warn("Key is not premium.")
end
end
end
ValidateKey(readfile("Infinix"))