⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.32
Server IP:
15.204.235.159
Server:
Linux srv.techlup.co.ke 4.18.0-553.5.1.el8_10.x86_64 #1 SMP Wed Jun 5 09:12:13 EDT 2024 x86_64
Server Software:
Apache
PHP Version:
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
crypto-policies
/
python
/
__pycache__
/
View File Name :
build-crypto-policies.cpython-36.opt-1.pyc
3 ."�d� � @ sx d dl Z d dlZd dlZd dlZd dlZd dlZdZdd� Zdd� Zdd� Z dd d �Z dd� Zd d� Ze dkrte� dS )� Nzreload-cmds.shc O s t | dtji|�� d S )N�file)�print�sys�stderr)�args�kwargs� r �;./usr/share/crypto-policies/python/build-crypto-policies.py�eprint s r c C s� t jdd�} | jdddd� | jdddd� | jd td dd� | jd ddd� | jdddd� | jddd� | jddd� | j� S )zParse the command lineF)Zallow_abbrevz--flat� store_truez1put all the generated files in a single directory)�action�helpz--testz7compare the generated config file with the existing onez--policyZPOLICYz"generate the specified policy only)�type�metavarr z--reloadcmdszDalso save reload cmds into reload-cmds.sh script in output directoryz--strictzfail on warnings� policydirz5a directory with base policy definition files (*.pol))r � outputdirz.a target directory with generated config files)�argparse�ArgumentParser�add_argument�str� parse_args)�parserr r r r s r c C s< | j r tjj| jdj||��}n`tjj| j|�}tjj|�snytj|� W n" tk rl t dj|�� dS X tjj||d �}| j �r y@t|dd��}|j� }W d Q R X ||kr�t dj||�� dS dS t k r� Y n$ tk � r� t d j|�� dS X td j||�� t|dd��}|j|� W d Q R X t� dS )Nz {}-{}.txtz%Cannot create directory for policy {}Fz.txt�r)�modez9Config for {} for policy {} differs from the existing oneTzError reading generated file {}z"Saving config for {} for policy {}�w)Zflat�os�path�joinr �format�isdir�mkdir�OSErrorr Ztest�open�read�FileNotFoundErrorr �write)�cmdline�policy_nameZconfig_name�configr �dirpath�fZ old_configr r r �save_config- s8 r+ c C s( d}|d krg }yt j|f||�d| ji�}W n0 tk r^ } ztdt|� � dS d }~X nX dd� tt�D �}x�|D ]�}tj| }|� } | j |j | j��} |dks�| j| ��ry(dj |f|��}t| || j| �s�d }W n0 tk �r td | j � td� d}Y nX qxtd | j � d}qxW |S )Nr r zError: � c S s g | ]}d |kr|�qS )� Generatorr )�.0�gr r r � <listcomp>\ s z build_policy.<locals>.<listcomp>ZEMPTY�:� zError saving config for zKeeping original configuration� zError testing config for � )�cryptopoliciesZUnscopedCryptoPolicyr � ValueErrorr r �dir�policygenerators�__dict__Zgenerate_configZscopedZSCOPESZtest_configr r+ ZCONFIG_NAMEr! )r&