Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

converted elf_analysis plugin to new base class #1266

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jstucke
Copy link
Collaborator

@jstucke jstucke commented Sep 11, 2024

No description provided.

@jstucke jstucke requested a review from maringuu September 11, 2024 15:39
@jstucke jstucke self-assigned this Sep 11, 2024
@jstucke jstucke force-pushed the elf-analysis-plugin-v1 branch from c14b112 to b307c7e Compare September 12, 2024 11:32
@jstucke jstucke force-pushed the elf-analysis-plugin-v1 branch from b307c7e to afec839 Compare December 3, 2024 08:46
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 99.44751% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.91%. Comparing base (bd5bdb0) to head (700a7d4).

Files with missing lines Patch % Lines
...alysis/hardware_analysis/code/hardware_analysis.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1266      +/-   ##
==========================================
- Coverage   92.21%   91.91%   -0.31%     
==========================================
  Files         377      376       -1     
  Lines       23068    20966    -2102     
==========================================
- Hits        21273    19270    -2003     
+ Misses       1795     1696      -99     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

for section in elf.sections:
if section.name == '.modinfo':
modinfo = section.content.tobytes()
modinfo = [entry.decode() for entry in modinfo.split(b'\x00') if entry]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we handle decoding errors here?

def normalize_lief_items(functions):
def normalize_lief_items(functions) -> list[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we remove this function completely?
Why is this in helperFunctions.hash anyways?

Comment on lines +92 to +100
header: ElfHeader
sections: List[ElfSection]
segments: List[ElfSegment]
dynamic_entries: List[DynamicEntry]
exported_functions: List[ElfSymbol]
imported_functions: List[str]
mod_info: Optional[List[str]]
note_sections: List[InfoSectionData]
behavior_classes: List[str]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we document these?
Imo, we should at least document the non-standart ones like mod_info and behavior_classes.

Comment on lines +126 to +128
sections=[ElfSection.model_validate(s) for s in json_dict['sections']],
segments=[ElfSegment.model_validate(s) for s in json_dict['segments']],
dynamic_entries=[DynamicEntry.model_validate(e) for e in json_dict['dynamic_entries']],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo the code gets more readable if we do not serialize the lief elf representation to json.
E.g. like the exported_functions above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants