OwlCyberSecurity - MANAGER
Edit File: run.cpython-36.pyc
3 � fxC������������������@���s���d�dl�Z�d�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dl Z d�dl Z d�dlmZ�d�dlm Z �d�dlmZ�d�dlmZ�d�dlmZ�d�dlmZ�d�dlmZ�d�dlZx"d8D�]Zee e��ejde�=�q�W�dZd9dd�Zd:dd�Zdadd��Zed��e j��Zefdd�Zdada da!d;dd�Z"dd��Z#d d!��Z$d"d#��Z%d$d%��Z&d&d'��Z'd(d)��Z(d*d+��Z)G�d,d-��d-ej*�Z+G�d.d/��d/e�j,�Z-G�d0d1��d1e-�Z.G�d2d3��d3e-�Z/G�d4d5��d5ej0�Z1G�d6d7��d7e2�Z3ed��dS�)<�����N)�autocomplete)�calltip)� debugger_r)� debugobj_r)�iomenu)�rpc)�stackviewer�simpledialog� messagebox�font�dialog� filedialog�commondialog�ttkztkinter.z 127.0.0.1c�������������C���sV���d}|d||f�7�}|dkr(t�j||�}|j��}|r@|d|�7�}|d|j|�f�7�}|S�)zFormat warnings the IDLE way.z! Warning (from warnings module): z File "%s", line %s Nz %s z%s: %s )� linecache�getline�strip�__name__)�message�category�filename�lineno�line�s��r����0/opt/alt/python36/lib64/python3.6/idlelib/run.py�idle_formatwarning���s����r���c���������� ���C���sB���|dkrt�j}y|jt|�||||���W�n�tk r<���Y�nX�dS�)zuShow Idle-format warning after replacing warnings.showwarning. The only difference is the formatter called. N)�sys�stderr�writer����OSError)r���r���r���r����filer���r���r���r����idle_showwarning_subproc,���s����r"���c�������������C���s0���|�rt�dkr,tja�tt_nt�dk r,t�t_da�dS�)zFReplace warning.showwarning with idle_showwarning_subproc, or reverse.N)�_warnings_showwarning�warnings�showwarningr"���)Zcapturer���r���r����capture_warnings<���s����r&���Tc�������������C���s���|�j�d��dS�)z�Process any tk events that are ready to be dispatched if tkinter has been imported, a tcl interpreter has been created and tk has been loaded.�updateN)�eval)�tclr���r���r����handle_tk_eventsL���s����r*���Fc�������������C���s���|�a�y$ttj�dkst�ttjd��}W�n���tdtjd��dS�td��dgtjdd�<�t j tdt|ffd�}d|_ |j����x2y�tr�y t���W�n�tk r����w�Y�nX�ytjjdd d �}W�n�tjk r����d}Y�nX�|�r |\}\}}}|||�}tjj||f��nt���W�q��tk �r4���t�r.daw�Y�q��tk �rR���td����Y�q����tj��\} } }yt���tjj|df��W�n&���tj| | |tjd��t���Y�nX�w�Y�q�X�q�W�dS�) af��Start the Python execution server in a subprocess In the Python subprocess, RPCServer is instantiated with handlerclass MyHandler, which inherits register/unregister methods from RPCHandler via the mix-in class SocketIO. When the RPCServer 'server' is instantiated, the TCPServer initialization creates an instance of run.MyHandler and calls its handle() method. handle() instantiates a run.Executive object, passing it a reference to the MyHandler object. That reference is saved as attribute rpchandler of the Executive instance. The Executive methods have access to the reference and can pass it on to entities that they command (e.g. debugger_r.Debugger.start_debugger()). The latter, in turn, can call MyHandler(SocketIO) register/unregister methods via the reference to register and unregister themselves. ����z/IDLE Subprocess: no IP port passed in sys.argv.)r!���NT��Z SockThread)�target�name�argsg�������?)�blockZtimeoutF���)�no_exitfunc�lenr����argv�AssertionError�int�print� __stderr__r&���� threadingZThread� manage_socket� LOCALHOSTZdaemon�start�exit_now�exit�KeyboardInterruptr���Z request_queue�get�queueZEmptyZresponse_queueZputr*����quitting� SystemExit�exc_info�print_exception� traceback)Zdel_exitfuncZportZ sockthread�request�seq�methodr/����kwargsZret�type�value�tbr���r���r����mainZ���s^���� rN���c�������������C���s����x�t�d�D�]b}tj|��yt|�t�}P�W�q �tk rj�}�z&td|jd��d�tj d��|}W�Y�d�d�}~X�q X�q W�tdtj d��t ||���dad�S�|j���d�S�)N����zIDLE Subprocess: OSError: r+���z, retrying....)r!���z8IDLE Subprocess: Connection to IDLE GUI failed, exiting.T) �range�time�sleep�MyRPCServer� MyHandlerr ���r7���r/���r���r8����show_socket_errorr=���Zhandle_request)�address�iZserver�errZsocket_errorr���r���r���r:�������s���� r:���c���������� ���C���sp���ddl�}ddlm}�|j��}t|��|j���d|d���d|d���d|�j��d|�j��d � }|d ||d��|j���dS�)z(Display socket error from manage_socket.r���N)� showerrorz#IDLE's subprocess can't connect to �:r+���z. Fatal OSError #z: zz. See the 'Startup failure' section of the IDLE doc, online at https://docs.python.org/3/library/idle.html#startup-failurezIDLE Subprocess Error)�parent) �tkinterZtkinter.messageboxrY���ZTk�fix_scalingZwithdraw�errno�strerrorZdestroy)rX���rV���r\���rY����root�msgr���r���r���rU�������s����*rU���c�����������������sd���dd�l�}�|�j���t���tj��tj���\}}}}|\t_t_t_t �������fdd���|||��d�S�)Nr���c������� ���������s�����j�t|���|j}|j}|d�k rNt|��krN�t|�||j��td��d��n:|d�k r�|j�r�t|��kr��t|�||j��td��d��|r�tj |�}td��d��d }t ||��tj|��d��tj|�|�}x|D�]}t|d��d��q�W�d�S�)NzF The above exception was the direct cause of the following exception: )r!���zE During handling of the above exception, another exception occurred: z"Traceback (most recent call last):�run.py�rpc.py�threading.py�queue.py� debugger_r.py�bdb.pyr,���)�endr!���)rb���rc���rd���re���rf���rg���) �add�id�__context__� __cause__rK���� __traceback__r7����__suppress_context__rF���� extract_tb�cleanup_traceback� print_list�format_exception_only) �typ�excrM����context�causeZtbe�exclude�linesr���)�efile� print_exc�seenr���r���rz�������s.���� � z"print_exception.<locals>.print_exc) r���� checkcache�flush_stdoutr���r���rD���� last_type� last_value�last_traceback�set)r���rs����valrM���Zexcinfor���)ry���rz���r{���r���rE�������s����rE���c������� ������C���s��|�dd��}x2|�r>x"|D�]}|�d�d�j�|�rP�qW�P�|�d=�qW�x2|�rrx"|D�]}|�d�d�j�|�rLP�qLW�P�|�d =�qBW�t|��dkr�|dd��|�dd�<�tdtjd��tjd�j}xftt|���D�]V}|�|�\}}}} |dkr�d}| �o�|j d ��r|j d d||fi��} |||| f|�|<�q�W�dS�)zARemove excluded traces from beginning/end of tb; get cached linesNr���r+���z** IDLE Internal Exception: )r!����exec�?z -toplevel-z <pyshell#r���r���r1���r1���)�countr3���r7���r���r���r���Zobjecttable� rpchandlerrP���� startswithZ remotecall) rM���rw���Zorig_tbZrpcfiler����rW����fn�lnZnmr���r���r���r���rp�������s2���� rp���c���������������C���s���dS�)zXXX How to do this now?Nr���r���r���r���r���r}�����s����r}���c��������������C���s*���t�rddl}�|�j���td��tjd��dS�)z�Exit subprocess, possibly after first clearing exit functions. If config-main.cfg/.def 'General' 'delete-exitfunc' is True, then any functions registered with atexit will be removed before exiting. (VPython support) r���NF)r2����atexitZ_clearr&���r���r>���)r����r���r���r���r>�����s ����r>���c�������������C���sr���ddl�}t|�jjdd��}|dkrnxJ|jj|��D�]:}|jj|�|dd�}t|d��}|dk�r0td |��|d<�q0W�dS�)zScale fonts on HiDPI displays.r���N�tk�scalinggffffff�?T)r`���r.����exists�sizeg�������?g�������) Ztkinter.font�floatr����Zcallr����namesZFontr6����round)r`���r\���r����r.���r���r����r���r���r���r]�����s����r]���c���������������@���s���e�Zd�Zdd��ZdS�)rS���c�������������C���s����y��W�n��t�k r�����Y�n��tk r:���datj���Y�n����tj}tddd��|d��td|d��tdtj ��j �|d��td||d��td t|�|d��tj |d��td |d��tdd�|d��datj���Y�nX�dS�)zrOverride RPCServer method for IDLE Interrupt the MainThread and exit server if link is dropped. T� �-�(���)r!���zUnhandled server exception!z Thread: %szClient Address: z Request: z# *** Unrecoverable, server exiting!N)rC����EOFErrorr=����thread�interrupt_mainr���r8���r7���r9���Zcurrent_threadr.����reprrF���rz���rB���)�selfrG���Zclient_addressZerfr���r���r����handle_error+��s&����zMyRPCServer.handle_errorN)r���� __module__�__qualname__r����r���r���r���r���rS���)��s���rS���c���������������@���s6���e�Zd�Zd dd�Zedd���Zedd���Zdd ��ZdS�)� PseudoFileNc�������������C���s���||�_�||�_||�_d�S�)N)�shell�tags� _encoding)r����r����r�����encodingr���r���r����__init__L��s����zPseudoFile.__init__c�������������C���s���|�j�S�)N)r����)r����r���r���r���r����Q��s����zPseudoFile.encodingc�������������C���s ���d|�j��S�)Nz<%s>)r����)r����r���r���r���r.���U��s����zPseudoFile.namec�������������C���s���dS�)NTr���)r����r���r���r����isattyY��s����zPseudoFile.isatty)N)r���r����r����r�����propertyr����r.���r����r���r���r���r���r����J��s��� r����c���������������@���s���e�Zd�Zdd��Zdd��ZdS�)�PseudoOutputFilec�������������C���s���dS�)NTr���)r����r���r���r����writable_��s����zPseudoOutputFile.writablec�������������C���sP���|�j�rtd��t|�tk r@t|t�s6tdt|�j���tj|�}|�jj ||�j �S�)Nzwrite to closed filezmust be str, not )�closed� ValueErrorrK����str� isinstance� TypeErrorr����__str__r����r���r����)r����r���r���r���r���r���b��s���� zPseudoOutputFile.writeN)r���r����r����r����r���r���r���r���r���r����]��s���r����c���������������@���s:���e�Zd�Zd dd�Zdd��Zddd�Zdd d �Zdd��ZdS�)�PseudoInputFileNc�������������C���s���t�j|�|||��d|�_d�S�)Nr,���)r����r�����_line_buffer)r����r����r����r����r���r���r���r����o��s����zPseudoInputFile.__init__c�������������C���s���dS�)NTr���)r����r���r���r����readables��s����zPseudoInputFile.readabler+���c�������������C���s����|�j�rtd��|d�krd}nt|t�s8tdt|�j���|�j}d|�_|dk�rlxb|�jj ��}|s^P�||7�}qNW�nDx(t |�|k�r�|�jj ��}|s�P�||7�}qnW�||d���|�_|d�|��}|S�)Nzread from closed filer+���zmust be int, not r,���r���r1���)r����r����r����r6���r����rK���r���r����r�����readliner3���)r����r�����resultr���r���r���r����readv��s,���� � �zPseudoInputFile.readc�������������C���s����|�j�rtd��|d�krd}nt|t�s8tdt|�j���|�jpF|�jj ��}|dk�rXt |�}|jdd|�}|dkrv|d�}||d���|�_|d�|��S�)Nzread from closed filer+���zmust be int, not r���r����r1���)r����r����r����r6���r����rK���r���r����r����r����r3����find)r����r����r���Zeolr���r���r���r�������s���� zPseudoInputFile.readlinec�������������C���s���|�j�j���d�S�)N)r�����close)r����r���r���r���r�������s����zPseudoInputFile.close)Nr1���)r1���r1���)r1���)r���r����r����r����r����r����r����r����r���r���r���r���r����m��s ��� r����c���������������@���s,���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd S�) rT���c�������������C���s����t�|��}|�jd|��|�jd�|�_t|�jdtj�t_t |�jdtj�t_ t |�jdtj�t_tj t_ ddl}|j|_tj|�_|�jd�|�_tjj|�dd d ��dS�)zOverride base methodr�����console�stdin�stdoutr���r���N�interpg�������?)Zmyseq�wait)� Executive�register�get_remote_proxyr����r����r���r����r���r����r����r����r���r����displayhook�pydocZ plainpagerZpagerZ_keep_stdinr����� RPCHandlerZgetresponse)r����Z executiver����r���r���r����handle���s���� zMyHandler.handlec�������������C���s���t�jd��dS�)z>override SocketIO method - wait for MainThread to shut us down� ���N)rQ���rR���)r����r���r���r����exithook���s����zMyHandler.exithookc�������������C���s���da�tj���dS�)zEOverride SocketIO method - terminate wait on callback and exit threadTN)rB���r����r����)r����r���r���r����EOFhook���s����zMyHandler.EOFhookc�������������C���s���da�tj���dS�)zinterrupt awakened threadTN)rB���r����r����)r����r���r���r����decode_interrupthook���s����zMyHandler.decode_interrupthookN)r���r����r����r����r����r����r����r���r���r���r���rT������s���rT���c���������������@���sN���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd d ��Zdd��Zd d��Z ddd�Z dS�)r����c�������������C���s&���||�_�tj|�_tj��|�_tj��|�_d�S�)N)r�����__main__�__dict__�localsr���ZCalltipr���ZAutoComplete)r����r����r���r���r���r�������s���� zExecutive.__init__c�������������C���s����y&d�|�_�dazt||�j��W�d�daX�W�nV�tk r:���Y�nJ���tj��|�_�trTt���t ���|�j jjd�}|rx|�j j j���Y�nX�t���d�S�)NTFz<<toggle-jit-stack-viewer>>)�usr_exc_info� interruptabler����r����rC���r���rD���rB���r>���rE���r����r����Zgetvarr����Zopen_remote_stack_viewerr}���)r�����codeZjitr���r���r����runcode���s"���� zExecutive.runcodec�������������C���s���t�rtj���d�S�)N)r����r����r����)r����r���r���r����interrupt_the_server���s����zExecutive.interrupt_the_serverc�������������C���s���t�j|�j|�S�)N)r���Zstart_debuggerr����)r����Zgui_adap_oidr���r���r����start_the_debugger���s����zExecutive.start_the_debuggerc�������������C���s���|�j�j|��dS�)zDUnregister the Idb Adapter. Link objects and Idb then subject to GCN)r����Z unregister)r����Zidb_adap_oidr���r���r����stop_the_debugger���s����zExecutive.stop_the_debuggerc�������������C���s���|�j�j|�S�)N)r���Z fetch_tip)r����r.���r���r���r����get_the_calltip���s����zExecutive.get_the_calltipc�������������C���s���|�j�j||�S�)N)r���Zfetch_completions)r����Zwhat�moder���r���r����get_the_completion_list���s����z!Executive.get_the_completion_listNc�������������C���sr���|�j�r|�j�\}}}nd�S�d�}|d�k r0|�jj|�}x|rN|jjd�dkrN|j}q2W�|t_|t_t j ||�}tj|�S�)Nr���r����run)r���r����) r����r����r�����tb_frame� f_globals�tb_nextr���r~���r���r���Z StackTreeItemr���Zremote_object_tree_item)r����Z flist_oidrs���r����rM���Zflist�itemr���r���r���r������s���� zExecutive.stackviewer)N)r���r����r����r����r����r����r����r����r����r����r���r���r���r���r���r�������s���r����)r ���r ���r���r���r ���r���r���)N)NN)F)4�ior���rA���r���rQ���rF����_threadr����r9���r$���r\���Zidlelibr���r���r���r���r���r���r���r�����mod�delattr�modulesr;���r���r"���r#���r&���ZTclr)���r*���r=���rB���r����rN���r:���rU���rE���rp���r}���r>���r]���Z RPCServerrS���� TextIOBaser����r����r����r����rT����objectr����r���r���r���r����<module>���s`���� M$!4+A