Handle an AgentJobSSHDebug message. Send the data back to the client
192127
async def handle_agent_job_ssh_debug(self, _, message: AgentJobSSHDebug):
        """"""
        await ZMQUtils.send_with_addr(self._client_socket, message.job_id[0], BackendJobSSHDebug(message.job_id[1], message.host, message.port,
                                                                                                 message.password))
518550
def handleMethodCallMessage(self, msg):
        
        if (
            msg.interface == 'org.freedesktop.DBus.Peer'
            and msg.member == 'Ping'
        ):
            r = message.MethodReturnMessage(
                msg.serial,
                destination=msg.sender,
            )

            self.conn.sendMessage(r)
            return

        if (
                msg.interface == 'org.freedesktop.DBus.Introspectable'
                and msg.member == 'Introspect'
        ):
            xml = introspection.generateIntrospectionXML(
                msg.path,
                self.exports,
            )

            if xml is not None:
                r = message.MethodReturnMessage(
                    msg.serial,
                    body=[xml],
                    destination=msg.sender,
                    signature='s',
                )

                self.conn.sendMessage(r)

                return

        # Try to get object from complete object path
        o = self.exports.get(msg.path, None)
        if o is None:
            self._send_err(
                msg,
                'org.freedesktop.DBus.Error.UnknownObject',
                '%s is not an object provided by this process.' % (msg.path),
            )
            return

        if (
                msg.interface == 'org.freedesktop.DBus.ObjectManager'
                and msg.member == 'GetManagedObjects'
        ):
            i_and_p = self.getManagedObjects(o.getObjectPath())

            r = message.MethodReturnMessage(
                msg.serial,
                body=[i_and_p],
                destination=msg.sender,
                signature='a{oa{sa{sv}}}',
            )

            self.conn.sendMessage(r)

            return

        i = None

        for x in o.getInterfaces():
            if msg.interface:
                if x.name == msg.interface:
                    i = x
                    break
            else:
                if msg.member in x.methods:
                    i = x
                    break

        m = None
        if i:
            m = i.methods.get(msg.member, None)

        if m is None:
            self._send_err(
                msg,
                'org.freedesktop.DBus.Error.UnknownMethod',
                (
                    'Method "%s" with signature "%s" on interface "%s" '
                    'doesn\'t exist'
                ) % (
                    msg.member, msg.signature or '',
                    msg.interface or '(null)',
                ),
            )

            return

        msig = msg.signature if msg.signature is not None else ''
        esig = m.sigIn if m.sigIn is not None else ''

        if esig != msig:
            self._send_err(
                msg,
                'org.freedesktop.DBus.Error.InvalidArgs',
                'Call to %s has wrong args (%s, expected %s)' %
                (msg.member, msg.signature or '', m.sigIn or '')
            )
            return

        d = defer.maybeDeferred(
            o.executeMethod,
            i,
            msg.member,
            msg.body,
            msg.sender,
        )

        if msg.expectReply:
            def send_reply(return_values):
                if isinstance(return_values, (list, tuple)):
                    if m.nret == 1:
                        return_values = [return_values]
                else:
                    return_values = [return_values]

                r = message.MethodReturnMessage(
                    msg.serial,
                    body=return_values,
                    destination=msg.sender,
                    signature=m.sigOut,
                )
                self.conn.sendMessage(r)

            def send_error(err):
                e = err.value
                errMsg = err.getErrorMessage()
                name = None

                if hasattr(e, 'dbusErrorName'):
                    name = e.dbusErrorName

                if name is None:
                    name = 'org.txdbus.PythonException.' + e.__class__.__name__

                try:
                    marshal.validateErrorName(name)
                except error.MarshallingError:
                    errMsg = ('!!(Invalid error name "%s")!! ' % name) + errMsg
                    name = 'org.txdbus.InvalidErrorName'

                r = message.ErrorMessage(name, msg.serial,
                                         body=[errMsg],
                                         signature='s',
                                         destination=msg.sender)
                self.conn.sendMessage(r)

            d.addCallback(send_reply)
            d.addErrback(send_error)
