fix: resolve ws2_32/oleaut32/wsock32 ordinal imports in imphash (match pefile) - #11
Merged
Merged
Conversation
Contributor
Reviewer's GuideImphash calculation for PE imports now resolves ordinal-only imports from ws2_32/wsock32/oleaut32 to their real function names using a new ordinal lookup module, aligning results with pefile/VirusTotal, and the crate version/changelog are updated accordingly. Sequence diagram for special ordinal resolution in imphashsequenceDiagram
participant pe as parse_pe
participant ord as special_ordinal_name
participant ws as ws2_32/wsock32/oleaut32
pe->>pe: detect by_ordinal
pe->>ord: special_ordinal_name(dll_lower, import.ordinal)
alt [dll_lower is ws2_32.dll/wsock32.dll/oleaut32.dll]
ord->>ws: ws2_32(ordinal)/wsock32(ordinal)/oleaut32(ordinal)
ws-->>ord: function_name
ord-->>pe: Some(function_name)
pe->>pe: func = function_name (lowercased)
else [non-special library or ordinal not in table]
ord-->>pe: None
pe->>pe: func = format!("ord{}", import.ordinal)
end
pe->>pe: imphash_entries.push(format!("{lib_base}.{func}"))
pe->>pe: func_display = func.clone()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Resolve PE import hash discrepancies by normalizing certain ordinal imports to match pefile/VirusTotal behavior and bump the crate version.
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests: