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

Semantic Error #7

Open
DJStompZone opened this issue Jun 19, 2024 · 1 comment · May be fixed by #8
Open

Semantic Error #7

DJStompZone opened this issue Jun 19, 2024 · 1 comment · May be fixed by #8

Comments

@DJStompZone
Copy link

Issue Description

The condition "Kali" or "Fedora" in result.stdout.strip() in v-finder3.0.py incorrectly evaluates to True under all conditions, since the expression checks the truthiness of the non-empty string "Kali" before evaluating "Fedora" in result.stdout.strip(). This results in a logical error, potentially leading to unintended behavior as it does not accurately check if the distribution names are present in the system's output.

Affected Code:

Line 52 of v-finder3.0.py

Proposed Solution

To address this issue, the conditional expression should be corrected to check each string separately. Here is a simple fix:

_distro = result.stdout.strip()
if "Kali" in _distro or "Fedora" in _distro:
  # ...

Alternatively, for a more robust solution, Python's any() function combined with a generator expression can be used to efficiently check for multiple possible matches:

if any(_distro in result.stdout.strip() for _distro in ("Kali", "Fedora", "Some Other Distro")):
  # ...

This approach not only resolves the logical error but also enhances the readability and maintainability of the code by simplifying the inclusion of additional distributions in the future.

@DJStompZone DJStompZone linked a pull request Jun 19, 2024 that will close this issue
3 tasks
@solitary8
Copy link
Owner

thank your for submitting this I will immediately change the code

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 a pull request may close this issue.

2 participants