-
Notifications
You must be signed in to change notification settings - Fork 0
/
nez
2727 lines (2368 loc) · 72.1 KB
/
nez
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--!native
--!optimize 2
local NEZUR_UNIQUE = "%NEZUR_UNIQUE_ID%"
local HttpService, UserInputService, InsertService = game:FindService("HttpService"), game:FindService("UserInputService"), game:FindService("InsertService")
local RunService, CoreGui = game:FindService("RunService"), game:FindService("CoreGui")
local VirtualInputManager = Instance.new("VirtualInputManager")
if CoreGui:FindFirstChild("Nezur") then return end
local NezurContainer = Instance.new("Folder", CoreGui)
NezurContainer.Name = "Nezur"
local objectPointerContainer, scriptsContainer = Instance.new("Folder", NezurContainer), Instance.new("Folder", NezurContainer)
objectPointerContainer.Name = "Instance Pointers"
scriptsContainer.Name = "Scripts"
local n_game = newproxy(true);
local old_game = game;
local Nezur = {
about = {
_name = 'Nezur',
_version = '%NEZUR_VERSION%'
},
shared = {
globalEnv = { game = n_game }
},
}
table.freeze(Nezur.about)
local coreModules = {}
for _, descendant in CoreGui.RobloxGui.Modules:GetDescendants() do
if descendant.ClassName == "ModuleScript" then
table.insert(coreModules, descendant)
end
if #coreModules > 5000 then
break
end
end
local libs = {
{
['name'] = "HashLib",
['url'] = "https://pastebinp.com/raw/PfzWRgqf"
},
{
['name'] = "lz4",
['url'] = "https://pastebinp.com/raw/TDx5kkUV"
},
{
['name'] = "DrawingLib",
['url'] = "https://pastebinp.com/raw/p9ixiaDf"
}
}
local PROTECTED_SERVICES = {
["AppUpdateService"] = {
"DisableDUAR",
"DisableDUARAndOpenSurvey",
"PerformManagedUpdate"
},
["AssetManagerService"] = {
"GetFilename",
"Upload",
"AssetImportSession",
"AddNewPlace",
"PublishLinkedSource"
},
["AssetService"] = {
"SavePlaceAsync"
},
["AvatarEditorService"] = {
"NoPromptCreateOutfit",
"NoPromptDeleteOutfit",
"NoPromptRenameOutfit",
"NoPromptSaveAvatar",
"NoPromptSaveAvatarThumbnailCustomization",
"NoPromptSetFavorite",
"NoPromptUpdateOutfit",
"PerformCreateOutfitWithDescription",
"PerformDeleteOutfit",
"PerformRenameOutfit",
"PerformSaveAvatarWithDescription",
"PerformSetFavorite",
"PerformUpdateOutfit",
"SetAllowInventoryReadAccess",
"SignalCreateOutfitFailed",
"SignalCreateOutfitPermissionDenied",
"SignalDeleteOutfitFailed",
"SignalDeleteOutfitPermissionDenied",
"SignalRenameOutfitFailed",
"SignalRenameOutfitPermissionDenied",
"SignalSaveAvatarFailed",
"SignalSaveAvatarPermissionDenied",
"SignalSetFavoriteFailed",
"SignalSetFavoritePermissionDenied",
"SignalUpdateOutfitFailed",
"SignalUpdateOutfitPermissionDenied"
},
["AvatarImportService"] = {
"ImportFBXAnimationFromFilePathUserMayChooseModel",
"ImportFBXAnimationUserMayChooseModel",
"ImportFbxRigWithoutSceneLoad",
"ImportLoadedFBXAnimation"
},
["BrowserService"] = {
"CloseBrowserWindow",
"CopyAuthCookieFromBrowserToEngine",
"EmitHybridEvent",
"ExecuteJavaScript",
"OpenBrowserWindow",
"OpenNativeOverlay",
"OpenWeChatAuthWindow",
"ReturnToJavaScript",
"SendCommand"
},
["CaptureService"] = {
"RetreiveCaptures",
"SaveCaptureToExternalStorage",
"SaveCapturesToExternalStorageAsync",
"SaveScreenshotCapture",
"DeleteCapturesAsync",
"DeleteCaptureAsync",
"DeleteCapture",
"DeleteCaptures",
"GetCaptureFilePathAsync",
"CaptureScreenshot"
},
["CommandService"] = {
"ChatLocal",
"RegisterExecutionCallback",
"CommandInstance",
"Execute",
"RegisterCommand",
},
["ContentProvider"] = {
"GetFailedRequests",
"SetBaseUrl"
},
["ContextActionService"] = {
"CallFunction"
},
["CoreGui"] = {
"TakeScreenshot",
"ToggleRecording"
},
["DataModel"] = {
"GetScriptFilePath",
"CoreScriptSyncService",
"DefineFastInt",
"DefineFastString",
"OpenScreenshotsFolder",
"OpenVideosFolder",
"SetFastFlagForTesting",
"SetFastIntForTesting",
"SetFastStringForTesting",
"ScreenshotReady",
"SetVideoInfo",
"ReportInGoogleAnalytics",
"Load"
},
["GuiService"] = {
"BroadcastNotification",
"OpenBrowserWindow"
},
["HttpRbxApiService"] = {
"GetAsync",
"GetAsyncFullUrl",
"PostAsync",
"PostAsyncFullUrl",
"RequestAsync",
"RequestLimitedAsync",
"RequestInternal"
},
["HttpService"] = {
"requestInternal",
"RequestInternal"
},
["InsertService"] = {
-- "LoadLocalAsset", -- not too sure if we should blacklist this one or not
"GetLocalFileContents"
},
["LocalizationService"] = {
"PromptDownloadGameTableToCSV",
"PromptExportToCSVs",
"PromptImportFromCSVs",
"PromptUploadCSVToGameTable",
"SetRobloxLocaleId",
"StartTextScraper",
"StopTextScraper"
},
["LoginService"] = {
"Logout",
"PromptLogin"
},
["LogService"] = {
"ExecuteScript",
"GetHttpResultHistory",
"RequestHttpResultApproved",
"RequestServerHttpResult"
},
["MarketplaceService"] = {
"GetRobuxBalance",
"PerformPurchaseV2",
"PrepareCollectiblesPurchase",
"GetSubscriptionProductInfoAsync",
"GetSubscriptionPurchaseInfoAsync",
"GetUserSubscriptionPaymentHistoryAsync",
"GetUserSubscriptionStatusAsync",
"PerformPurchase",
"PromptGamePassPurchase",
"PromptNativePurchase",
"PromptProductPurchase",
"PromptThirdPartyPurchase",
"ReportAssetSale",
"ReportRobuxUpsellStarted",
"SignalAssetTypePurchased",
"SignalClientPurchaseSuccess",
"SignalMockPurchasePremium",
"SignalServerLuaDialogClosed",
"PromptRobloxPurchase",
"PerformPurchaseV3",
"PromptBundlePurchase",
"PromptSubscriptionPurchase",
"PerformSubscriptionPurchase",
"PerformBulkPurchase",
"PromptBulkPurchase"
},
["MaterialGenerationService"] = {
"RefillAccountingBalanceAsync",
"StartSession"
},
["MaterialGenerationSession"] = {
"GenerateImagesAsync",
"GenerateMaterialMapsAsync",
"UploadMaterialAsync",
},
["MessageBusService"] = {
"GetLast",
"GetMessageId",
"GetProtocolMethodRequestMessageId",
"GetProtocolMethodResponseMessageId",
"MakeRequest",
"Publish",
"PublishProtocolMethodRequest",
"PublishProtocolMethodResponse",
"SetRequestHandler",
"Subscribe",
"SubscribeToProtocolMethodRequest",
"SubscribeToProtocolMethodResponse"
},
["NotificationService"] = {
"SwitchedToAppShellFeature"
},
["OmniRecommendationsService"] = {
"ClearSessionId",
"GetSessionId",
"MakeRequest"
},
["PackageUIService"] = {
"ConvertToPackageUpload",
"PublishPackage",
"SetPackageVersion",
},
["Player"] = {
"AddToBlockList",
"RequestFriendship",
"RevokeFriendship",
"UpdatePlayerBlocked"
},
["Players"] = {
"ReportAbuse",
"ReportAbuseV3",
"TeamChat",
"WhisperChat"
},
["ScriptContext"] = {
"AddCoreScriptLocal",
"DeserializeScriptProfilerString",
"SaveScriptProfilingData"
},
["VirtualInputManager"] = {
"sendRobloxEvent"
},
["OpenCloudService"] = {
"HttpRequestAsync"
},
["LinkingService"] = {
"DetectUrl",
"GetAndClearLastPendingUrl",
"GetLastLuaUrl",
"IsUrlRegistered",
"OpenUrl",
"RegisterLuaUrl",
"StartLuaUrlDelivery",
"StopLuaUrlDelivery",
"SupportsSwitchToSettingsApp",
"SwitchToSettingsApp",
"OnLuaUrl"
},
["CommerceService"] = {
"PromptRealWorldCommerceBrowser",
"InExperienceBrowserRequested"
},
["VoiceChatInternal"] = {
"SubscribeBlock",
"SubscribeUnblock"
},
["ScriptProfilerService"] = {
"SaveScriptProfilingData"
},
["PublishService"] = {
"CreateAssetAndWaitForAssetId",
"CreateAssetOrAssetVersionAndPollAssetWithTelemetryAsync",
"PublishCageMeshAsync",
"PublishDescendantAssets"
},
["VideoCaptureService"] = {
"GetCameraDevices"
},
["SocialService"] = {
"CanSendCallInviteAsync",
"CanSendGameInviteAsync",
"InvokeGameInvitePromptClosed",
"HideSelfView",
"InvokeIrisInvite",
"InvokeIrisInvitePromptClosed",
"PromptGameInvite",
"PromptPhoneBook",
"ShowSelfView",
"CallInviteStateChanged",
"GameInvitePromptClosed",
"IrisInviteInitiated",
"PhoneBookPromptClosed",
"PromptInviteRequested",
"PromptIrisInviteRequested"
}
};
local cached_protected_services = { }
local function create_protected_service(service)
local service_name = service.ClassName
if cached_protected_services[service_name] then
return cached_protected_services[service_name]
end
if PROTECTED_SERVICES[service_name] == nil then
return service;
end
local protected_service = newproxy(true)
local protected_service_metatable = getmetatable(protected_service)
local protected_service_functions = PROTECTED_SERVICES[service_name]
cached_protected_services[service_name] = protected_service
protected_service_metatable["__index"] = function(self, idx)
local s, service_index = pcall(function()
return service[idx]
end)
if table.find(protected_service_functions, idx) then
return function (...)
error("Attempting to call a dangerous/malicious function");
end
end
if service_index and type(service_index) == "function" then
return function(self, ...)
return service_index(service, ...)
end
end
if ( s ) then
return service_index;
end
return nil;
end
protected_service_metatable["__newindex"] = function(self, idx, value)
service[idx]=value;
end
local o_tstring = tostring(service);
protected_service_metatable["__tostring"] = function(self)
return o_tstring
end
protected_service_metatable["__metatable"] = getmetatable(service);
return protected_service
end
local n_game_metatable = getmetatable(n_game);
n_game_metatable["__index"] = function(metatable, idx)
local s, game_index = pcall(function()
return old_game[idx]
end)
if table.find(PROTECTED_SERVICES["DataModel"], idx) then
return function (...)
error("Attempting to call a dangerous/malicious function");
end
end
if idx == "HttpGet" or idx == "HttpGetAsync" then
return function(self, ...)
return Nezur.HttpGet(...)
end
elseif (idx:lower() == "getservice" or idx:lower() == "findservice") then
return function(self, service)
return create_protected_service(old_game:GetService(service));
end
elseif idx == "HttpPost" or idx == "HttpPostAsync" then
return function(self, ...)
return Nezur.HttpPost(...)
end
elseif idx == "GetObjects" or idx == "GetObjectsAsync" then
return function(self, ...)
return Nezur.GetObjects(...)
end
elseif game_index and type(game_index) == "function" then
return function(self, ...)
return game_index(old_game, ...)
end
end
if ( s ) then
if ( typeof(game_index) == "Instance" ) then
return create_protected_service( game_index );
end
return game_index;
end
return nil;
end
n_game_metatable["__newindex"] = function(metatable, idx, value)
old_game[idx] = value
end
n_game_metatable["__tostring"] = function(metatable)
return "Game";
end
n_game_metatable["__metatable"] = getmetatable(old_game);
_G.Nezur = Nezur
if script.Name == "VRNavigation" then
warn("[NEZUR] Initialized made by lucas nezur owner 5+ years C++ 😘")
end
local lookupValueToCharacter = buffer.create(64)
local lookupCharacterToValue = buffer.create(256)
local alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
local padding = string.byte("=")
for index = 1, 64 do
local value = index - 1
local character = string.byte(alphabet, index)
buffer.writeu8(lookupValueToCharacter, value, character)
buffer.writeu8(lookupCharacterToValue, character, value)
end
local function raw_encode(input: buffer): buffer
local inputLength = buffer.len(input)
local inputChunks = math.ceil(inputLength / 3)
local outputLength = inputChunks * 4
local output = buffer.create(outputLength)
for chunkIndex = 1, inputChunks - 1 do
local inputIndex = (chunkIndex - 1) * 3
local outputIndex = (chunkIndex - 1) * 4
local chunk = bit32.byteswap(buffer.readu32(input, inputIndex))
local value1 = bit32.rshift(chunk, 26)
local value2 = bit32.band(bit32.rshift(chunk, 20), 0b111111)
local value3 = bit32.band(bit32.rshift(chunk, 14), 0b111111)
local value4 = bit32.band(bit32.rshift(chunk, 8), 0b111111)
buffer.writeu8(output, outputIndex, buffer.readu8(lookupValueToCharacter, value1))
buffer.writeu8(output, outputIndex + 1, buffer.readu8(lookupValueToCharacter, value2))
buffer.writeu8(output, outputIndex + 2, buffer.readu8(lookupValueToCharacter, value3))
buffer.writeu8(output, outputIndex + 3, buffer.readu8(lookupValueToCharacter, value4))
end
local inputRemainder = inputLength % 3
if inputRemainder == 1 then
local chunk = buffer.readu8(input, inputLength - 1)
local value1 = bit32.rshift(chunk, 2)
local value2 = bit32.band(bit32.lshift(chunk, 4), 0b111111)
buffer.writeu8(output, outputLength - 4, buffer.readu8(lookupValueToCharacter, value1))
buffer.writeu8(output, outputLength - 3, buffer.readu8(lookupValueToCharacter, value2))
buffer.writeu8(output, outputLength - 2, padding)
buffer.writeu8(output, outputLength - 1, padding)
elseif inputRemainder == 2 then
local chunk = bit32.bor(
bit32.lshift(buffer.readu8(input, inputLength - 2), 8),
buffer.readu8(input, inputLength - 1)
)
local value1 = bit32.rshift(chunk, 10)
local value2 = bit32.band(bit32.rshift(chunk, 4), 0b111111)
local value3 = bit32.band(bit32.lshift(chunk, 2), 0b111111)
buffer.writeu8(output, outputLength - 4, buffer.readu8(lookupValueToCharacter, value1))
buffer.writeu8(output, outputLength - 3, buffer.readu8(lookupValueToCharacter, value2))
buffer.writeu8(output, outputLength - 2, buffer.readu8(lookupValueToCharacter, value3))
buffer.writeu8(output, outputLength - 1, padding)
elseif inputRemainder == 0 and inputLength ~= 0 then
local chunk = bit32.bor(
bit32.lshift(buffer.readu8(input, inputLength - 3), 16),
bit32.lshift(buffer.readu8(input, inputLength - 2), 8),
buffer.readu8(input, inputLength - 1)
)
local value1 = bit32.rshift(chunk, 18)
local value2 = bit32.band(bit32.rshift(chunk, 12), 0b111111)
local value3 = bit32.band(bit32.rshift(chunk, 6), 0b111111)
local value4 = bit32.band(chunk, 0b111111)
buffer.writeu8(output, outputLength - 4, buffer.readu8(lookupValueToCharacter, value1))
buffer.writeu8(output, outputLength - 3, buffer.readu8(lookupValueToCharacter, value2))
buffer.writeu8(output, outputLength - 2, buffer.readu8(lookupValueToCharacter, value3))
buffer.writeu8(output, outputLength - 1, buffer.readu8(lookupValueToCharacter, value4))
end
return output
end
local function raw_decode(input: buffer): buffer
local inputLength = buffer.len(input)
local inputChunks = math.ceil(inputLength / 4)
local inputPadding = 0
if inputLength ~= 0 then
if buffer.readu8(input, inputLength - 1) == padding then inputPadding += 1 end
if buffer.readu8(input, inputLength - 2) == padding then inputPadding += 1 end
end
local outputLength = inputChunks * 3 - inputPadding
local output = buffer.create(outputLength)
for chunkIndex = 1, inputChunks - 1 do
local inputIndex = (chunkIndex - 1) * 4
local outputIndex = (chunkIndex - 1) * 3
local value1 = buffer.readu8(lookupCharacterToValue, buffer.readu8(input, inputIndex))
local value2 = buffer.readu8(lookupCharacterToValue, buffer.readu8(input, inputIndex + 1))
local value3 = buffer.readu8(lookupCharacterToValue, buffer.readu8(input, inputIndex + 2))
local value4 = buffer.readu8(lookupCharacterToValue, buffer.readu8(input, inputIndex + 3))
local chunk = bit32.bor(
bit32.lshift(value1, 18),
bit32.lshift(value2, 12),
bit32.lshift(value3, 6),
value4
)
local character1 = bit32.rshift(chunk, 16)
local character2 = bit32.band(bit32.rshift(chunk, 8), 0b11111111)
local character3 = bit32.band(chunk, 0b11111111)
buffer.writeu8(output, outputIndex, character1)
buffer.writeu8(output, outputIndex + 1, character2)
buffer.writeu8(output, outputIndex + 2, character3)
end
if inputLength ~= 0 then
local lastInputIndex = (inputChunks - 1) * 4
local lastOutputIndex = (inputChunks - 1) * 3
local lastValue1 = buffer.readu8(lookupCharacterToValue, buffer.readu8(input, lastInputIndex))
local lastValue2 = buffer.readu8(lookupCharacterToValue, buffer.readu8(input, lastInputIndex + 1))
local lastValue3 = buffer.readu8(lookupCharacterToValue, buffer.readu8(input, lastInputIndex + 2))
local lastValue4 = buffer.readu8(lookupCharacterToValue, buffer.readu8(input, lastInputIndex + 3))
local lastChunk = bit32.bor(
bit32.lshift(lastValue1, 18),
bit32.lshift(lastValue2, 12),
bit32.lshift(lastValue3, 6),
lastValue4
)
if inputPadding <= 2 then
local lastCharacter1 = bit32.rshift(lastChunk, 16)
buffer.writeu8(output, lastOutputIndex, lastCharacter1)
if inputPadding <= 1 then
local lastCharacter2 = bit32.band(bit32.rshift(lastChunk, 8), 0b11111111)
buffer.writeu8(output, lastOutputIndex + 1, lastCharacter2)
if inputPadding == 0 then
local lastCharacter3 = bit32.band(lastChunk, 0b11111111)
buffer.writeu8(output, lastOutputIndex + 2, lastCharacter3)
end
end
end
end
return output
end
local base64 = {
encode = function(input)
return buffer.tostring(raw_encode(buffer.fromstring(input)))
end,
decode = function(encoded)
return buffer.tostring(raw_decode(buffer.fromstring(encoded)))
end,
}
local Bridge, ProcessID = {serverUrl = "http://localhost:4928"}, nil
local _require = require
local function sendRequest(options, timeout)
timeout = tonumber(timeout) or math.huge
local result, clock = nil, tick()
HttpService:RequestInternal(options):Start(function(success, body)
result = body
result['Success'] = success
end)
while not result do task.wait()
if (tick() - clock > timeout) then
break
end
end
return result
end
function Bridge:InternalRequest(body, timeout)
local url = self.serverUrl .. '/send'
if body.Url then
url = body.Url
body["Url"] = nil
local options = {
Url = url,
Body = body['ct'],
Method = 'POST',
Headers = {
['Content-Type'] = 'text/plain'
}
}
local result = sendRequest(options, timeout)
local statusCode = tonumber(result.StatusCode)
if statusCode and statusCode >= 200 and statusCode < 300 then
return result.Body or true
end
local success, result = pcall(function()
local decoded = HttpService:JSONDecode(result.Body)
if decoded and type(decoded) == "table" then
return decoded.error
end
end)
if success and result then
error(result, 2)
return
end
error("An unknown error occured by the server.", 2)
return
end
local success = pcall(function()
body = HttpService:JSONEncode(body)
end) if not success then return end
local options = {
Url = url,
Body = body,
Method = 'POST',
Headers = {
['Content-Type'] = 'application/json'
}
}
local result = sendRequest(options, timeout)
if type(result) ~= 'table' then return end
local statusCode = tonumber(result.StatusCode)
if statusCode and statusCode >= 200 and statusCode < 300 then
return result.Body or true
end
local success, result = pcall(function()
local decoded = HttpService:JSONDecode(result.Body)
if decoded and type(decoded) == "table" then
return decoded.error
end
end)
if success and result then
error(result, 2)
end
error("An unknown error occured by the server.", 2)
end
function Bridge:readfile(path)
local result = self:InternalRequest({
['c'] = "rf",
['p'] = path,
})
if result then
return result
end
end
function Bridge:writefile(path, content)
local result = self:InternalRequest({
['Url'] = self.serverUrl .. "/writefile?p=" .. path,
['ct'] = content
})
return result ~= nil
end
function Bridge:isfolder(path)
local result = self:InternalRequest({
['c'] = "if",
['p'] = path,
})
if result then
return result == "dir"
end
return false
end
function Bridge:isfile(path)
local result = self:InternalRequest({
['c'] = "if",
['p'] = path,
})
if result then
return result == "file"
end
return false
end
function Bridge:listfiles(path)
local result = self:InternalRequest({
['c'] = "lf",
['p'] = path,
})
if result then
local files = HttpService:JSONDecode(result) or {}
for i, file in ipairs(files) do
files[i] = file:gsub("\\", "/")
end
return files or {}
end
return {}
end
function Bridge:makefolder(path)
local result = self:InternalRequest({
['c'] = "mf",
['p'] = path,
})
return result ~= nil
end
function Bridge:delfolder(path)
local result = self:InternalRequest({
['c'] = "dfl",
['p'] = path,
})
return result ~= nil
end
function Bridge:delfile(path)
local result = self:InternalRequest({
['c'] = "df",
['p'] = path,
})
return result ~= nil
end
Bridge.virtualFilesManagement = {
['saved'] = {},
['unsaved'] = {}
}
function Bridge:SyncFiles()
local allFiles = {}
local function getAllFiles(dir)
local files = self:listfiles(dir)
if #files < 1 then return end
for _, filePath in files do
table.insert(allFiles, filePath)
if self:isfolder(filePath) then
getAllFiles(filePath)
end
end
end
local success = pcall(function()
getAllFiles("./")
end) if not success then return end
local latestSave = {}
local success, r = pcall(function()
for _, filePath in allFiles do
table.insert(latestSave, {
path = filePath,
isFolder = self:isfolder(filePath)
})
end
end) if not success then return end
self.virtualFilesManagement.saved = latestSave
local unsuccessfulSave = {}
local success, r = pcall(function()
for _, unsavedFile in self.virtualFilesManagement.unsaved do
local func = unsavedFile.func
local argX = unsavedFile.x
local argY = unsavedFile.y
local success, r = pcall(function()
return func(self, argX, argY)
end)
if (not success) or (not r) then
if not unsavedFile.last_attempt then
table.insert(unsuccessfulSave, {
func = func,
x = argX,
y = argY,
last_attempt = true
})
end
end
end
end) if not success then return end
self.virtualFilesManagement.unsaved = unsuccessfulSave
end
function Bridge:CanCompile(source, returnBytecode)
local requestArgs = {
['Url'] = self.serverUrl .. "/compilable",
['ct'] = source
}
if returnBytecode then
requestArgs.Url = self.serverUrl .. "/compilable?btc=t"
end
local result = self:InternalRequest(requestArgs)
if result then
if result == "success" then
return true
end
return false, result
end
return false, "Unknown Error"
end
function Bridge:loadstring(source, chunkName)
local cachedModules = {}
local coreModule = workspace.Parent.Clone(coreModules[math.random(1, #coreModules)])
coreModule:ClearAllChildren()
coreModule.Name = HttpService:GenerateGUID(false) .. ":" .. chunkName
coreModule.Parent = NezurContainer
table.insert(cachedModules, coreModule)
local result = self:InternalRequest({
['Url'] = self.serverUrl .. "/loadstring?n=" .. coreModule.Name .. "&cn=" .. chunkName .. "&pid=" .. tostring(ProcessID),
['ct'] = source
})
if result then
local clock = tick()
while task.wait() do
local required = nil
pcall(function()
required = _require(coreModule)
end)
if type(required) == "table" and required[chunkName] and type(required[chunkName]) == "function" then -- add better checks
if (#cachedModules > 1) then
for _, module in pairs(cachedModules) do
if module == coreModule then continue end
module:Destroy()
end
end
return required[chunkName]
end
if (tick() - clock > 5) then
warn("[NEZUR]: loadjizz failed and timed out")
for _, module in pairs(cachedModules) do
module:Destroy()
end
return nil, "loadjizz failed and timed out"
end
task.wait(.06)
coreModule = workspace.Parent.Clone(coreModules[math.random(1, #coreModules)])
coreModule:ClearAllChildren()
coreModule.Name = HttpService:GenerateGUID(false) .. ":" .. chunkName
coreModule.Parent = NezurContainer
self:InternalRequest({
['Url'] = self.serverUrl .. "/loadstring?n=" .. coreModule.Name .. "&cn=" .. chunkName .. "&pid=" .. tostring(ProcessID),
['ct'] = source
})
table.insert(cachedModules, coreModule)
end
end
end
function Bridge:request(options)
local result = self:InternalRequest({
['c'] = "rq",
['l'] = options.Url,
['m'] = options.Method,
['h'] = options.Headers,
['b'] = options.Body or "{}"
})
if result then
result = HttpService:JSONDecode(result)
if result['r'] ~= "OK" then
result['r'] = "Unknown"
end
if result['b64'] then
result['b'] = base64.decode(result['b'])
end
return {
Success = tonumber(result['c']) and tonumber(result['c']) > 200 and tonumber(result['c']) < 300,
StatusMessage = result['r'], -- OK
StatusCode = tonumber(result['c']), -- 200
Body = result['b'],
HttpError = Enum.HttpError[result['r']],
Headers = result['h'],
Version = result['v']
}
end
return {
Success = false,
StatusMessage = "Can't connect to Nezur web server: " .. self.serverUrl,
StatusCode = 599;
HttpError = Enum.HttpError.ConnectFail
}
end
function Bridge:setclipboard(content)
local result = self:InternalRequest({
['Url'] = self.serverUrl .. "/setclipboard",
['ct'] = content
})
return result ~= nil
end
function Bridge:rconsole(_type, content)