汇编源代码之硬盘保护锁
2009-01-28 09:37:08 来源:WEB开发网0F6D:022C B80000 MOVAX,0000
0F6D:022F 8EC0 MOVES,AX
0F6D:0231 B80102 MOVAX,0201
0F6D:0234 B90300 MOVCX,0003
0F6D:0237 BA8000 MOVDX,0080
0F6D:023A BB007C MOVBX,7C00
0F6D:023D CD13 INT13 ;0柱0道3扇是HDBOOT.EXE写入的原MBR区的备份,将
;其读入0000:7c00处
0F6D:023F EA007C0000 JMP0000:7C00 ;长跳转至原MBR代码处执行(以后怎么样引导就不
;是我们现在讨论的了),从而正确引导系统
;加密硬盘代码
0F6D:0248 B80000 MOVAX,0000
0F6D:024B 8EC0 MOVES,AX
0F6D:024D B80102 MOVAX,0201
0F6D:0250 B90400 MOVCX,0004
0F6D:0253 BA8000 MOVDX,0080
0F6D:0256 BB00F0 MOVBX,F000
0F6D:0259 CD13 INT13
0F6D:025B B80103 MOVAX,0301
0F6D:025E B90100 MOVCX,0001
0F6D:0261 BA8000 MOVDX,0080
0F6D:0264 CD13 INT13 ;0柱0道4扇是HDBOOT.EXE写入的由硬盘锁代码(也就是;大家现在看到的代码)加上江明原理的逻辑锁,将其写入;0柱0道1扇后操作系统就被完全锁死了(不能从其它盘引导)
0F6D:0266 CD19 INT19 ;不用多说吧,相当于热启动
大家看后一定看出了一些问题,为了能够让这个硬盘锁可以跨平台,我设置为输入正确密码后就将
正确的分区表读入0柱0道1扇,输入不正确密码后就将江明锁读入0柱0道1扇,明白人一下就看出了,如果电脑主人上次用正确密码进入了电脑,而电脑非法使用者一次都不试密码,就直接用软盘或光盘或USB盘引导,那么就可以非法访问硬盘了,说实话,这个问题困扰了我许久,一直不得其解,不这样做,就得在输入正确密码后就将正确的分区表读入0柱0道1扇,然后在操作系统启动后再做手脚把0柱0道1扇的分区表加密,这样做有两个问题,(1)操作系统启动做的手脚一定是放在操作系统的自启动中(如DOS的AUTOEXEC.BAT、WIN98的"启动"等),这样做显然不安全,(2)同时这样做显然不能做到"跨平台",所以我只能在程序说明中告诉使用者,如果离开电脑,就故意输入一错误密码,那么江明锁就将硬盘锁死了,这样电脑非法使用者用软盘或光盘或USB盘都不能引导了,(大家知道所谓江明锁,就是让扩展分区指向自己,从而使启动程序陷入死循环,这个该死的东西也不知害死了多少硬盘,也该让他做做好事了),要是谁有更好的方法解决这一问题,一定要告诉我.
再来介绍一下HDLCOK.EXE文件,以下是完整的程序源代码:
;硬盘锁安装程序
DATA SEGMENT
D1 DB 0CDH,0BFH,0D1H,0E5H,0EAH,0CDH
D2 DB 'You had not install the HDLOCK,do you install?(y/n)',0dh,0ah,'$'
D3 DB 'HDLOCK.DAT',00H
D4 DB 'Can not find file (HDLOCK.DAT)',0dh,0ah,'$'
D5 DB 'PASSWORD',00H
D6 DB 1EH,06H,0B9H,00H,01H,0BFH,00H,06H,0B8H,00H,00H,8EH,0D8H,8EH,0C0H,0BEH;逻辑锁
DB 00H,7CH,0F2H,0A5H,0EAH,1AH,06H,00H,00H,90H,0EBH,09H,50H,41H,53H,53H
DB 57H,4FH,52H,44H,00H,0B8H,00H,06H,0B7H,0F0H,0B9H,00H,00H,0BAH,4FH,18H
DB 0CDH,10H,0B2H,01AH,0BEH,1CH,06H,0B4H,02H,0B6H,10H,0B7H,00H,0CDH,10H,8AH
DB 04H,3CH,00H,74H,1BH,0B4H,09H,0B9H,01H,00H,0B7H,00H,0B3H,70H,0CDH,10H
DB 0FEH,0C2H,46H,0EBH,0E2H,0CDH,20H,4FH,3DH,33H,0CDH,20H,33H,33H,33H,33H
DB 0B9H,04H,00H,0B8H,00H,00H,8EH,0C0H,0BFH,01H,08H,0F3H,0ABH,0B9H,09H,00H
DB 0BFH,01H,08H,0B2H,23H,0B4H,00H,0CDH,16H,3CH,0DH,74H,79H,0B4H,02H,90H
DB 90H,0B6H,10H,0B7H,00H,0CDH,10H,3CH,08H,74H,37H,50H,0B4H,0EH,0B0H,2AH
DB 0B3H,07H,0CDH,10H,58H,04H,23H,88H,05H,47H,49H,83H,0F9H,00H,74H,0AH
DB 0FEH,0C2H,0EBH,0D1H,24H,67H,00H,77H,69H,6EH,0B6H,10H,0B4H,02H,0B2H,23H
DB 0B7H,00H,0CDH,10H,0B4H,09H,0B0H,00H,0B3H,07H,0B9H,09H,00H,0CDH,10H,0EBH
DB 9FH,51H,51H,0B4H,03H,0B7H,00H,0CDH,10H,80H,0FAH,23H,74H,0A7H,81H,0FFH
DB 00H,08H,74H,0A1H,0B4H,02H,0FEH,0CAH,0CDH,10H,0B4H,0EH,0B0H,00H,0B3H,07H
DB 0CDH,10H,0B8H,00H,00H,89H,05H,4FH,89H,05H,59H,0EBH,88H,07H,43H,04H
DB 0E8H,86H,0CDH,20H,44H,44H,0B8H,00H,00H,8EH,0C0H,8EH,0D8H,0BEH,0B0H,07H
DB 0BFH,01H,08H,0B9H,04H,00H,0F3H,0A7H,74H,04H,0EBH,3CH,55H,55H,0B8H,00H
DB 00H,8EH,0C0H,0B8H,01H,02H,0B9H,02H,00H,0BAH,80H,00H,0BBH,00H,0F0H,0CDH
DB 13H,0B8H,01H,03H,0B9H,01H,00H,0BAH,80H,00H,0CDH,13H,0B8H,00H,00H,8EH
DB 0C0H,0B8H,01H,02H,0B9H,03H,00H,0BAH,80H,00H,0BBH,00H,7CH,0CDH,13H,0EAH
DB 00H,7CH,00H,00H,00H,00H,00H,00H,0B8H,00H,00H,8EH,0C0H,0B8H,01H,02H
DB 0B9H,04H,00H,0BAH,80H,00H,0BBH,00H,0F0H,0CDH,13H,0B8H,01H,03H,0B9H,01H
DB 00H,0BAH,80H,00H,0CDH,13H,0CDH,19H,00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H
DB 64H,64H,64H,64H,64H,64H,64H,64H,00H,00H,00H,00H,00H,00H,00H,00H
DB 01H,00H,05H,0FEH,7FH,05H,3FH,00H,00H,00H,47H,39H,40H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,55H,0AAH
D7 DB 'You have been installed HDLOCK,do you remove?(y/n)',0dh,'$'
D8 DB 'PASSWORD ERROR$'
D9 DB 0dh,0ah
DB 0dh,0ah
DB ' # # # # # # # # # # # # #',0dh,0ah
DB ' # # # # # # # # # # # # #',0dh,0ah
DB ' # # # # # # # # # # # # #',0dh,0ah
DB ' # # # # # # # # # # # # #',0dh,0ah
DB ' # # # # # # # # # # # # # #',0dh,0ah
DB 0dh,0ah
DB ' ----------# HARD DISK LOCK #------------',0dh,0ah
DB ' BY:THE MAN LIKE WIND',0dh,0ah
DB ' E-mail:tyhhyf@hotmail.com',0dh,0ah
DB ' OICQ:86633320',0dh,0ah
D10 DB 'Enter anykey to enter the PASSWORD.$'
D11 DB 'Enter anykey to enter the PASSWORD again.$'
D12 DB 'Error:Two PASSWORD is not alike!$'
D13 DB 'The HDLOCK had been installed,please remember you PASSWORD!!!$'
D14 DB 'The HDLOCK had been removed.$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ES:DATA
START:
MOV AX,DATA
MOV DS,AX
MOV ES,AX
MOV DX,OFFSET D9
MOV AH,09H
INT 21H
MOV AH,00H
INT 16H
;判断是否安装过硬盘锁程序
更多精彩
赞助商链接