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

📄 gcbjm_nt.asm

📁 COM文件加密
💻 ASM
字号:
;***********************************************************
;*GCBJM_HD.ASM  自编加密模块                               *
;***********************************************************
code      segment
          assume cs:code,ds:code,es:code
          org 100h

start:
          jmp begin

msg0      db 13,10
          db 'COM-SECURE FOR NETWARE V1.0 ',13,10
          db '    Copyright(c) 1993.11 GongCheng-Bing By SiChuan RanLiao Chang.',13,10
cr        db 13,10,'$'
msg1      db 'Please input filename: $'
msg2      db 13,10,'The Key Disk Not Found !',13,10,'$'
msg4      db 7,'File not found!',13,10,'$'
msg5      db 7,'Invalid filename !',13,10,'$'
msg8      db 13,10,'FILE SECURE OK !!',13,10,13,10,'$'
fname1    db 128 dup (0)
;fname1    db 'GCBJM_NT.OVL',0     ;加密附加模块文件名
handle1   dw 0
fname2    db 'NTGCBHHL.SEC',0    ;生成加密文件名
handle2   dw 0
Fname     db 64,?,64 dup (?)   ;需要加密的文件名
handle    dw 0
attrib    dw ?                 ;文件属性
Time      dw ?                 ;文件时间
Date      dw ?                 ;
key       dw 9bD7h ;  7955h

begin:
          mov si,2ch
          mov ds,[si]
          xor si,si
bbb1:
          lodsb
          cmp al,0
          jnz bbb1
          cmp word ptr [si],0100h
          jnz bbb1
          cmp byte ptr [si+2],0
          jnz bbb1
          add si,3
          mov cx,si
bbb2:
          lodsb
          cmp al,0
          jnz bbb2
          sub si,cx
          xchg cx,si
          mov di,offset fname1
          repz movsb
          push cs
          pop  ds
bbb3:
          dec di
          cmp byte ptr ds:[di],'.'
          jnz bbb3
          mov word ptr [di+1],'VO'
          mov byte ptr [di+3],'L'

          mov dx,offset msg0
          mov ah,9
          int 21h
          cmp byte ptr cs:[80h],2
          jb loc_01
          mov si,82h
          jmp loc_02
loc_01:
          mov dx,offset msg1
          mov ah,9
          int 21h
          mov dx,offset fname
          mov ah,0ah
          int 21h
          mov dx,offset cr
          mov ah,9
          int 21h
          mov si,offset fname+2
loc_02:
          mov di,offset fname
          cld
b1:
          lodsb
          cmp al,0dh
          je b2
          cmp al,20h
          je b1
          cmp al,'a'
          jb b119
          cmp al,'z'
          ja b119
          sub al,20h
b119:
          stosb
          jmp b1
b2:
          xor al,al
          stosb

;          push ds
;          mov bx,KEY ;use_bx
;          mov ax,0ff00h
;          mov ds,ax
;          xor si,si
;          mov cx,7f8h
;gloc_1:
;          lodsw
;          xchg ah,al
;          add bx,ax
;          loop gloc_1
;          pop ds

;          call key_net
;          mov key,bx
bbbb2:
          mov dx,offset fname1
          mov ax,3d00h
          int 21h
          jnc b8              ;open .OVL file
exit:
          mov dx,offset msg4
          mov ah,9
          int 21h
          mov ax,4c02h
          int 21h
