forked from krystalgamer/Resonance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.asm
71 lines (51 loc) · 1.48 KB
/
shell.asm
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
%define counter ecx
%define functionSize ebx
%define startAddress eax
%define addressOfUnencripted edi
%define tmp edx
%define functionStoreAddress esi ;where the original function is stored
segment .text
justDoIt:;couldnt think of anything
pushad
pushfd
mov counter, 0h ; this value will change
cmp counter, 0x000000FF
jne increaseCounter
;incase that they're equal
mov dword [12345678h], 0 ;restore the counter
mov dword functionSize, 69h ;wont change
mov dword startAddress, 68h ;same
mov dword addressOfUnencripted, 67h ;this will change
mov tmp, functionSize
shl tmp, 1 ;double it
add tmp, startAddress
add tmp, 1
mov functionStoreAddress, 12345678h
cmp tmp, addressOfUnencripted
jle resetAddressOfUnencripted
mov byte [addressOfUnencripted], 0x90;nop old shit
;time to move it
add addressOfUnencripted, 1 ;increase it
mov [12345678h], addressOfUnencripted ; update it
copyFunction:
mov ecx, functionSize
copy:
movsb
xor byte [addressOfUnencripted-1], 0xf2
loop copy
jmp endJustDoIt
resetAddressOfUnencripted:
mov ecx, functionSize
nopEndOfMemory:;this is needed because when it goes back to start there are leftovers
mov byte [addressOfUnencripted+ecx-1], 0x90
loop nopEndOfMemory
mov addressOfUnencripted, startAddress
mov [12345678h], addressOfUnencripted ;address where addressOfUnencripted is stored
jmp copyFunction
increaseCounter:
add counter, 1h
mov [12345678h], counter
endJustDoIt:
popfd
popad
jmp [12345678h]