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

Added Kubernetes Checks #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions LinEnum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,53 @@ if [ "$lxdgroup" ]; then
fi
}

k8s_checks()
{

k8sconfig=`kubectl config view 2>/dev/null`

if [ "$k8sconfig" ]; then
echo -e "\e[00;33m[+] Looks like there is a Kubernetes Cluster running \e[00m\n$k8sconfig"
echo -e "\n"


k8sservices=`kubectl get services 2>/dev/null`
if [ "$k8sservices" ]; then
echo -e "\e[00;33m[+] Services Running on Kubernetes cluster. \e[00m\n$k8sservices"
echo -e "\n"
fi

k8spodswithlabels=`kubectl get pods --all-namespaces 2>/dev/null`
if [ "$k8spodswithlabels" ]; then
echo -e "\e[00;33m[+] Kubernetes Pods with Labels \e[00m\n$k8spodswithlabels"
echo -e "\e[00;33m[+] Run 'kubectl logs <pod-name>' to search for interesting information in logs\e[00m\n"
echo -e "\e[00;33m[+] Run 'kubectl exec -it <pod-name> -- sh' to gain shell access into pods and extract information like 'printenv' etc \e[00m\n"
echo -e "\n"
fi

k8snodes=`kubectl get nodes 2>/dev/null`
if [ "$k8snodes" ]; then
echo -e "\e[00;33m[+] Kubernetes Nodes \e[00m\n$k8snodes"
echo -e "\n"
fi

k8sevents=`kubectl get events 2>/dev/null`
if [ "$k8sevents" ]; then
echo -e "\e[00;33m[+] Kubernetes Events. Check here for interesting \e[00m\n$k8sevents"
echo -e "\n"
fi

k8ssecrets=`kubectl get secret -o json 2>/dev/null`
if [ "$k8ssecrets" ]; then
echo -e "\e[00;33m[+] Fetch all Secrets stored in Kubernetes Cluster \e[00m\n$k8ssecrets"
echo -e "\n"
fi

fi

}


footer()
{
echo -e "\e[00;33m### SCAN COMPLETE ####################################\e[00m"
Expand All @@ -1321,6 +1368,7 @@ call_each()
interesting_files
docker_checks
lxc_container_checks
k8s_checks
footer
}

Expand Down