566351
function sendClientAlertMessage(ws, alert) {
  var msg = JSON.stringify({
    custom: {
      alert: alert
    }
  });
  ws.write(msg);
}
485580
function (name, data) {
            console.log("Custom handler for " + name);
            // Send information of the "deployment_info" event to an external service (here: Just an echo service)
            request("https://echo.getpostman.com/get?name=" + name + "&startTime=" + data.timestamp, function (error, response, body) {
                body = JSON.parse(body);
                if (!error && response.statusCode == 200) {
                    console.log("Here's the data we have just sent to the echo service:");
                    console.log("--------------------");
                    console.log(JSON.stringify(body.args)); // Show the sent data
                    console.log("--------------------");
                }
            });
        }
747493
def send_message(msg)
      ws.send(msg)
    rescue => exc
      warn exc
      abort exc
    end
1287527
function(msg) {
            var event = _getEvent.apply(this, arguments);

            var data = {event: event};

            // Add agent info if required
            if (_pageInfo !== 'never') {
                if (!_sentPageInfo || _pageInfo === 'per-entry') {
                    _sentPageInfo = true;
                    if (typeof event.screen === "undefined" &&
                        typeof event.browser === "undefined")
                      _rawLog(_agentInfo()).level('PAGE').send();
                }
            }

            if (_traceCode) {
                data.trace = _traceCode;
            }

            return {level: function(l) {
                // Don't log PAGE events to console
                // PAGE events are generated for the agentInfo function
                    if (_print && typeof console !== "undefined" && l !== 'PAGE') {
                      var serialized = null;
                      if (typeof XDomainRequest !== "undefined") {
                        // We're using IE8/9
                        serialized = data.trace + ' ' + data.event;
                      }
                      try {
                        console[l.toLowerCase()].call(console, (serialized || data));
                      } catch (ex) {
                        // IE compat fix
                        console.log((serialized || data));
                      }
                    }
                    data.level = l;

                    return {send: function() {
                        var cache = [];
                        var serialized = JSON.stringify(data, function(key, value) {

                              if (typeof value === "undefined") {
                                return "undefined";
                              } else if (typeof value === "object" && value !== null) {
                                if (_indexOf(cache, value) !== -1) {
                                  // We've seen this object before;
                                  // return a placeholder instead to prevent
                                  // cycles
                                  return "<?>";
                                }
                                cache.push(value);
                              }
                          return value;
                        });

                            if (_active) {
                                _backlog.push(serialized);
                            } else {
                                _apiCall(_token, serialized);
                            }
                        }};
                }};
        }
693661
function (ws, message) {
  let clientMessage;

  try {
    clientMessage = JSON.parse(message);
    /* jshint ignore:start */
    if (_.get(clientMessage, 'type') === 'message') {
      ws.send(JSON.stringify({
        ok: true,
        reply_to: _.get(clientMessage, 'id'),
        ts: Date.now(),
        message: _.get(clientMessage, 'text', message),
        type: _.get(clientMessage, 'type', 'message'),
        user: _.get(clientMessage, 'user', 'U1234567'),
        channel: _.get(clientMessage, 'channel', 'C1234567'),
      }));
    }
    /* jshint ignore:end */
  } catch (err) {
    logger.info('Invalid socket data ', message);
  }
}
664309
function handleMessage(event) {
  if (!event.data) {
    return;
  }

  switch (event.data) {
    case 'NETWORK_IDLE_ENQUIRY_RESULT_IDLE':
    case 'NETWORK_IDLE_CALLBACK':
      networkIdleCallback.__callbacks__.forEach(callback => {
        networkIdleCallback.__popCallback__(callback, false);
      });
      break;
  }
}
988243
def handle(self):
        
        _logger.info(
            "RemoteConsole client connected: [%s]:%d",
            self.client_address[0],
            self.client_address[1],
        )

        # Prepare the session
        session = beans.ShellSession(
            beans.IOHandler(self.rfile, self.wfile),
            {"remote_client_ip": self.client_address[0]},
        )

        # Print the banner
        def get_ps1():
            """
            Gets the prompt string from the session of the shell service

            :return: The prompt string
            """
            try:
                return session.get("PS1")
            except KeyError:
                return self._shell.get_ps1()

        self.send(self._shell.get_banner())
        self.send(get_ps1())

        try:
            while self._active.get_value():
                # Wait for data
                rlist = select([self.connection], [], [], .5)[0]
                if not rlist:
                    # Nothing to do (poll timed out)
                    continue

                data = self.rfile.readline()
                if not data:
                    # End of stream (client gone)
                    break

                # Strip the line
                line = data.strip()
                if not data:
                    # Empty line
                    continue

                # Execute it
                try:
                    self._shell.handle_line(line, session)
                except KeyboardInterrupt:
                    # Stop there on interruption
                    self.send("\nInterruption received.")
                    return
                except IOError as ex:
                    # I/O errors are fatal
                    _logger.exception(
                        "Error communicating with a client: %s", ex
                    )
                    break
                except Exception as ex:
                    # Other exceptions are not important
                    import traceback

                    self.send("\nError during last command: {0}\n".format(ex))
                    self.send(traceback.format_exc())

                # Print the prompt
                self.send(get_ps1())
        finally:
            _logger.info(
                "RemoteConsole client gone: [%s]:%d",
                self.client_address[0],
                self.client_address[1],
            )

            try:
                # Be polite
                self.send("\nSession closed. Good bye.\n")
                self.finish()
            except IOError as ex:
                _logger.warning("Error cleaning up connection: %s", ex)
