404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@13.58.147.19: ~ $
3

�ft`;,�@s�ddlmZddlmZddlmZddlmZddlZddlZddlZddl	Z	ddl
mZddlZ
ddlZ
ejd�ZdZGd	d
�d
e
jj�Zddd
�ZGdd�de�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�Zdd�ZGdd�d�ZdS)�)�print_function)�absolute_import)�unicode_literals)�EnumN)�_�dnf�=c@seZdZdZdd�ZdS)�DnssecErrorz-
    Exception used in the dnssec module
    cCsdj|jdk	r|jnd�S)Nz<DnssecError, value='{}'>z
Not specified)�format�value)�self�r
�/usr/lib/python3.6/dnssec.py�__repr__-szDnssecError.__repr__N)�__name__�
__module__�__qualname__�__doc__rr
r
r
rr	)sr	�_openpgpkeycCs~|jd�}t|�dkr"d}t|��|d}|d}tj�}|j|jd��tj|j	�dd��j
d�j�}|d|d|S)	z�
    Implements RFC 7929, section 3
    https://tools.ietf.org/html/rfc7929#section-3
    :param email_address:
    :param tag:
    :return:
    �@�z0Email address must contain exactly one '@' sign.r�zutf-8��.)�split�lenr	�hashlibZsha256�update�encode�base64Z	b16encode�digest�decode�lower)Z
email_address�tagr�msgZlocalZdomain�hashr r
r
r�email2location2s	

r&c@s(eZdZdZdZdZdZdZdZdZ	dS)	�Validityz�
    Output of the verification algorithm.
    TODO: this type might be simplified in order to less reflect the underlying DNS layer.
    TODO: more specifically the variants from 3 to 5 should have more understandable names
    rr����	N)
rrrr�VALID�REVOKED�PROVEN_NONEXISTENCE�RESULT_NOT_SECURE�BOGUS_RESULT�ERRORr
r
r
rr'Jsr'c@seZdZdZdS)�NoKeyz�
    This class represents an absence of a key in the cache. It is an expression of non-existence
    using the Python's type system.
    N)rrrrr
r
r
rr2Xsr2c@s&eZdZdZddd�Zedd��ZdS)�KeyInfozv
    Wrapper class for email and associated verification key, where both are represented in
    form of a string.
    NcCs||_||_dS)N)�email�key)rr4r5r
r
r�__init__eszKeyInfo.__init__c	Cs�tjd|�}|dkrt�|jd�}|jd�jd�}d}d}x6tdt|��D]$}||dkr^|}||dkrJ|}qJWd	j||d
|d��j	d�}t
||�S)z�
        Since dnf uses different format of the key than the one used in DNS RR, I need to convert
        the former one into the new one.
        z	<(.*@.*)>Nr�ascii�
rz$-----BEGIN PGP PUBLIC KEY BLOCK-----z"-----END PGP PUBLIC KEY BLOCK-----�r)�re�searchr	�groupr!r�ranger�joinrr3)	ZuseridZraw_keyZinput_emailr4r5�start�stop�iZcat_keyr
r
r�from_rpm_key_objectis
 zKeyInfo.from_rpm_key_object)NN)rrrrr6�staticmethodrBr
r
r
rr3`s
r3c@s8eZdZdZiZedd��Zedd��Zedd��ZdS)	�DNSSECKeyVerificationz�
    The main class when it comes to verification itself. It wraps Unbound context and a cache with
    already obtained results.
    cCsZ||krtjd�tjS|tkr0tjd�tjStjdj|��tjdj|��tjSdS)zD
        Compare the key in case it was found in the cache.
        zCache hit, valid keyzCache hit, proven non-existencezKey in cache: {}zInput key   : {}N)�logger�debugr'r,r2r.r
r-)�	key_unionZinput_key_stringr
r
r�
_cache_hit�s

