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

fix:kubectl discovery #543

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

Conversation

sgaist
Copy link

@sgaist sgaist commented Oct 14, 2023

Description

Please include a summary of the change and which issue is fixed. Also include relevant motivation and context. List any dependencies that are required for this change.

The kubectl discovery is not functional as the whole command is passed as a single string and thus cannot work with subprocess.check_output. This merge request fixes that and simplifies the version parsing as well.

Contribution Guidelines

Please Read through the Contribution Guidelines.

Fixed Issues

Please mention any issues fixed in the PR by referencing it properly in the commit message.
As per the convention, use appropriate keywords such as fixes, closes, resolves to automatically refer the issue.
Please consult official github documentation for details.

Fixes #534

"BEFORE" and "AFTER" output

To verify that the change works as desired, please include an output of terminal before and after the changes under headings "BEFORE" and "AFTER".

BEFORE

Any Terminal Output Before Changes.
2023-10-14 17:15:45,325 DEBUG kube_hunter.modules.discovery.kubectl Could not find kubectl client

AFTER

2023-10-14 17:35:55,474 DEBUG kube_hunter.modules.discovery.kubectl Found kubectl client: v1.28.2

Contribution checklist

  • I have read the Contributing Guidelines.
  • The commits refer to an active issue in the repository.
  • I have added automated testing to cover this case.

Notes

Please mention if you have not checked any of the above boxes.

kubectl is required for the test to pass

Previously the call to kubectl would fail as it was passed as a single
string.

The output parsing has also been simplified using the json output of
the command.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

faulty kubectl verification
2 participants