|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
# QEMU/VDE network environment preparation script
|
|
|
|
|
RUN='/run/vde'
|
|
|
|
|
qemu=/opt/qemu/build/qemu-system-x86_64
|
|
|
|
|
proxy=`dirname "$(readlink -f "$0")"`/../proxy/proxy
|
|
|
|
|
|
|
|
|
|
# PID identifiers
|
|
|
|
|
all="$RUN/*.pid"
|
|
|
|
@ -11,6 +12,9 @@ alpine="$RUN/vm_alpine_*.pid"
|
|
|
|
|
alpine1="$RUN/vm_alpine_1.pid"
|
|
|
|
|
alpine2="$RUN/vm_alpine_2.pid"
|
|
|
|
|
kali="$RUN/vm_kali.pid"
|
|
|
|
|
proxy2="$RUN/proxy_2.pid"
|
|
|
|
|
proxy3="$RUN/proxy_3.pid"
|
|
|
|
|
proxies="$RUN/proxy_*.pid"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
@ -26,13 +30,19 @@ start)
|
|
|
|
|
slirpvde -D -H 10.0.0.2 --daemon -s $RUN/sw_main.sock -p $RUN/net_slirp.pid
|
|
|
|
|
;;&
|
|
|
|
|
alpine1 | alpine | vms | all)
|
|
|
|
|
$qemu -m 512 -nic vde,mac='52:54:00:12:34:56',sock=$RUN/sw_proxy1.sock -hda alpine1.qcow2 -daemonize -vnc :1 -pidfile $RUN/vm_alpine_1.pid
|
|
|
|
|
$qemu -m 512 -nic vde,mac='52:54:00:12:34:56',sock=$RUN/sw_proxy1.sock -hda alpine1.qcow2 -daemonize -vnc :1 -pidfile $alpine1
|
|
|
|
|
;;&
|
|
|
|
|
alpine2 | alpine | vms | all)
|
|
|
|
|
$qemu -m 512 -nic vde,mac='52:54:00:12:34:66',sock=$RUN/sw_proxy2.sock -hda alpine2.qcow2 -daemonize -vnc :2 -pidfile $RUN/vm_alpine_2.pid
|
|
|
|
|
$qemu -m 512 -nic vde,mac='52:54:00:12:34:66',sock=$RUN/sw_proxy2.sock -hda alpine2.qcow2 -daemonize -vnc :2 -pidfile $alpine2
|
|
|
|
|
;;&
|
|
|
|
|
kali | vms | all)
|
|
|
|
|
$qemu -m 1024 -nic user -nic vde,mac='52:54:00:12:34:76',sock=$RUN/sw_proxy3.sock -hda kali.qcow2 -daemonize -vnc :3 -pidfile $RUN/vm_kali.pid
|
|
|
|
|
$qemu -m 1024 -nic user -nic vde,mac='52:54:00:12:34:76',sock=$RUN/sw_proxy3.sock -hda kali.qcow2 -daemonize -vnc :3 -pidfile $kali
|
|
|
|
|
;;&
|
|
|
|
|
proxy2 | proxies | all)
|
|
|
|
|
$proxy -proxy 2 -passthrough -logfile $RUN/proxy_2.log -pidfile $proxy2 &
|
|
|
|
|
;;&
|
|
|
|
|
proxy3 | proxies | all)
|
|
|
|
|
$proxy -proxy 3 -passthrough -logfile $RUN/proxy_3.log -pidfile $proxy3 &
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo "Usage: envctl start {all|network|vms|alpine|alpine1|alpine2|kali}"
|
|
|
|
|