-
Notifications
You must be signed in to change notification settings - Fork 1
/
procedures.asm
108 lines (103 loc) · 1.8 KB
/
procedures.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
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
_GetIP proto
CopyMemory proto :dword, :dword, :dword
GetToken proto :dword, :dword, :byte, :dword, :byte
.code
_GetIP proc
local IP[261]:byte
invoke gethostname, addr IP, 261
invoke gethostbyname, addr IP
mov eax, [eax + 12]
mov eax, [eax]
mov eax, [eax]
invoke inet_ntoa, eax
ret
_GetIP endp
CopyMemory proc uses eax ecx esi edi dwDestination:dword, dwSource:dword, dwLen: dword
mov esi, dwSource
mov edi, dwDestination
mov ecx, dwLen
.repeat
movsb
.untilcxz
ret
CopyMemory endp
GetRandNick proc uses eax esi edi
local wRand:word
invoke GetTickCount
xor ecx, ecx
mov cx, ax
invoke htonl, eax
xor eax, ecx
mov wRand, ax
mov esi, dwNickPointer
mov ecx, 0
.while cx < wRand
inc ecx
lodsb
.if al == 0
lodsb
.if al == 1
mov esi, offset szNicks
mov dwNickPointer, esi
.else
dec esi
mov dwNickPointer, esi
.endif
.endif
.endw
ret
GetRandNick endp
GetToken proc uses eax ecx esi edi dwBuffer:dword, dwString:dword, bSeperator:byte, dwNumber:dword, bGetAll:byte
mov ecx, 0
mov esi, dwString
mov edi, dwBuffer
@@:
lodsb
.if al == 0
stosb
jmp @F
.elseif al == bSeperator
inc ecx
.if ecx == dwNumber
.if bGetAll == FALSE
mov al, 0
stosb
jmp @F
.endif
.elseif
.if bGetAll == TRUE
.if ecx < dwNumber
mov edi, dwBuffer
.endif
.else
mov edi, dwBuffer
jmp @B
.endif
.endif
.endif
stosb
jmp @B
@@:
ret
GetToken endp
DecryptKey proc uses eax ecx esi edi
mov esi, offset szEncryptionKey
mov edi, offset szKey
mov ecx, sizeof szEncryptionKey
dec ecx
mov edx, 96
@@:
inc edx
lodsb
.if ecx <= 0
jmp @F
.endif
xor al, dl
stosb
dec ecx
jmp @B
@@:
mov al, 0
stosb
ret
DecryptKey endp