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
####### with Virtual box VMs ####### | |
# fedora-ab => running sipp client # | |
# fedora-cd => running sipp server # | |
# fedora-ef => running snort-ids # | |
## starting virtual machine | |
VBoxManage startvm fedora-ab fedora-cd fedora-ef --type headless | |
## after some time, getting ip address and ssh | |
ssh docker@`VBoxManage guestproperty get "fedora-ab" "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{ print $2 }'` |
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
#!/bin/sh | |
# Shell script to connect docker container with OpenFlow enabled OVS switches | |
# | |
# Inspired from http://ewen.mcneill.gen.nz/blog/entry/2014-10-07-ryu-and-openvswitch-on-docker/ | |
# and http://ewen.mcneill.gen.nz/blog/media/docker-ovs/dockerovs | |
# Writen by Aman Mangal <[email protected]>, Jan 3, 2015 | |
#---------------------------------------------------------------------------- | |
## Use cases | |
# ./dockerovs add-br <bridge> <CIDR> |
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
Enable port 8080 through the firewall: | |
firewall-cmd --add-port=8080/tcp | |
Run socat to make docker sock available via tcp port (note the IP to listen at) | |
socat -d -d TCP-LISTEN:8080,fork,bind=192.168.122.214 UNIX:/var/run/docker.sock | |
Run pprof on your client: | |
go tool pprof http://192.168.122.214:8080/debug/pprof/profile | |
Fetching profile from http://192.168.122.214:8080/debug/pprof/profile | |
Please wait... (30s) |
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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"os" | |
"path" | |
"strconv" | |
"syscall" | |
) |
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
##### NETWORK SETUP ##### | |
# we will use docker0 bridge for network connectivity | |
# pi is connected to the laptop over ethernet | |
# on host (laptop in this case) | |
sudo brctl addif docker0 eth0 | |
# on pi | |
ifconfig eth0 172.17.42.234 |
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
./etcd -name etcd0 -data-dir data/0/ -advertise-client-urls http://127.0.0.1:2379 \ | |
-listen-client-urls http://127.0.0.1:2379 \ | |
-initial-advertise-peer-urls http://127.0.0.1:2380 \ | |
-listen-peer-urls http://127.0.0.1:2380 \ | |
-initial-cluster-token etcd-cluster \ | |
-initial-cluster etcd0=http://127.0.0.1:2380,etcd1=http://127.0.0.1:2382,etcd2=http://127.0.0.1:2384 \ | |
-initial-cluster-state new &> data/log0 | |
./etcd -name etcd1 -data-dir data/1/ -advertise-client-urls http://127.0.0.1:2381 \ | |
-listen-client-urls http://127.0.0.1:2381 \ |
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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"net" | |
"os" | |
"syscall" | |
) |
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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"net" | |
"os" | |
"syscall" | |
) |
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
#!/bin/bash | |
if [[ $0 != "/bin/bash" ]]; then | |
echo "Error: source the script!" | |
exit 1 | |
fi | |
if [[ ! -d $(pwd)/go/bin ]]; then | |
echo "Error: go installtion not found in the current directory!" | |
return |
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
## Installation | |
# sudo apt-get install build-essential python-dev libnetfilter-queue-dev | |
# sudp pip install NetfilterQueue scapy | |
## References | |
# https://www.digitalocean.com/community/tutorials/how-to-list-and-delete-iptables-firewall-rules | |
# https://github.com/phaethon/scapy | |
# https://5d4a.wordpress.com/2011/08/25/having-fun-with-nfqueue-and-scapy/ | |
# https://pypi.python.org/pypi/NetfilterQueue/0.3 | |
# http://www.netfilter.org/documentation/HOWTO/netfilter-hacking-HOWTO-3.html |
OlderNewer