Skip to content

Add xdg-open package for generic graphical sample detonation on Linux#2966

Merged
kevoreilly merged 1 commit into
kevoreilly:masterfrom
PCSS-PSNC:feature/xdg-open-linux-package
Apr 9, 2026
Merged

Add xdg-open package for generic graphical sample detonation on Linux#2966
kevoreilly merged 1 commit into
kevoreilly:masterfrom
PCSS-PSNC:feature/xdg-open-linux-package

Conversation

@RobertBendun
Copy link
Copy Markdown
Contributor

xdg-open is a generic way to open files on linux that respects users preferences, making detonation of documents like pdf files in system configured pdf reader possible

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Xdg_open package module for Linux analysis, which enables running samples using the xdg-open utility. The review feedback highlights a deviation from PEP 8 naming conventions for the class name and recommends avoiding hardcoded binary paths to ensure better compatibility across different Linux distributions.

from lib.core.packages import Package


class Xdg_open(Package):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The class name Xdg_open does not follow PEP 8 naming conventions for classes (CapWords). While the current loader logic in lib/core/packages.py uses .capitalize() on the filename, which results in Xdg_open, it would be better to update the loader to handle snake_case to PascalCase conversion properly so that standard naming can be used. If the loader cannot be changed, this is acceptable but inconsistent with Python standards.

References
  1. Class names should normally use the CapWords convention as per PEP 8. (link)


def prepare(self):
self.args = [self.target] + self.args
self.target = "/usr/bin/xdg-open"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Hardcoding the path to /usr/bin/xdg-open might fail on distributions where it is located elsewhere (e.g., /bin/xdg-open). It is generally safer to rely on the system PATH or use a utility to locate the binary.

Suggested change
self.target = "/usr/bin/xdg-open"
self.target = "xdg-open"

@kevoreilly kevoreilly merged commit 416e11a into kevoreilly:master Apr 9, 2026
4 checks passed
@kevoreilly
Copy link
Copy Markdown
Owner

Thank you

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.

2 participants