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
|
org 100h
call DOSread
call debug
push es 0b800h
pop es
mov si,buffer
mov di,0
mov ah,67h
@@:
lodsb
cmp al,0
je @f
stosw
jmp @b
@@:
pop es
ret
debug:
push eax ebx ecx edx
mov ax,ds
call wordtohexa
mov [buffer],eax
mov byte[buffer+4],':'
mov ax,buffer
call wordtohexa
mov [buffer+5],eax
pop edx ecx ebx eax
ret
wordtohexa:
mov bx,ax
shr ax,8
call @f
xchg bx,ax
call @f
shl eax,16
mov ax,bx
ret
@@:
mov ah,al
and al,0fh
call @f
xchg al,ah
shr al,4
@@:
cmp al,10
cmc
sbb dl,dl
and dl,7
add al,dl
add al,'0'
ret
fptr:
.off=0
.seg=2
.size=4
DOSread:
push eax ebx ecx edx edi esi
mov edi,[.fptr]
mov edx,[.path]
or edx,edx
je .error
mov ax,[edx+2]
mov dx,[edx+0]
push ds
or ax,ax
je @f
mov ds,ax
@@:
mov ax,3d00h
int 21h
pop dx
jc .error
or edi,edi
je .close
mov bx,ax
mov ah,42h
mov al,0
mov cx,[.off+2]
mov dx,[.off]
int 21h
jc .error
mov ax,[edi+2]
mov dx,[edi+0]
mov ecx,[edi+4]
push ds
or ax,ax
je @f
mov ds,ax
@@:
mov ah,3fh
int 21h
pop ds
jc .error
movzx eax,ax
mov [edi+fptr.size],eax
@@:
mov ah,3eh
int 21h
jc .error
.end:
pop esi edi edx ecx ebx eax
ret
.close:
call .id
jmp @b
.error:
mov dword[.size],0
jmp .end
.id : mov ah,42h
mov al,2
mov cx,0
mov dx,0
int 21h
mov word[.size],ax
mov word[.size+2],dx
ret
.off: dd 0
.size: dd 0
.path: dd chemin
.fptr: dd zone
zone dd 0:buffer,1000
chemin dd 0:fichier
fichier db "c:\fool\shell.asm",0
buffer: |
Partager