feat: 可选头部已经解析

This commit is contained in:
2024-12-11 01:36:29 +08:00
parent 7cf5a9c531
commit 45148ead6e
8 changed files with 614 additions and 38 deletions

View File

@@ -0,0 +1,278 @@
import NodeTableComponent, {
DataTemplateInterface,
} from "../NodeTableComponent/NodeTableComponent";
export default function OptionalHeader() {
const dataTemplate: DataTemplateInterface = {
magic: {
name: "magic",
offset: 0,
size: 2,
value: null,
data_type: "hex",
description: "PE文件标志",
},
major_linker_version: {
name: "major_linker_version",
offset: 2,
size: 1,
value: null,
data_type: "hex",
description: "链接器主版本号",
},
minor_linker_version: {
name: "minor_linker_version",
offset: 3,
size: 1,
value: null,
data_type: "hex",
description: "链接器次版本号",
},
size_of_code: {
name: "size_of_code",
offset: 4,
size: 4,
value: null,
data_type: "hex",
description: "代码段大小",
},
size_of_initialized_data: {
name: "size_of_initialized_data",
offset: 8,
size: 4,
value: null,
data_type: "hex",
description: "初始化数据段大小",
},
size_of_uninitialized_data: {
name: "size_of_uninitialized_data",
offset: 12,
size: 4,
value: null,
data_type: "hex",
description: "未初始化数据段大小",
},
address_of_entry_point: {
name: "address_of_entry_point",
offset: 16,
size: 4,
value: null,
data_type: "hex",
description: "入口点地址",
},
base_of_code: {
name: "base_of_code",
offset: 20,
size: 4,
value: null,
data_type: "hex",
description: "代码段基址",
},
image_base: {
name: "image_base",
offset: 24,
size: 8,
value: null,
data_type: "hex",
description: "映像基址",
},
section_alignment: {
name: "section_alignment",
offset: 32,
size: 4,
value: null,
data_type: "hex",
description: "节对齐",
},
file_alignment: {
name: "file_alignment",
offset: 36,
size: 4,
value: null,
data_type: "hex",
description: "文件对齐",
},
major_operating_system_version: {
name: "major_operating_system_version",
offset: 40,
size: 2,
value: null,
data_type: "hex",
description: "操作系统主版本号",
},
minor_operating_system_version: {
name: "minor_operating_system_version",
offset: 42,
size: 2,
value: null,
data_type: "hex",
description: "操作系统次版本号",
},
major_image_version: {
name: "major_image_version",
offset: 44,
size: 2,
value: null,
data_type: "hex",
description: "映像主版本号",
},
minor_image_version: {
name: "minor_image_version",
offset: 46,
size: 2,
value: null,
data_type: "hex",
description: "映像次版本号",
},
major_subsystem_version: {
name: "major_subsystem_version",
offset: 48,
size: 2,
value: null,
data_type: "hex",
description: "子系统主版本号",
},
minor_subsystem_version: {
name: "minor_subsystem_version",
offset: 50,
size: 2,
value: null,
data_type: "hex",
description: "子系统次版本号",
},
win32_version_value: {
name: "win32_version_value",
offset: 52,
size: 4,
value: null,
data_type: "hex",
description: "Win32版本值",
},
size_of_image: {
name: "size_of_image",
offset: 56,
size: 4,
value: null,
data_type: "hex",
description: "映像大小",
},
size_of_headers: {
name: "size_of_headers",
offset: 60,
size: 4,
value: null,
data_type: "hex",
description: "头部大小",
},
checksum: {
name: "checksum",
offset: 64,
size: 4,
value: null,
data_type: "hex",
description: "校验和",
},
subsystem: {
name: "subsystem",
offset: 68,
size: 2,
value: null,
data_type: "hex",
description: "子系统",
},
dll_characteristics: {
name: "dll_characteristics",
offset: 70,
size: 2,
value: null,
data_type: "hex",
description: "DLL特性",
},
size_of_stack_reserve: {
name: "size_of_stack_reserve",
offset: 72,
size: 8,
value: null,
data_type: "hex",
description: "堆栈保留大小",
},
size_of_stack_commit: {
name: "size_of_stack_commit",
offset: 80,
size: 8,
value: null,
data_type: "hex",
description: "堆栈提交大小",
},
size_of_heap_reserve: {
name: "size_of_heap_reserve",
offset: 88,
size: 8,
value: null,
data_type: "hex",
description: "堆保留大小",
},
size_of_heap_commit: {
name: "size_of_heap_commit",
offset: 96,
size: 8,
value: null,
data_type: "hex",
description: "堆提交大小",
},
loader_flags: {
name: "loader_flags",
offset: 104,
size: 4,
value: null,
data_type: "hex",
description: "加载器标志",
},
number_of_rva_and_sizes: {
name: "number_of_rva_and_sizes",
offset: 108,
size: 4,
value: null,
data_type: "hex",
description: "RVA和大小数量",
},
};
const command = "command_get_pe_data_optional_header";
const columns = [
{
title: "字段名",
dataIndex: "name",
key: "name",
},
{
title: "偏移",
dataIndex: "offset",
key: "offset",
hexSwitch: true,
},
{
title: "大小",
dataIndex: "size",
key: "size",
},
{
title: "值",
dataIndex: "value",
key: "value",
hexSwitch: true,
editable: true,
},
{
title: "描述信息",
dataIndex: "description",
key: "description",
},
];
return (
<NodeTableComponent
dataTemplate={dataTemplate}
command={command}
columns={columns as any}
></NodeTableComponent>
);
}

View File

@@ -9,6 +9,7 @@ import SiderTree from "../components/side_tree/SideTree";
import DosHeader from "../components/DosHeader/DosHeader";
import NtHeader from "../components/NTHeader/NTHeader";
import FileHeader from "../components/FileHeader/FileHeader";
import OptionalHeader from "../components/OptionalHeader/OptionalHeader";
import NodeTableComponent, {
DataTemplateInterface,
} from "../components/NodeTableComponent/NodeTableComponent";
@@ -18,6 +19,7 @@ const SelectNodeMap = {
dos_header: <DosHeader />,
nt_header: <NtHeader />,
file_header: <FileHeader />,
optional_header: <OptionalHeader />,
};
export default function MainPage() {