webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit 7f6db649bfd26c2f59c3cc26440af77591269109
parent 4f9b5e202908640b68cc42a5a262078639f8a403
Author: Sheng <webmaster0115@gmail.com>
Date:   Thu, 19 Sep 2019 10:55:34 +0800

Support link scope ipv6 address

Diffstat:
Mtests/test_utils.py | 4++++
Mwebssh/utils.py | 5++++-
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/test_utils.py b/tests/test_utils.py @@ -35,6 +35,10 @@ class TestUitls(unittest.TestCase): self.assertFalse(is_valid_ip_address(b'abc')) self.assertTrue(is_valid_ip_address('::1')) self.assertTrue(is_valid_ip_address(b'::1')) + self.assertTrue(is_valid_ip_address('fe80::1111:2222:3333:4444')) + self.assertTrue(is_valid_ip_address(b'fe80::1111:2222:3333:4444')) + self.assertTrue(is_valid_ip_address('fe80::1111:2222:3333:4444%eth0')) + self.assertTrue(is_valid_ip_address(b'fe80::1111:2222:3333:4444%eth0')) def test_is_valid_port(self): self.assertTrue(is_valid_port(80)) diff --git a/webssh/utils.py b/webssh/utils.py @@ -36,7 +36,10 @@ def to_int(string): def to_ip_address(ipstr): - return ipaddress.ip_address(to_str(ipstr)) + ip = to_str(ipstr) + if ip.startswith('fe80::'): + ip = ip.split('%')[0] + return ipaddress.ip_address(ip) def is_valid_ip_address(ipstr):