Skip to content

Commit

Permalink
Added major/minor hardware rev to TPLink RTOS signature
Browse files Browse the repository at this point in the history
  • Loading branch information
devttys0 committed Oct 23, 2024
1 parent 8cf3dce commit d72edf2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/signatures/tplink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ pub fn tplink_rtos_parser(
};

if let Ok(fw_header) = parse_tplink_rtos_header(&file_data[offset..]) {
result.description = format!("{}, model number: {:X}, hardware version: {:X}, header size: {} bytes, total size: {} bytes",
result.description = format!("{}, model number: {:X}, hardware version: {:X}.{:X}, header size: {} bytes, total size: {} bytes",
result.description,
fw_header.model_number,
fw_header.hardware_revision,
fw_header.hardware_rev_major,
fw_header.hardware_rev_minor,
fw_header.header_size,
fw_header.total_size,
);
Expand Down
9 changes: 6 additions & 3 deletions src/structures/tplink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ pub struct TPLinkRTOSFirmwareHeader {
pub header_size: usize,
pub total_size: usize,
pub model_number: usize,
pub hardware_revision: usize,
pub hardware_rev_major: usize,
pub hardware_rev_minor: usize,
}

/// Parse a TP-Link RTOS firmware header
Expand All @@ -94,7 +95,8 @@ pub fn parse_tplink_rtos_header(
("magic2", "u32"),
("data_size", "u32"),
("model_number", "u16"),
("hardware_revision", "u8"),
("hardware_revision_major", "u8"),
("hardware_revision_minor", "u8"),
];

if let Ok(header) = common::parse(tplink_data, &tplink_rtos_structure, "big") {
Expand All @@ -103,7 +105,8 @@ pub fn parse_tplink_rtos_header(
header_size: HEADER_SIZE,
total_size: header["data_size"] + TOTAL_SIZE_OFFSET,
model_number: header["model_number"],
hardware_revision: header["hardware_revision"],
hardware_rev_major: header["hardware_revision_major"],
hardware_rev_minor: header["hardware_revision_minor"],
});
}
}
Expand Down

0 comments on commit d72edf2

Please sign in to comment.