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 5d0fad48eca3ae9b6b1d76b92be1a28965e622a5
parent e64ffe978bec018762c98957a34c3d5a58bd1c49
Author: Sheng <webmaster0115@gmail.com>
Date:   Mon, 20 Nov 2017 17:58:32 +0800

Added get_addr to get real client addr

Diffstat:
Mmain.py | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/main.py b/main.py @@ -206,8 +206,16 @@ class WsockHandler(tornado.websocket.WebSocketHandler): def check_origin(self, origin): return True + def get_addr(self): + ip = self.request.headers.get_list('X-Real-Ip') + port = self.request.headers.get_list('X-Real-Port') + addr = ':'.join(ip + port) + if not addr: + addr = '{}:{}'.format(*self.stream.socket.getpeername()) + return addr + def open(self): - self.src_addr = '{}:{}'.format(*self.stream.socket.getpeername()) + self.src_addr = self.get_addr() logging.info('Connected from {}'.format(self.src_addr)) worker = workers.pop(self.get_argument('id'), None) if not worker: