diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2022-02-25 20:16:15 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2022-02-25 20:16:15 +0000 |
commit | 0c284f018029b102c536068689248fa6e8c0d424 (patch) | |
tree | 405b7092701dcfa3ded95a203db46055e18af20b /tunnel.py | |
parent | 6f437c6c981575d3ab33c37e3041a5177c094e15 (diff) | |
download | ReverseSSHTunnel-0c284f018029b102c536068689248fa6e8c0d424.tar.gz ReverseSSHTunnel-0c284f018029b102c536068689248fa6e8c0d424.zip |
added configuration file and script example
Diffstat (limited to 'tunnel.py')
-rw-r--r-- | tunnel.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tunnel.py b/tunnel.py new file mode 100644 index 0000000..b8e7540 --- /dev/null +++ b/tunnel.py @@ -0,0 +1,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)) |