fix bugs
This commit is contained in:
parent
5a8b7755a3
commit
6a1f22c60b
@ -3,9 +3,14 @@
|
||||
# iptable_docker.sh $if
|
||||
if="$1"
|
||||
gw="$(ip -4 r show dev $if | awk '/default/ {print $3}')"
|
||||
network="$(ip -o addr show dev $if| awk '$3 == "inet" {print $4}')"
|
||||
network="$(ip -o route show dev $if |awk '$1 != "default" {print $1}')"
|
||||
#network="$(ip -o route show dev $if |awk '$6 == "src" {print $1}')"
|
||||
echo nameserver 1.1.1.1 > /etc/resolv.conf
|
||||
#network="$(ip -o addr show dev $if| awk '$3 == "inet" {print $4}')"
|
||||
#ip="$(ip -4 a show dev $if | awk -F '[ \t/]+' '/inet .*global/ {print $3}')"
|
||||
|
||||
echo if=$if
|
||||
echo network=$network
|
||||
echo gw=$gw
|
||||
# Drop all IPv6 traffic
|
||||
ip6tables -F
|
||||
ip6tables -X
|
||||
|
||||
13
test.py
13
test.py
@ -3,18 +3,18 @@ import tornado.web
|
||||
import json
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
from o_manager import OManager
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("-i", "--interface", required=False,
|
||||
help="path to the session folder")
|
||||
help="interface (default: eth0)", default="eth0")
|
||||
ap.add_argument("-s", "--session_folder", required=True,
|
||||
help="path to the session folder", default="eth0")
|
||||
help="path to the session folder")
|
||||
args = vars(ap.parse_args())
|
||||
session_folder = args["session_folder"]
|
||||
interface = args["interface"]
|
||||
|
||||
om = OManager(session_folder, interface)
|
||||
|
||||
|
||||
@ -120,5 +120,8 @@ def make_app():
|
||||
if __name__ == "__main__":
|
||||
app = make_app()
|
||||
app.listen(8000)
|
||||
os.popen("iptable_docker.sh {interface}")
|
||||
proc = subprocess.Popen([os.path.join(dir_path, "iptable_docker.sh"), interface],
|
||||
stdout=subprocess.PIPE)
|
||||
outs, errs = proc.communicate()
|
||||
print(outs.decode())
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user