ЕК
Size: a a a
ЕК
d
d
ЕК
s
format PE
use32
include 'C:\fasm\INCLUDE\win32ax.inc'
section '.bss' readable writable
HMBR rd 1
buf rb 512
var1 rd 1
count1 rb 1
bytesread rd 1
section '.text' readable executable
entry _start
filename db '\\\\.\\PhysicalDrive0',0
error_read db '[-] Error read MBR',0x0a,0x00
complete_read db '[+] Complete read mbr',0x0a,'[*] MBR: ',0x00
msg db '%002X ',0x00
_start:
invoke CreateFile,filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0
cmp eax,0x00
jz error_open
mov dword ptr HMBR,eax
invoke SetFilePointer,HMBR,0x00,0x00,FILE_BEGIN
invoke ReadFile,HMBR,buf,512,bytesread,0x00
cmp eax,0x00
jz Comp_read
invoke printf,error_read
jmp near return
Comp_read:
invoke printf,complete_read
cld
lea esi,[buf]
mov ecx,512
mov byte ptr count1,0x00
.lp:
lodsb
movzx eax,al
mov dword [var1],eax
cmp byte ptr count1,0x0c
jnz .continue
mov byte ptr count1,0x00
invoke putchar,0x0a
.continue:
inc byte ptr count1
mov eax,dword [var1]
cinvoke printf,msg,eax
loop .lp
error_open:
jmp short continue
error_open_msg db '[-] Error open PhysicalDriver0',0x0a,0x00
continue:
invoke printf,error_open_msg
jmp short @f
return:
invoke CloseHandle,HMBR
@@:
invoke ExitProcess,0x00
section '.code' import data readable executable
library Kernel32,'Kernel32.dll',\
msvcrt,'msvcrt.dll',\
user32,'user32.dll'
import Kernel32,\
ExitProcess,'ExitProcess',\
CreateFile,'CreateFileA',\
CloseHandle,'CloseHandle',\
ReadFile,'ReadFile',\
WriteFile,'WriteFile',\
SetFilePointer,'SetFilePointer'
import msvcrt,printf,'printf',putchar,'putchar'ReadFile и в SetFilePointer.d
ЕК
ЕК
КП
s
