blob: b8e7540903f64e0b4c36b1c33c6098e7d5a26255 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import configparser
import subprocess
CONFIG = configparser.ConfigParser()
CONFIG.read("tunnel.conf")
cmd = ["ssh", "-nNTv"]
if CONFIG.has_option("server", "ssh_port"):
cmd += ["-p", CONFIG.get("server", "ssh_port")]
for section in CONFIG.sections():
if section.startswith("forward"):
cmd += ["-R", "%s:%s" % (CONFIG.get(section, "to"), CONFIG.get(section, "from"))]
cmd.append(CONFIG.get("server", "host"))
print("Using command: " + " ".join(cmd))
|