b8:
          mov handle1,ax
          mov dx,offset fname
          mov ax,3d00h
          int 21h             ;open .COM file ==>handle
          jc  exit
          mov handle,ax
          mov ah,3ch
          mov dx,offset fname2
          mov cx,0
          int 21h             ;create .SEC file ==>handle2
          jc exit
          mov handle2,ax
          mov ax,4202h
          mov cx,0
          mov dx,0
          mov bx,handle1
          INT 21H             ;fseek
          push ax             ;length for file
          mov ax,4200h
          mov cx,0
          mov dx,0
          int 21h
          pop cx
          mov ah,3fh
          mov dx,offset buff
          int 21h
          mov ah,3eh
          int 21h
          mov bx,handle2
          mov ah,40h
          int 21h
          mov ax,4202h
          mov bx,handle
          mov cx,0
          mov dx,0
          int 21h
          push ax

          inc ax
          shr ax,1
          mov word ptr buff,ax
          mov ax,4200h
          mov bx,handle2
          mov cx,0
          mov dx,0feh
          int 21h
          mov ah,40h
          mov cx,2
          mov dx,offset buff
          int 21h
          mov ah,3eh
          int 21h
          mov ax,3d02h
          mov dx,offset fname2
          int 21h
          mov handle2,ax
          mov bx,ax
          mov ax,4202h
          mov cx,0
          mov dx,0
          int 21h


          mov ax,4200h
          mov bx,handle
          mov cx,0
          mov dx,0
          int 21h

          pop cx
          mov ah,3fh
          mov dx,offset buff
          int 21h
          mov ah,3eh
          int 21h
          inc cx
          and cx,0fffeh
          push cx

          push cx       ;********************
          call key_net  ;求取关键值         *
          pop  cx       ;********************
;          mov bx,key
          inc cx
          shr cx,1
          mov dx,9876h
          mov si,offset buff
          mov di,offset buff
gloc_2:
          lodsw
          add ax,dx
          xchg ah,al
          xor ax,dx
          add ax,bx
          xchg ah,al
          xor ax,bx
          add bx,3
          sub dx,2
          stosw
          loop gloc_2

          mov bx,handle2
          mov dx,offset buff
          mov ah,40h
          pop cx
          int 21h
          mov ah,3eh
          int 21h
          mov ah,9
          mov dx,offset msg8
          int 21h
          mov ax,4c00h
          int 21h


key1      dw 0
key2      dw 0
key3      dw 0
dta_buff  db 60 dup (0)
use_bx    dw 9bd7h
use_si    dw 45c0h-100h
use_cx    dw 0
cur_disk  db "A:"
cur_dir   db "\UCDOS",0
cur_dir1  db "\",0
ext_fcb1  db 0ffh,0,0,0,0,0,10h,1,"UCDOS      "
          DB 25 DUP (0)
ext_fcb2  db 1,'NTGCBHHLSEC'
          db 25 DUP (0)    ;生成加密文件名
key_net   proc near
          mov ah,1ah
          mov dx,offset dta_buff
          int 21h                       ;置磁盘传送区
          mov ah,19h
          int 21h                       ;取当前盘号
          add byte ptr ds:cur_disk,al   ;初始化
          add byte ptr ds:ext_fcb1+7,al ;初始化
          add byte ptr ds:ext_fcb2,al   ;初始化
          mov ah,3bh
          mov dx,offset cur_dir1
          int 21h                       ;置目录
          mov ah,11h
          mov dx,offset ext_fcb1
          int 21h                       ;搜索扩展FCB
          mov ax,word ptr ds:dta_buff+22h ;首簇号
          mov key1,ax
          mov ah,3bh
          mov dx,offset cur_dir
          int 21h                       ;置目录
;          mov word ptr ds:ext_fcb1+8,4e4bh
;          mov word ptr ds:ext_fcb1+0ah,204ch
;          mov byte ptr ds:ext_fcb1+0ch,20h
;          mov word ptr ds:ext_fcb1+10h,4f43h
;          mov byte ptr ds:ext_fcb1+12h,4dh
;          mov dx,offset ext_fcb1
;          add dx,7
          mov dx,offset ext_fcb2
          mov ah,11h
          int 21h                      ;搜索NTGCBHHL.SEC文件
          mov ax,word ptr ds:dta_buff+1bh ;首簇号
          mov key2,ax
          mov ah,36h
          mov dl,0
          int 21h                      ;取磁盘剩余空间
          mov key3,dx                  ;磁盘簇数
          mov bx,9bd7h
          add bx,key1
          xor bx,key2
          xor bx,key3                  ;关键值
          ret
key_net   endp

buff      label byte
code      ends
          end start

⌨️ 快捷键说明

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