404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.216.61.96: ~ $
3

\�me�!�@s�ddlZddlZddlmZddlmZmZmZddlm	Z	ddl
mZddlm
Z
ddlmZeje�ZGdd	�d	e
j�ZdS)
�N)�Optional)�net�subp�util)�	bsd_utils)�
ResolvConf)�renderer)�NetworkStatec@s�eZdZdZdZdZdZdd�Zdd�Zdd	d
�Z	dd�Z
d
d�Zdd�Zd e
eedd�dd�Zdd�Zd!dd�Zd"dd�Zdd�Zdd�ZdS)#�BSDRendererzetc/resolv.confzetc/rc.conf�cCs"tj|j|j�}tj||d�dS)N)�fn)r�target_path�target�
rc_conf_fnr�get_rc_config_value)�self�keyr�r�/usr/lib/python3.6/bsd.pyrszBSDRenderer.get_rc_config_valuecCs$tj|j|j�}tj|||d�dS)N)r)rr
rrr�set_rc_config_value)rr�valuerrrrrszBSDRenderer.set_rc_config_valueNcCs,|si}d|_i|_i|_|jdd�|_dS)NZpostcmdsT)r�interface_configurations�interface_configurations_ipv6�get�	_postcmds)r�configrrr�__init__szBSDRenderer.__init__cCstj�}�x�|j�D�]�}|jd�}|jd�}|r@tjd|�r@q||krVtjd|�nd|r�|r�||}||kr�tjd||�y|j||�Wq�t	k
r�tj
d�|}Yq�Xn||}tjd|��x:|jdg�D�](}|jd	�d
k�rZ|jd��stjd|jd
��q�tjd||jd
�|jd��|jd
�|jd�|jd��pL|jd�d�|j|<q�|jd	�dk�r�|jd��s�tjd|jd
��q�tjd||jd
�|jd��|jd
�|jd�|jd��p�|jd�d�|j
|<q�|jd	�dk�s�|jd	�dkr�d|j|<q�WqWdS)N�nameZmac_addressz^lo\d+$z"Cannot find any device with MAC %sz,netif service will rename interface %s to %sz.Interface renaming is not supported on this OSzConfiguring interface %s�subnets�type�static�netmaskz+Skipping IP %s, because there is no netmask�addresszConfiguring dev %s with %s / %s�mtu)r"r!r#�static6�prefixz*Skipping IP %s, because there is no prefix)r"r%r#ZdhcpZdhcp4�DHCP)rZget_interfaces_by_mac�iter_interfacesr�re�match�LOG�info�rename_interface�NotImplementedError�error�debugrr)r�settingsZ
ifname_by_mac�	interface�device_nameZ
device_mac�cur_name�subnetrrr�_ifconfig_entries&sn

""zBSDRenderer._ifconfig_entriesc
Cs2t|j��}x�|j�D]�}|jdg�}x�|D]�}|jd�dkrr|jd�}|r�t|jd��dkr�|jdd|d��nD|jd�d	kr,|jd�}|r�t|jd
��dkr�|jdd
|d��nq,||jdg�7}q,WqWx^|D]V}|jd�}|s�tjd�q�|jd��r|jd�n|jd�}	|jd�}|j	||	|�q�WdS)Nrrr �gateway�.�z0.0.0.0)�networkr!r6r$�:�z::�0)r9r%r6�routesr9zSkipping a bad route entryr!r%)
�listZiter_routesr'r�len�split�appendr*r/�	set_route)
rr0r=r1rr4r6Zrouter9r!rrr�_route_entriesrs:







