diff options
| author | hc <hc@email.ch> | 2025-02-03 18:30:37 +0800 |
|---|---|---|
| committer | hc <hc@email.ch> | 2025-02-03 18:30:37 +0800 |
| commit | 6fb080f913484176640237d223502cdfaf45f66b (patch) | |
| tree | d847348e32720eba20bb0849bec7ee2793f18705 | |
| parent | 969d9e2382347768415e1d9b61bd8024b20b27cd (diff) | |
| -rw-r--r-- | client_manager.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/client_manager.py b/client_manager.py index ab29e16..016e76d 100644 --- a/client_manager.py +++ b/client_manager.py | |||
| @@ -47,6 +47,10 @@ def get_ssh_port(pid): | |||
| 47 | if i in l[1] and "*:" in l[8]: | 47 | if i in l[1] and "*:" in l[8]: |
| 48 | port = l[8][2:] | 48 | port = l[8][2:] |
| 49 | ''' | 49 | ''' |
| 50 | # using the pid of the ssh connection, get the string of the connection 45.32.108.159:ssh->210.10.76.5:45460 | ||
| 51 | # then get the other pid with the same string | ||
| 52 | # then get the other pid | ||
| 53 | # then get the publicly forwarded port | ||
| 50 | try: | 54 | try: |
| 51 | lines = subprocess.check_output("lsof -i -n | grep sshd", shell=True, text=True).splitlines() | 55 | lines = subprocess.check_output("lsof -i -n | grep sshd", shell=True, text=True).splitlines() |
| 52 | pid = str(pid) | 56 | pid = str(pid) |