z DNSSECKeyVerification._cache_hitc	Cs�yddl}Wn<tk
rH}z tdj|��}tjj|��WYdd}~XnX|j�}|jdd�dkrlt	j
d�|jdd�dkr�t	j
d	�|j�dkr�t	j
d
�|jd�dkr�t	j
d�|j
t|j�t|j�\}}|dkr�t	j
d
�tjS|jr�t	j
d�tjS|j�st	j
d�tjS|j�r,t	j
d�tjS|j�sDt	j
d�tjS|jj�d}tj|�}||jk�rntj St	j
dj|��t	j
dj|j��tj!SdS)zz
        In case the key was not found in the cache, create an Unbound context and contact the DNS
        system
        rNzLConfiguration option 'gpgkey_dns_verification' requires python3-unbound ({})z
verbosity:�0z(Unbound context: Failed to set verbosityzqname-minimisation:�yesz1Unbound context: Failed to set qname minimisationz+Unbound context: Failed to read resolv.confz/var/lib/unbound/root.keyz0Unbound context: Failed to add trust anchor filez%Communication with DNS servers failedzDNSSEC signatures are wrongz!Result is not secured with DNSSECz1Non-existence of this record was proven by DNSSECz"Unknown error in DNS communicationzKey from DNS: {}zInput key   : {})"�unbound�ImportErrorrr
r�
exceptions�ErrorZub_ctxZ
set_optionrErFZ
resolvconfZadd_ta_fileZresolver&r4�RR_TYPE_OPENPGPKEYZRR_CLASS_INr'r1Zbogusr0Zsecurer/Znxdomainr.Zhavedata�dataZas_raw_datarZ	b64encoder5r,r-)	�	input_keyrK�er$ZctxZstatus�resultrPZdns_data_b64r
r
r�_cache_miss�sN









z!DNSSECKeyVerification._cache_misscCsztjdj|j��tjj|j�}|dk	r6tj||j�Stj	|�}|t
jkrZ|jtj|j<n|t
jkrrt
�tj|j<|SdS)zI
        Public API. Use this method to verify a KeyInfo object.
        z(Running verification for key with id: {}N)rErFr
r4rD�_cache�getrHr5rTr'r,r.r2)rQrGrSr
r
r�verify�s


zDNSSECKeyVerification.verifyN)	rrrrrUrCrHrTrWr
r
r
rrD�s
9rDcCs8td�|jd}|tjkr(|td�S|td�SdS)zE
    Inform the user about key validity in a human readable way.
    zDNSSEC extension: Key for user � z	is valid.zhas unknown status.N)rr4r'r,)Zki�v�prefixr
r
r�
nice_user_msg�s
r[cCstd�|S)z;
    Label any given message with DNSSEC extension tag
    zDNSSEC extension: )r)�mr
r
r�any_msg�sr]c@s(eZdZdZedd��Zedd��ZdS)�RpmImportedKeysaQ
    Wrapper around keys, that are imported in the RPM database.

    The keys are stored in packages with name gpg-pubkey, where the version and
    release is different for each of them. The key content itself is stored as
    an ASCII armored string in the package description, so it needs to be parsed
    before it can be used.
    c	Cs�tjjj�}|jdd�}g}xl|D]d}tjj|d�}tjd|�jd�}tjj|d�}|j	d�dd�}d	j