zBSDRenderer._route_entriesc	Csv|j}|j}xR|j�D]F}x@|jdg�D]0}d|krB|j|d�d|kr(|j|d�q(WqWy&ttjtj	|j
|j���}|j�Wn>t
k
r�tjtdtj	|j
|j��td�}|j�YnXxDt|�D]8}y|j|�Wq�tk
�rtjtd|�Yq�Xq�WxFt|�D]:}y|j|�Wn$tk
�rLtjtd|�YnX�qWtjtj	|j
|j�t|�d�dS)	Nr�dns_nameserversZ
dns_searchz&Failed to parse %s, use new empty filerzFailed to add nameserver %szFailed to add search domain %si�)rDZdns_searchdomainsr'r�extendrrZ	load_filerr
r�resolv_conf_fn�parse�IOErrorZlogexcr*�setZadd_nameserver�
ValueErrorZadd_search_domainZ
write_file�str)	rr0ZnameserversZ
searchdomainsr1r4Z
resolvconfZserverZdomainrrr�
_resolve_conf�sDzBSDRenderer._resolve_conf)�
network_state�	templates�returncCsH|r
||_|j|d�|j|d�|j|d�|j�|j|jd�dS)N)r0)�run)rr5rCrL�write_config�start_servicesr)rrMrNrrrr�render_network_state�sz BSDRenderer.render_network_statecCs|jj}dd�|�D�S)NcSsg|]\}}|dkr|�qS)r&r)�.0�k�vrrr�
<listcomp>�sz/BSDRenderer.dhcp_interfaces.<locals>.<listcomp>)r�items)rZicrrr�dhcp_interfaces�szBSDRenderer.dhcp_interfacesFcCs
t��dS)N)r-)rrPrrrrR�szBSDRenderer.start_servicescCs
t��dS)N)r-)rrrrrrQ�szBSDRenderer.write_configcCs
t��dS)N)r-)rr3r2rrrr,�szBSDRenderer.rename_interfacecCs
t��dS)N)r-)rr9r!r6rrrrB�szBSDRenderer.set_route)N)NN)F)N)�__name__�
__module__�__qualname__rFrZinterface_routesZroute_namesrrrr5rCrLr	r�dictrSrYrRrQr,rBrrrrr
s$
L*1



r
)Zloggingr(ZtypingrZ	cloudinitrrrZcloudinit.distrosrZ%cloudinit.distros.parsers.resolv_confrZ
cloudinit.netrZcloudinit.net.network_stater	Z	getLoggerrZr*ZRendererr
rrrr�<module>s


Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 33.43 KB 0644
__init__.cpython-36.pyc File 33.43 KB 0644
activators.cpython-36.opt-1.pyc File 9.52 KB 0644
activators.cpython-36.pyc File 9.52 KB 0644
bsd.cpython-36.opt-1.pyc File 5.74 KB 0644
bsd.cpython-36.pyc File 5.74 KB 0644
cmdline.cpython-36.opt-1.pyc File 7.2 KB 0644
cmdline.cpython-36.pyc File 7.2 KB 0644
dhcp.cpython-36.opt-1.pyc File 15.98 KB 0644
dhcp.cpython-36.pyc File 15.98 KB 0644
eni.cpython-36.opt-1.pyc File 12.89 KB 0644
eni.cpython-36.pyc File 12.89 KB 0644
ephemeral.cpython-36.opt-1.pyc File 10.51 KB 0644
ephemeral.cpython-36.pyc File 10.51 KB 0644
freebsd.cpython-36.opt-1.pyc File 2.54 KB 0644
freebsd.cpython-36.pyc File 2.54 KB 0644
netbsd.cpython-36.opt-1.pyc File 1.69 KB 0644
netbsd.cpython-36.pyc File 1.69 KB 0644
netplan.cpython-36.opt-1.pyc File 11.91 KB 0644
netplan.cpython-36.pyc File 11.91 KB 0644
network_manager.cpython-36.opt-1.pyc File 12.83 KB 0644
network_manager.cpython-36.pyc File 12.83 KB 0644
network_state.cpython-36.opt-1.pyc File 27.57 KB 0644
network_state.cpython-36.pyc File 27.57 KB 0644
networkd.cpython-36.opt-1.pyc File 8.21 KB 0644
networkd.cpython-36.pyc File 8.21 KB 0644
openbsd.cpython-36.opt-1.pyc File 2.18 KB 0644
openbsd.cpython-36.pyc File 2.18 KB 0644
renderer.cpython-36.opt-1.pyc File 1.82 KB 0644
renderer.cpython-36.pyc File 1.82 KB 0644
renderers.cpython-36.opt-1.pyc File 1.53 KB 0644
renderers.cpython-36.pyc File 1.53 KB 0644
sysconfig.cpython-36.opt-1.pyc File 23.07 KB 0644
sysconfig.cpython-36.pyc File 23.07 KB 0644
udev.cpython-36.opt-1.pyc File 1.22 KB 0644
udev.cpython-36.pyc File 1.31 KB 0644