Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/netmiko/fortinet/__pycache__/fortinet_ssh.cpython-39.pyc
Ðазад
a v�h� � @ s8 d dl Z d dlZd dlZd dlmZ G dd� de�ZdS )� N)�CiscoSSHConnectionc s\ e Zd Zdd� Zdd� Zddd�Zdd � Zd� fdd� Zddd�Zddd�Z dd� Z � ZS )�FortinetSSHc C s dt j_dS )z5Modify connection parameters prior to SSH connection.)zdiffie-hellman-group14-sha1z"diffie-hellman-group-exchange-sha1z$diffie-hellman-group-exchange-sha256zdiffie-hellman-group1-sha1N)�paramiko� TransportZ_preferred_kex��self� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/netmiko/fortinet/fortinet_ssh.py�_modify_connection_params s z%FortinetSSH._modify_connection_paramsc C s� | j dd�}d}d}|dkrV|| �� 7 }d|v r>| �d� qVnt�d| � |d7 }q| �� | jd d � | �� t�d| j � | � � dS ) z>Prepare the session after the connection has been established.r ��delay_factor� � � z to acceptza g��Q��?�$)Zalt_prompt_terminatorg333333�?N) Zselect_delay_factorZread_channelZ write_channel�time�sleepZ_test_channel_readZset_base_prompt�disable_pagingZglobal_delay_factorZclear_buffer)r r �output�countr r r �session_preparation s zFortinetSSH.session_preparationr c s� d}� � |�}d� _d� _d� _t�d|�rjd� _d}� j |dd�}d |v rjd� _� j�� � jd dd� d }� jr�� � � g d�}� jr�|� d� � fdd�|D �}� j�|�}|| S )zDDisable paging is only available with specific roles so it may fail.z get system status | grep VirtualTF�morez/Virtual domain configuration: (multiple|enable)� config global� r zCommand fail�d i� )�width�heightr )�config system consolezset output standard�endr c s g | ]}� j |d d��qS )r r )�send_command_timing)�.0�commandr r r � <listcomp>E s �z.FortinetSSH.disable_paging.<locals>.<listcomp>) r �allow_disable_global�vdoms�_output_mode�re�searchZremote_conn�closeZestablish_connection�_retrieve_output_mode�appendZRETURN�join) r r �kwargsZ check_commandr Zvdom_additional_commandZ new_outputZdisable_paging_commandsZ outputlistr r r r ) s0 �zFortinetSSH.disable_pagingc C sB t �d�}| �d�}|�|�}|r>|�d��� }|dv r>|| _dS )zOSave the state of the output mode so it can be reset at the end of the session.zoutput\s+:\s+(?P<mode>.*)\s+\nzget system console�mode)r �standardN)r&