Hard disk encryption - analysis of two

zhaozj2021-02-16  44

After being familiar with the hard disk main guidance record, you can compile a lot of hard drive encryption programs (depending on your own needs), with the hard disk capacity is getting bigger, in fact, we can divide the hard disk into two disks, one is C disk, one is a D disk, usually copy the important files of the C drive to the D disk, and lock the D disk so that when the C drive is destroyed, you can unlock the D disk, restore the file stored on the D disk. The procedure I will write in this principle, please see the code: Announcement: you can use any Editor to Edit Source Codes, Such As Notepad, QE, Edit and So ON.Source Codes: Data Segment FQB DB 512 DUP (0); To Define a buffer, Which Will Be Used to Store Harddisk's MBR Message1 DB 0DH, 0AH, "C ---------- Lock C" DB 0DH, 0AH, "D --- --------- Lock D "DB 0DH, 0AH," E ----------- EXIT "DB 0DH, 0AH," Enter Your Selection! $ "Message2 DB 0DH, 0AH , "OK! $" Message3 DB "Not Found Drive D! $" Error DB "Enter Error! $" Ioerror DB "Harddisk I / O Error! $" CXD DW 0 DATA ENDS Stack Segment DB 512 DUP (0) Stack Ends Code Segment Assume CS: Code, DS: Data, SS: Stack Start: MOV AX, 0201 MOV BX, Offset FQB MOV CX, 0001 MOV CXD, CX MOV DX, 0080 INT 13; Read Main Boot Record, Which is in 0 Header , 0 Cylinder, 1 Sector JB ERR MOV DX, OFFSET Mess1 MOV AH, 9 INT 21 AA0:; Accept User's Enter MoV Ah, 1 INT 21 CMP AL, 'E'; EXIT JZ EXIT CMP AL, 'E'; EXIT JZ EXIT CMP AL, 'C'; LOCK Drive C Jz LockC CMP Al, 'C'; Lock Drive C Jz Lockc CMP AL, 'D' JZ Lockd; // Lock Drive D CMP AL, 'D' JZ Lockd; // Lock Drive D Lea DX, Error;

Error Mov AH, 9 INT 21 JMP EXIT LOCKC: MOV AH, 55H CLD MOV SI, OFFSET FQB MOV DI, SI MOV CX, 01FE AA1: LOADSB XOR Al, AH ROL AH, 1 Stosb; // Encrypt Partition-Table Loop AA1 AA3: MOV AX, 0301 MOV BX, OFFSET BUF MOV CX, CXD MOV DX, 0080 INT 13 JB Err Lea DX, Message2 MOV AH, 9 INT 21 MOV AX, 0040; Reset Mov DS, AX MOV AX, 1234 MOV Si , 0072 MOV [Si], AX JMP FFFF: 0000 INT 20 LOCKD: CMP BYTE PTR [BUF 1D0], 0 JNZ AA2 MOV DX, Message3; No Drive D MOV AH, 9 INT 21 JMP EXIT AA2: MOV AX, 0201 MOV BX, OFFSET BUF MOV CX, WORD PTR [BUF 1D0]; Read Logic Drive D Partition-Table Mov DX, 0080 INT 13 JB ERR JMP LOCKC ERR: MOV DX, OFFSET IOERROR MOV AH, 9 INT 21 EXIT: MOV AH 4ch int 21code endsend start

The above program is suitable for only two partition hard drives, but the program can also improve the hard disk of multiple partitions. The code is a heat-started code at the comment RESET, that is, the 1234 is sent to the offset address 0040: 0072, and then jump to FFFF: 0, it can be hot start.

转载请注明原文地址:https://www.9cbs.com/read-27097.html

New Post(0)