|�}|t||jd
��g7}q"W|S)N�namez
gpg-pubkey�packagerz	<(.*@.*)>r�descriptionr8r(r9r7���)
rZrpmZtransactionZTransactionWrapperZdbMatchZ	getheaderr:r;r<rr>r3r)	Ztransaction_setZpackagesZreturn_listZpkgr`r4raZ	key_linesZkey_strr
r
r�_query_db_for_gpg_keyss

z&RpmImportedKeys._query_db_for_gpg_keyscCstj�}tjttd���x�|D]�}ytj|�}Wn:tk
rl}ztj	dj
|j|j��w WYdd}~XnX|t
jkr�tjtdj
|j���q |t
jkr�tjtdj
|j���q |t
jkr�tjtdj
|j���q |t
jkr�tjtdj
|j���q tjtdj
|j���q WdS)Nz1Testing already imported keys for their validity.z%DNSSEC extension error (email={}): {}zGPG Key {} is validz,GPG Key {} does not support DNS verificationz�GPG Key {} could not be verified, because DNSSEC signatures are bogus. Possible causes: wrong configuration of the DNS server, MITM attackz=GPG Key {} has been revoked and should be removed immediatelyzGPG Key {} could not be tested)r^rcrE�infor]rrDrWr	Zwarningr
r4rr'r,rFr.r0r-)�keysr5rSrRr
r
r�check_imported_keys_validitys,







z,RpmImportedKeys.check_imported_keys_validityN)rrrrrCrcrfr
r
r
rr^�sr^)r)Z
__future__rrr�enumrrrZloggingr:Zdnf.i18nrZdnf.rpmrZdnf.exceptionsZ	getLoggerrErOrMrNr	r&r'r2r3rDr[r]r^r
r
r
r�<module>s*
	
#g

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 518 B 0644
__init__.cpython-36.pyc File 518 B 0644
base.cpython-36.opt-1.pyc File 77.46 KB 0644
base.cpython-36.pyc File 77.75 KB 0644
callback.cpython-36.opt-1.pyc File 3.55 KB 0644
callback.cpython-36.pyc File 3.55 KB 0644
comps.cpython-36.opt-1.pyc File 25.01 KB 0644
comps.cpython-36.pyc File 25.6 KB 0644
const.cpython-36.opt-1.pyc File 1.37 KB 0644
const.cpython-36.pyc File 1.37 KB 0644
crypto.cpython-36.opt-1.pyc File 6.45 KB 0644
crypto.cpython-36.pyc File 6.45 KB 0644
dnssec.cpython-36.opt-1.pyc File 8.67 KB 0644
dnssec.cpython-36.pyc File 8.67 KB 0644
drpm.cpython-36.opt-1.pyc File 5.16 KB 0644
drpm.cpython-36.pyc File 5.16 KB 0644
exceptions.cpython-36.opt-1.pyc File 6.82 KB 0644
exceptions.cpython-36.pyc File 6.82 KB 0644
goal.cpython-36.opt-1.pyc File 233 B 0644
goal.cpython-36.pyc File 233 B 0644
history.cpython-36.opt-1.pyc File 260 B 0644
history.cpython-36.pyc File 260 B 0644
i18n.cpython-36.opt-1.pyc File 9.38 KB 0644
i18n.cpython-36.pyc File 9.38 KB 0644
lock.cpython-36.opt-1.pyc File 4 KB 0644
lock.cpython-36.pyc File 4 KB 0644
logging.cpython-36.opt-1.pyc File 8.07 KB 0644
logging.cpython-36.pyc File 8.17 KB 0644
match_counter.cpython-36.opt-1.pyc File 3.99 KB 0644
match_counter.cpython-36.pyc File 3.99 KB 0644
package.cpython-36.opt-1.pyc File 9.79 KB 0644
package.cpython-36.pyc File 9.79 KB 0644
persistor.cpython-36.opt-1.pyc File 4.05 KB 0644
persistor.cpython-36.pyc File 4.05 KB 0644
plugin.cpython-36.opt-1.pyc File 8.78 KB 0644
plugin.cpython-36.pyc File 8.78 KB 0644
pycomp.cpython-36.opt-1.pyc File 2.9 KB 0644
pycomp.cpython-36.pyc File 2.9 KB 0644
query.cpython-36.opt-1.pyc File 913 B 0644
query.cpython-36.pyc File 913 B 0644
repo.cpython-36.opt-1.pyc File 21.68 KB 0644
repo.cpython-36.pyc File 21.68 KB 0644
repodict.cpython-36.opt-1.pyc File 5.44 KB 0644
repodict.cpython-36.pyc File 5.44 KB 0644
sack.cpython-36.opt-1.pyc File 2.19 KB 0644
sack.cpython-36.pyc File 2.19 KB 0644
selector.cpython-36.opt-1.pyc File 241 B 0644
selector.cpython-36.pyc File 241 B 0644
subject.cpython-36.opt-1.pyc File 276 B 0644
subject.cpython-36.pyc File 276 B 0644
transaction.cpython-36.opt-1.pyc File 1.6 KB 0644
transaction.cpython-36.pyc File 1.6 KB 0644
transaction_sr.cpython-36.opt-1.pyc File 17.09 KB 0644
transaction_sr.cpython-36.pyc File 17.09 KB 0644
util.cpython-36.opt-1.pyc File 18.86 KB 0644
util.cpython-36.pyc File 18.86 KB 0644