solitary8 / v-finder

This is a vulnerability scanner mainly coded in python using nmap with an interactive GUI,this scanner is for Linux and macOS
GNU General Public License v3.0
4 stars 1 forks source link

Semantic Error #7

Open DJStompZone opened 2 weeks ago

DJStompZone commented 2 weeks ago

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.

solitary8 commented 2 weeks ago

thank your for submitting this I will immediately change the code