347361
def handle_debug_break(self, call_id, payload):
        """"""
        line = payload['line']
        config = self.launcher.config  # TODO: make an attribute of client
        path = os.path.relpath(payload['file'], config['root-dir'])

        self.editor.raw_message(feedback['notify_break'].format(line, path))
        self.debug_thread_id = payload["threadId"]
1215594
protected synchronized void sendCommandToShard(VoidMessage message) {
        // if this node is shard - we just step over TCP/IP infrastructure
        // TODO: we want LocalTransport to be used in such cases
        if (nodeRole == NodeRole.SHARD) {
            message.setTargetId(shardIndex);
            messages.add(message);
            return;
        }


        //log.info("Sending CS: {}", message.getClass().getCanonicalName());

        message.setTargetId(targetIndex);
        DirectBuffer buffer = message.asUnsafeBuffer();

        long result = publicationForShards.offer(buffer);

        if (result < 0)
            for (int i = 0; i < 5 && result < 0; i++) {
                try {
                    // TODO: make this configurable
                    Thread.sleep(1000);
                } catch (Exception e) {
                }
                result = publicationForShards.offer(buffer);
            }

        // TODO: handle retransmit & backpressure separately

        if (result < 0)
            throw new RuntimeException("Unable to send message over the wire. Error code: " + result);
    }
145160
def on_message(self, handler, msg):
        
        if self.remote_debugging:
            #: Forward to other clients
            for h in self.handlers:
                if h != handler:
                    h.write_message(msg, True)
        else:
            print(msg)
676994
@Override
    public void handleMessage(@Sensitive Message message) throws Fault {

        //if no wsrinfo, we will not override the port address & client prop
        if (wsrInfo != null) {
            customizePortAddress(message);
            customizeClientProperties(message);
        }

        customizeClientSecurity(message);

    }
541369
def _post_job_handling_debug(self, job, successors):
        

        func = self.project.loader.find_symbol(job.addr)
        function_name = func.name if func is not None else None
        module_name = self.project.loader.find_object_containing(job.addr).provides

        l.debug("VFGJob @ %#08x with callstack [ %s ]", job.addr,
                job.callstack_repr(self.kb),
                )
        l.debug("(Function %s of %s)", function_name, module_name)
        l.debug("-  is call jump: %s", job.is_call_jump)
        for suc in successors:
            if suc not in job.dbg_exit_status:
                l.warning("- %s is not found. FIND OUT WHY.", suc)
                continue

            try:
                l.debug("-  successor: %#08x of %s [%s]", suc.solver.eval_one(suc.ip),
                        suc.history.jumpkind, job.dbg_exit_status[suc])
            except SimValueError:
                l.debug("-  target cannot be concretized. %s [%s]", job.dbg_exit_status[suc], suc.history.jumpkind)
        l.debug("Remaining/pending jobs: %d/%d", len(self._job_info_queue), len(self._pending_returns))
        l.debug("Remaining jobs: %s", [ "%s %d" % (ent.job, id(ent.job)) for ent in self._job_info_queue])
        l.debug("Task stack: %s", self._task_stack)
180327
async def handle_agent_job_started(self, agent_addr, message: AgentJobStarted):
        """"""
        self._logger.debug("Job %s %s started on agent %s", message.job_id[0], message.job_id[1], agent_addr)
        await ZMQUtils.send_with_addr(self._client_socket, message.job_id[0], BackendJobStarted(message.job_id[1]))
