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

Add libvirt loader and QEMU child plugin #654

Merged
merged 6 commits into from
Aug 12, 2024

Conversation

Miauwkeru
Copy link
Contributor

No description provided.

@Miauwkeru Miauwkeru linked an issue Mar 27, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Mar 27, 2024

Codecov Report

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

Project coverage is 75.48%. Comparing base (22d1ca8) to head (fc45ee0).

Files Patch % Lines
dissect/target/loaders/libvirt.py 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #654      +/-   ##
==========================================
+ Coverage   75.45%   75.48%   +0.03%     
==========================================
  Files         296      298       +2     
  Lines       25643    25684      +41     
==========================================
+ Hits        19348    19388      +40     
- Misses       6295     6296       +1     
Flag Coverage Δ
unittests 75.48% <97.56%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

if path.suffix.lower() != ".xml":
return False

return "<domain>" in path.read_text().lower()
Copy link
Member

Choose a reason for hiding this comment

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

Is this the first element? Maybe better to limit how many bytes you read to a sensible limit. You may accidentally read a .xml of several GB large.

xml_data = ElementTree.XML(self.path.read_text())
for disk in xml_data.findall("devices/disk/source"):
if file := disk.get("file"):
target.disk.add(container.open(file))
Copy link
Member

Choose a reason for hiding this comment

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

Are these absolute paths? You should join on self.path regardless to ensure that you're reading the file from the same target (local Path or a bound TargetPath).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I've seen, these paths are absolute. But it is fair it should be joined with self.path

@Miauwkeru Miauwkeru force-pushed the 653-add-support-for-libvirtqemu-child-targets branch from 78ff93c to 9ae003b Compare March 28, 2024 11:45
@Miauwkeru Miauwkeru force-pushed the 653-add-support-for-libvirtqemu-child-targets branch from 9ae003b to 2e7f786 Compare August 9, 2024 13:39
@Miauwkeru Miauwkeru requested a review from Schamper August 9, 2024 13:40
@Schamper Schamper changed the title Add libvirt loader and qemu child plugin Add libvirt loader and QEMU child plugin Aug 9, 2024
@Miauwkeru Miauwkeru requested a review from Schamper August 12, 2024 09:05
@Miauwkeru Miauwkeru requested a review from Schamper August 12, 2024 09:41
@Miauwkeru Miauwkeru merged commit ba9bf7b into main Aug 12, 2024
18 checks passed
@Miauwkeru Miauwkeru deleted the 653-add-support-for-libvirtqemu-child-targets branch August 12, 2024 10:27
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.

Add support for libvirt/qemu child targets
3 participants