Fix clippy warnings: use contains(), fix late initialization

This commit is contained in:
NK
2026-02-10 15:35:47 +01:00
parent 2c4109b8c2
commit 868137e2a4
3 changed files with 3 additions and 8 deletions
+1 -1
View File
@@ -426,7 +426,7 @@ fn try_dpapi_entry_match(page: &[u8], off: usize) -> bool {
// insertTime at +0x28: FILETIME should be a reasonable date (2000-2040)
// High DWORD of FILETIME for year 2000 ≈ 0x01BF..., year 2040 ≈ 0x01E0...
let ft_high = u32::from_le_bytes(page[off + 0x2C..off + 0x30].try_into().unwrap());
if ft_high < 0x01BF_0000 || ft_high > 0x01E0_0000 {
if !(0x01BF_0000..=0x01E0_0000).contains(&ft_high) {
return false;
}
// key_size at +0x30: must be 32, 48, or 64
+1 -6
View File
@@ -164,7 +164,6 @@ pub fn extract_all_credentials<P: PhysicalMemory>(
let mut wdigest_status = "paged";
let mut kerberos_status = "paged";
let mut tspkg_status = "paged";
let dpapi_status;
let mut ssp_status = "empty";
let mut livessp_status = if dlls.livessp.is_some() { "paged" } else { "n/a" };
let mut credman_status = "paged";
@@ -267,11 +266,7 @@ pub fn extract_all_credentials<P: PhysicalMemory>(
crate::lsass::dpapi::extract_dpapi_physical_scan(phys, lsass.dtb, &lsass_vmem, &keys)
}
};
if dpapi_creds.is_empty() {
dpapi_status = "empty";
} else {
dpapi_status = "ok";
}
let dpapi_status = if dpapi_creds.is_empty() { "empty" } else { "ok" };
for (luid, dpapi_cred) in dpapi_creds {
let entry = all_creds.entry(luid).or_insert_with(|| {
Credential::new_empty(luid, String::new(), String::new())
+1 -1
View File
@@ -1016,7 +1016,7 @@ fn find_list_addr_and_count(vmem: &impl VirtualMemory, pattern_addr: u64) -> Res
for &addr in &lea_addrs {
let val = vmem.read_virt_u32(addr).unwrap_or(0);
// LogonSessionListCount is typically 64 or another small power-of-2
if val >= 4 && val <= 256 {
if (4..=256).contains(&val) {
count = val as usize;
log::info!("LogonSessionListCount at 0x{:x} = {}", addr, val);
} else {