251567
function(resolve, reject) {
			var fn = _client.client.VimService.VimPort[name];
			fn(args, function(err, result, raw, soapHeader) {
				if (err) {
					
					// emit an error and handle the error
					_client.emit('method.error', err);
					_client.errorHandler(err, name, args, resolve, reject);
				}
				else {
					_client.retry = 0;
					
					// emit an event and resolve the output
					_client.emit('method.result', result);
					resolve(_.get(result, 'returnval'));
				}
			});
		}
1134389
function workerBoilerScript() {

	var postMessage = self.postMessage;
	var structuredCloningSupport = null;
	var toString = {}.toString;

	self.console = {};
	self.isWorker = true;

	// Provide basic console interface:
	['log', 'debug', 'error', 'info', 'warn', 'time', 'timeEnd'].forEach(function(meth) {
		self.console[meth] = function() {
			postMessage({
				cmd: 'console',
				method: meth,
				args: [].slice.call(arguments)
			});
		};
	});

	self.addEventListener('message', function(e) {

		var data = e.data;

		if (typeof data == 'string' && data.indexOf('EVAL|') === 0) {
			eval(data.substring(5));
			return;
		}

		if (structuredCloningSupport == null) {

			// e.data of ['PING'] (An array) indicates structuredCloning support
			// e.data of '"PING"' (A string) indicates no support (Array has been serialized)
			structuredCloningSupport = e.data[0] === 'PING';

			// Pingback to parent page:
			self.postMessage(
				structuredCloningSupport ?
					'pingback:structuredCloningSupport=YES' :
					'pingback:structuredCloningSupport=NO'
			);

			if (!structuredCloningSupport) {
				postMessage = function(msg) {
					// Marshal before sending
					return self.postMessage(JSON.stringify(msg));
				};
			}

			return;
		}

		if (!structuredCloningSupport) {
			// Demarshal:
			data = JSON.parse(data);
		}

		var defs = data.definitions;
		var isDeferred = false;
		var args = data.args;

		if (defs) {
			// Initial definitions:
			for (var i in defs) {
				self[i] = defs[i];
			}
			return;
		}

		function callback() {
			// Callback function to be passed to operative method
			returnResult({
				args: [].slice.call(arguments)
			});
		}

		callback.transfer = function() {
			var args = [].slice.call(arguments);
			var transfers = extractTransfers(args);
			// Callback function to be passed to operative method
			returnResult({
				args: args
			}, transfers);
		};

		args.push(callback);

		self.deferred = function() {
			isDeferred = true;
			var def = {};
			function resolve(r, transfers) {
				returnResult({
					isDeferred: true,
					action: 'resolve',
					args: [r]
				}, transfers);
				return def;
			}
			function reject(r, transfers) {
				if (r instanceof Error) {
					// Create an error object that can be cloned: (See #44/#45):
					var cloneableError = {
						message: r.message,
						stack: r.stack,
						name: r.name,
						code: r.code
					};
					for (var i in r) {
						if (r.hasOwnProperty(i)) {
							cloneableError[i] = r[i];
						}
					}
					postMessage({
						cmd: 'deferred_reject_error',
						token: data.token,
						error: cloneableError
					});
					return;
				}
				returnResult({
					isDeferred: true,
					action: 'reject',
					args: [r]
				}, transfers);
			}
			// Deprecated:
			def.fulfil = def.fulfill = def.resolve = function(value) {
				return resolve(value);
			};
			def.reject = function(value) {
				return reject(value);
			};
			def.transferResolve = function(value) {
				var transfers = extractTransfers(arguments);
				return resolve(value, transfers);
			};
			def.transferReject = function(value) {
				var transfers = extractTransfers(arguments);
				return reject(value, transfers);
			};
			return def;
		};

		// Call actual operative method:
		var result = self[data.method].apply(self, args);

		if (!isDeferred && result !== void 0) {
			// Deprecated direct-returning as of 0.2.0
			returnResult({
				args: [result]
			});
		}

		self.deferred = function() {
			throw new Error('Operative: deferred() called at odd time');
		};

		function returnResult(res, transfers) {
			postMessage({
				cmd: 'result',
				token: data.token,
				result: res
			}, self.hasTransferSupport && transfers || []);
		}

		function extractTransfers(args) {
			var transfers = args[args.length - 1];

			if (toString.call(transfers) !== '[object Array]') {
				throw new Error('Operative: callback.transfer() must be passed an Array of transfers as its last arguments');
			}

			return transfers;
		}
	});
}