parameters: (self)
docstring: Called after a new WebSocket connection has been established.
docstring_summary: Called after a new WebSocket connection has been established.
docstring_tokens: Called after a new WebSocket connection has been established .
function: def new_client(self):
          """
          Called after a new WebSocket connection has been established.
          """
          # Checks if we receive a token, and look
          # for a valid target for it then
          if self.target_cfg:
              (self.target_host, self.target_port) = self.get_target(self.target_cfg, self.path)
  
          # Connect to the target
          if self.wrap_cmd:
              msg = "connecting to command: '%s' (port %s)" % (" ".join(self.wrap_cmd), self.target_port)
          elif self.unix_target:
              msg = "connecting to unix socket: %s" % self.unix_target
          else:
              msg = "connecting to: %s:%s" % (
                                      self.target_host, self.target_port)
  
          if self.ssl_target:
              msg += " (using SSL)"
          self.msg(msg)
  
          tsock = self.socket(self.target_host, self.target_port,
                  connect=True, use_ssl=self.ssl_target, unix_socket=self.unix_target)
  
          if self.verbose and not self.daemon:
              print(self.traffic_legend)
  
          # Start proxying
          try:
              self.do_proxy(tsock)
          except:
              if tsock:
                  tsock.shutdown(socket.SHUT_RDWR)
                  tsock.close()
                  self.vmsg("%s:%s: Closed target" %(
                      self.target_host, self.target_port))
              raise
function_tokens: def new_client ( self ) : # Checks if we receive a token, and look # for a valid target for it then if self . target_cfg : ( self . target_host , self . target_port ) = self . get_target ( self . target_cfg , self . path ) # Connect to the target if self . wrap_cmd : msg = "connecting to command: '%s' (port %s)" % ( " " . join ( self . wrap_cmd ) , self . target_port ) elif self . unix_target : msg = "connecting to unix socket: %s" % self . unix_target else : msg = "connecting to: %s:%s" % ( self . target_host , self . target_port ) if self . ssl_target : msg += " (using SSL)" self . msg ( msg ) tsock = self . socket ( self . target_host , self . target_port , connect = True , use_ssl = self . ssl_target , unix_socket = self . unix_target ) if self . verbose and not self . daemon : print ( self . traffic_legend ) # Start proxying try : self . do_proxy ( tsock ) except : if tsock : tsock . shutdown ( socket . SHUT_RDWR ) tsock . close ( ) self . vmsg ( "%s:%s: Closed target" % ( self . target_host , self . target_port ) ) raise