Crawl the static information from a specific namespace in Kubernetes.
- Get all unique Docker images.
- List all actively used resources.
- Crawl the yaml from each active resources.
- Store all the above information in a directory structure.
-- namespace
docker_images.txt
active_resources.txt
-- resource 1
manifest_resource_name.yaml
-- resource 2
manifest_resource_name.yaml
- This acts as a snapshot of the environment.
- You can feed the results to perform SAST scan using Kube-linter, kube-score, checkov, etc.
- Also, using docker-multi-scan you can scan the images using grype, trivy and docker-scout at once.
go install -v github.com/okpalindrome/dkube@latest
$ dkube --help
Usage of dkube:
-destination string
Destination directory/folder to save.
-namespace string
Provide namespace or it can take from current context's default namespace set.
Used kubectl instead of the client-go API because, as a pentester, it is unlikely that I will consistently have access to the same version.