Last active
September 5, 2019 11:22
-
-
Save majek/7b918e3fbf6395817b5a726038d36e01 to your computer and use it in GitHub Desktop.
inet-tool demo
This file contains hidden or 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
#!/bin/bash | |
set -e | |
if [ ! -e './venv/bin/doitlive' ]; then | |
echo "Run ./venv/bin/pip3 install doitlive" | |
exit 1 | |
fi | |
if [ `id -u` != '0' ]; then | |
echo "[!] FATAL: run as root" | |
exit 1 | |
fi | |
PATH=$PATH:.:$PWD/tools | |
TOOLS="bpftool inet-tool socket-activation.py hello-world-server.py ss hello-world-inet-register.py" | |
for TOOL in $TOOLS; do | |
which $TOOL || (echo "[!] FATAL: $TOOL not in PATH"; exit 1) | |
done | |
killall hello-world-server.py || true | |
killall hello-world-inet-register.py || true | |
inet-tool unload | |
./venv/bin/doitlive play session.sh --speed=3 |
This file contains hidden or 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
#doitlive prompt: {TTY.RED}{TTY.BOLD}programmable-socket-dispatch{TTY.RESET} $ | |
inet-tool --help | |
inet-tool info | |
inet-tool load | |
inet-tool info | |
bpftool prog | tail -n 3 | |
#ls -lah /sys/fs/bpf | |
inet-tool list | |
inet-tool register terminator-service | |
inet-tool list | |
# socket-activation.py -l tcp://127.0.0.1:0 -- inet-tool register terminator-service -- hello-world-server.py & | |
hello-world-inet-register.py --fdname terminator-service & | |
echo | |
ss -l -t -e -p|grep hello | |
inet-tool list | |
inet-tool bind 6 127.0.0.1:80 terminator-service | |
inet-tool bind 6 127.0.0.1:22 terminator-service | |
inet-tool bind 6 127.0.0.1:0 terminator-service | |
inet-tool list | |
inet-tool unbind 6 127.0.0.1:0 | |
inet-tool bind 6 127.0.0.0/8:443 terminator-service | |
inet-tool bind 6 0.0.0.0/0:0 terminator-service | |
inet-tool unload | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment