1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Ban port dissalowed by chrome and firefox

This commit is contained in:
Julien Duponchelle 2016-05-03 21:07:01 +02:00
parent f3095d94c1
commit 8e429ee4c1
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 7 additions and 3 deletions

View File

@ -396,8 +396,8 @@ class DockerVM(BaseVM):
# We replace the port in the server answer otherwise somelink could be broke # We replace the port in the server answer otherwise somelink could be broke
server = AsyncioRawCommandServer(command, replaces=[ server = AsyncioRawCommandServer(command, replaces=[
( (
':{}'.format(self._console_http_port).encode(), '{}'.format(self._console_http_port).encode(),
':{}'.format(self.console).encode(), '{}'.format(self.console).encode(),
) )
]) ])
self._telnet_servers.append((yield from asyncio.start_server(server.run, self._manager.port_manager.console_host, self.console))) self._telnet_servers.append((yield from asyncio.start_server(server.run, self._manager.port_manager.console_host, self.console)))

View File

@ -24,6 +24,10 @@ import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
# This ports are disallowed by Chrome and Firefox to avoid trouble with skip them
BANNED_PORTS = set((1, 7,9,11,13,15,17,19,20,21,22,23,25,37,42,43,53,77,79,87,95,101,102,103,104,109,110,111,113,115,117,119,123,135,139,143,179,389,465,512,513,514,515,526,530,531,532,540,556,563,587,601,636,993,995,2049,3659,4045,6000,6665,6666,6667,6668,6669))
class PortManager: class PortManager:
""" """
@ -144,7 +148,7 @@ class PortManager:
last_exception = None last_exception = None
for port in range(start_port, end_port + 1): for port in range(start_port, end_port + 1):
if port in ignore_ports: if port in ignore_ports or port in BANNED_PORTS:
continue continue
try: try: