Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kris Nóva <kris@nivenly.com>
- Loading branch information
Showing
9 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bin/* | ||
*idea* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
|
||
.PHONY: build | ||
|
||
build: | ||
@echo "" | ||
@echo "" | ||
go build -o bin/hack main.go | ||
@echo "Build Complete" | ||
@echo "" | ||
@echo "" | ||
|
||
container: | ||
@echo "" | ||
@echo "" | ||
docker build -t krisnova/hack:latest image/ | ||
@echo "" | ||
@echo "" | ||
|
||
|
||
.PHONY: help | ||
help: ## Show help messages for make targets | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
Copyright © 2020 NAME HERE <EMAIL ADDRESS> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// rootCmd represents the base command when called without any subcommands | ||
var rootCmd = &cobra.Command{ | ||
Use: "hack", | ||
Short: "Utility for debugging and hacking on Kubernetes", | ||
Long: `Use hack to debug, explore, exploit and otherwise own a Kubernetes cluster.`, | ||
// Uncomment the following line if your bare application | ||
// has an action associated with it: | ||
// Run: func(cmd *cobra.Command, args []string) { }, | ||
} | ||
|
||
// Execute adds all child commands to the root command and sets flags appropriately. | ||
// This is called by main.main(). It only needs to happen once to the rootCmd. | ||
func Execute() { | ||
if err := rootCmd.Execute(); err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func init() { | ||
//flags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM ubuntu | ||
RUN apt-get update | ||
RUN apt-get install -y nmap net-tools iputils-ping # networking tools | ||
RUN apt-get install -y libcap2-bin # linux capabilities | ||
RUN apt-get install -y strace # kernel tools | ||
#RUN apt-get install -y | ||
RUN yes | unminimize | ||
COPY ./home/bashrc /root/.bashrc | ||
COPY ./home/ /root/ | ||
#EXPOSE 22 | ||
#CMD ["pdig", "-a", "./init.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/bin | ||
# | ||
# | ||
# | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# | ||
# ,/ | ||
# ,// | ||
# ___ /| |// | ||
# __/\_ --(/|___/-/ | ||
# \|\_-\___ __-_ - /-/ \. | ||
# |\_-___,-\_____--/_)' ) \ | ||
# \ -_ / __ \( ( __ \| | ||
# \__| |\)\ ) /(/| | ||
# ,._____., ',--//-| \ | ' / | ||
# / __. \, / /,---| \ / | ||
# / / _. \ \ / _/ _,' | | | ||
# | | ( ( \ | ,/\'__/'/ | | | ||
# | \ \ --, _/_------______/ \( )/ Kris Nóva | ||
# | | \ \_. \, \___/\ | ||
# | | \_ \ \ \ | ||
# \ \ \_ \ \ / \ | ||
# \ \ \._ \__ \_| | \ Stay the fuck out of my .bashrc | ||
# \ \___ \ \ | \ | ||
# \__ \__ \ \_ | \ | | ||
# | \_____ \ ____ | | | ||
# | \ \__ ---' .__\ | | | | ||
# \ \__ --- / ) | \ / | ||
# \ \____/ / ()( \ ---_ /| | ||
# \__________/(,--__ \_________. | ./ | | ||
# | \ \ ---_\--, \ \_,./ | | ||
# | \ \_ \ / ---_______-\ \\ / | ||
# \ \.___, | / \ \\ \ | ||
# \ | \_ \| \ ( |: | | ||
# \ \ \ | / / | ; | ||
# \ \ \ \ ( _' \ | | ||
# \. \ \. \ __/ | | | ||
# \ \ \. \ | | | ||
# \ \ \ \ ( ) | ||
# \ | \ | | | | ||
# | \ \ \ | | ---- | ||
# ( __; ( _; ('-_'; -------- | ||
# |___\ \___: \___: --------------- | ||
# | ||
# | ||
# | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
|
||
# | ||
# ------------------------- | ||
# [ENVIRONMENTAL VARIABLES] | ||
# ------------------------- | ||
|
||
export EDITOR=/usr/bin/emacs | ||
export PATH="$HOME/bin:$HOME/.local/bin:$PATH" | ||
export PS1="\[\033[38;5;12m\][\[$(tput sgr0)\]\[\033[38;5;10m\]\u\[$(tput sgr0)\]\[\033[38;5;12m\]@\[$(tput sgr0)\]\[\033[38;5;7m\]\h\[$(tput sgr0)\]\[\033[38;5;12m\]]\[$(tput sgr0)\]\[\033[38;5;15m\]: \[$(tput sgr0)\]\[\033[38;5;7m\]\w\[$(tput sgr0)\]\[\033[38;5;12m\]>\[$(tput sgr0)\]\[\033[38;5;10m\]\\$\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]" | ||
[ -e "/etc/DIR_COLORS" ] && DIR_COLORS="/etc/DIR_COLORS" | ||
[ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors" | ||
[ -e "$DIR_COLORS" ] || DIR_COLORS="" | ||
eval "`dircolors -b $DIR_COLORS`" | ||
|
||
# ------------------------- | ||
# [VARS] | ||
# ------------------------- | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# ------------------------- | ||
# [SYSTEM] | ||
# ------------------------- | ||
|
||
#ulimit -n 2048 | ||
#ssh-add ~/.ssh/id_rsa | ||
|
||
|
||
# ------------------------- | ||
# [FUNCTIONS] | ||
# ------------------------- | ||
|
||
# Convenience log scrapper for k8s | ||
klog(){ | ||
PO=$(kubectl get po --all-namespaces | grep $1) | ||
kubectl logs $(echo $PO | cut -d " " -f 2) -n $(echo $PO | cut -d " " -f 1) -f | ||
} | ||
|
||
. /root/probe.sh | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bin | ||
# | ||
# | ||
# | ||
|
||
echo "-----------------------------------------" | ||
echo "" | ||
echo "[HACK] A container image for debugging." | ||
echo "" | ||
echo "-----------------------------------------" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Copyright © 2020 NAME HERE <EMAIL ADDRESS> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package main | ||
|
||
import "hack/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |