def tunnelX11(node, display=None):
 if ((display is None) and ('DISPLAY' in environ)):
  display = environ['DISPLAY']
 if (display is None):
  error('Error: Cannot connect to display\n')
  return (None, None)
 (host, screen) = display.split(':')
 if ((not host) or (host == 'unix')):
  quietRun('xhost +si:localuser:root')
  return (display, None)
 else:
  port = (6000 + int(float(screen)))
  connection = ('TCP\\:%s\\:%s' % (host, port))
  cmd = ['socat', ('TCP-LISTEN:%d,fork,reuseaddr' % port), ("EXEC:'mnexec -a 1 socat STDIO %s'" % connection)]
 return (('localhost:' + screen), node.popen(cmd))

def tunnelX11 ( node , display = None ) : if ( ( display is None ) and ( 'DISPLAY' in environ ) ) : display = environ [ 'DISPLAY' ] if ( display is None ) : error ( 'Error: Cannot connect to display\n' ) return ( None , None ) ( host , screen ) = display . split ( ':' ) if ( ( not host ) or ( host == 'unix' ) ) : quietRun ( 'xhost +si:localuser:root' ) return ( display , None ) else : port = ( 6000 + int ( float ( screen ) ) ) connection = ( 'TCP\\:%s\\:%s' % ( host , port ) ) cmd = [ 'socat' , ( 'TCP-LISTEN:%d,fork,reuseaddr' % port ) , ( "EXEC:'mnexec -a 1 socat STDIO %s'" % connection ) ] return ( ( 'localhost:' + screen ) , node . popen ( cmd ) )
create an x11 tunnel from node:6000 to the root host display: display on root host returns: node $display .