uawdijnntqw1x1x1
IP : 3.145.170.164
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
jackpotjunglegam
/
..
/
..
/
lib64
/
libnfsidmap
/
..
/
tcl8.6
/
..
/
mysql
/
..
/
python2.7
/
rexec.pyc
/
/
� zfc@s#dZddlmZeddd�[ddlZddlZddlZddlZddlZdgZdfd ��YZ d e fd��YZ dZd e fd��YZdej fd��YZejZejZdejfd��YZd�Zedkreje��ndS(s9Restricted execution facilities. The class RExec exports methods r_exec(), r_eval(), r_execfile(), and r_import(), which correspond roughly to the built-in operations exec, eval(), execfile() and import, but executing the code in an environment that only exposes those built-in operations that are deemed safe. To this end, a modest collection of 'fake' modules is created which mimics the standard modules by the same names. It is a policy decision which built-in modules and operations are made available; this module provides a reasonable default, but derived classes can change the policies e.g. by overriding or extending class variables like ok_builtin_modules or methods like make_sys(). XXX To do: - r_open should allow writing tmp dir - r_exec etc. with explicit globals/locals? (Use rexec("exec ... in ...")?) i����(twarnpy3ks/the rexec module has been removed in Python 3.0t stackleveliNtRExectFileBasecBseZdZRS( tfilenotflushtisattytreadtreadlinet readlinestseekttelltwritet writelinest xreadlinest__iter__(RRRRRR R RRR RR(t__name__t __module__tok_file_methods(((s/usr/lib64/python2.7/rexec.pyR stFileWrappercBseZd�Zd�ZRS(cCsSxL|jD]A}t||�r t||�r t||t||��q q WdS(N(Rthasattrtsetattrtgetattr(tselftftm((s/usr/lib64/python2.7/rexec.pyt__init__+scCs|j�dS(N(R(R((s/usr/lib64/python2.7/rexec.pytclose0s(RRRR(((s/usr/lib64/python2.7/rexec.pyR's sL def %s(self, *args): return getattr(self.mod, self.name).%s(*args) tFileDelegatecBs;eZd�Zx'ejdD]ZeeefdUqWRS(cCs||_||_dS(N(tmodtname(RRR((s/usr/lib64/python2.7/rexec.pyR;s RN(R(RRRRRRtTEMPLATE(((s/usr/lib64/python2.7/rexec.pyR9s tRHookscBs}eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z d �Zd �Zd�Z d�ZRS( cGs�d}d}|rEt|d�td�krE|d}|d }n|rut|dd�ru|d}|d}n|r�td�ntjj||�||_dS(Nii����t __class__istoo many arguments(tNonettypeRt TypeErrortihookstHooksRtrexec(RtargstverboseR'((s/usr/lib64/python2.7/rexec.pyREs" cCs ||_dS(N(R'(RR'((s/usr/lib64/python2.7/rexec.pyt set_rexecVscCs |jj�S(N(R'tget_suffixes(R((s/usr/lib64/python2.7/rexec.pyR+ZscCs|jj|�S(N(R't is_builtin(RR((s/usr/lib64/python2.7/rexec.pyR,]scCst|�}|jj|d�S(N((t __import__R'tcopy_except(RRR((s/usr/lib64/python2.7/rexec.pytinit_builtin`scCs td�dS(Nsdon't use this(tSystemError(RR((s/usr/lib64/python2.7/rexec.pytinit_frozendtcGs td�dS(Nsdon't use this(R0(RR(((s/usr/lib64/python2.7/rexec.pytload_sourceeR2cGs td�dS(Nsdon't use this(R0(RR(((s/usr/lib64/python2.7/rexec.pyt load_compiledfR2cGs td�dS(Nsdon't use this(R0(RR(((s/usr/lib64/python2.7/rexec.pytload_packagegR2cCs|jj|||�S(N(R'tload_dynamic(RRtfilenametfile((s/usr/lib64/python2.7/rexec.pyR6iscCs|jj|�S(N(R't add_module(RR((s/usr/lib64/python2.7/rexec.pyR9lscCs |jjS(N(R'tmodules(R((s/usr/lib64/python2.7/rexec.pytmodules_dictoscCs|jjdjS(Ntsys(R'R:tpath(R((s/usr/lib64/python2.7/rexec.pytdefault_pathrs(RRRR*R+R,R/R1R3R4R5R6R9R;R>(((s/usr/lib64/python2.7/rexec.pyR Cs cBs�eZdZeej�ZdXZdYZdZZ d[Z ejej fZd\d3d4�Zd5�Zd6�Zd7�Zd8�Zd9�Zd:�Zd;�Zd<�Zd=�Zd>�Zd?�Zd@�ZdA�ZdB�ZdC�ZdD�Z iigdE�Z!dF�Z"dG�Z#dH�Z$dI�Z%dJ�Z&dK�Z'dL�Z(d]idM�Z)dN�Z*dO�Z+dP�Z,dQ�Z-dR�Z.dS�Z/dTdUdV�Z0dW�Z1RS(^s�Basic restricted execution framework. Code executed in this restricted environment will only have access to modules and functions that are deemed safe; you can subclass RExec to add or remove capabilities as desired. The RExec class can prevent code from performing unsafe operations like reading or writing disk files, or using TCP/IP sockets. However, it does not protect against code using extremely large amounts of memory or processor time. taudiooptarraytbinasciitcmathterrnotimageoptmarshaltmathtmd5toperatortparsertselecttshat_sretstroptstructttimet_weakrefterrortfstattlistdirtlstattreadlinktstatttimestunametgetpidtgetppidtgetcwdtgetuidtgetgidtgeteuidtgetegidt byteordert copyrighttexittgetdefaultencodingtgetrefcountt hexversiontmaxintt maxunicodetplatformtps1tps2tversiontversion_infotopenR8treloadR-icCs�td�tjj||�|p+t|�|_|jj|�i|_|j|_ g}x0|jD]%}|t jkrf|j|�qfqfWt |�|_|j�|j�|j�|j�t|j|�|_t|j|�|_dS(s�Returns an instance of the RExec class. The hooks parameter is an instance of the RHooks class or a subclass of it. If it is omitted or None, the default RHooks class is instantiated. Whenever the RExec module searches for a module (even a built-in one) or reads a module's code, it doesn't actually go out to the file system itself. Rather, it calls methods of an RHooks instance that was passed to or created by its constructor. (Actually, the RExec object doesn't make these calls --- they are made by a module loader object that's part of the RExec object. This allows another level of flexibility, which can be useful when changing the mechanics of import within the restricted environment.) By providing an alternate RHooks object, we can control the file system accesses made to import a module, without changing the actual algorithm that controls the order in which those accesses are made. For instance, we could substitute an RHooks object that passes all filesystem requests to a file server elsewhere, via some RPC mechanism such as ILU. Grail's applet loader uses this to support importing applets from a URL for a directory. If the verbose parameter is true, additional debugging output may be sent to standard output. s/This code is not secure in Python 2.2 and laterN(tRuntimeErrorR%t_VerboseRR thooksR*R:tok_builtin_modulestok_dynamic_modulesR<tbuiltin_module_namestappendttupletset_trusted_pathtmake_builtintmake_initial_modulestmake_syst RModuleLoadertloadertRModuleImportertimporter(RRqR)tlisttmname((s/usr/lib64/python2.7/rexec.pyR�s" cCsttjjtj�|_dS(N(tfiltertosR=tisabsR<ttrusted_path(R((s/usr/lib64/python2.7/rexec.pyRw�scCsi||jkrtd|�n|tjkr>tj|}ntj|||�}|j|g�}|S(Nsuntrusted dynamic module: %s(RstImportErrorR<R:timpR6R.(RRR7R8tsrctdst((s/usr/lib64/python2.7/rexec.pyR6�scCs|j�|j�dS(N(t make_maintmake_osname(R((s/usr/lib64/python2.7/rexec.pyRy�s cCs0gtj�D]}|d|jkr |^q S(Ni(R�R+t ok_file_types(Rtitem((s/usr/lib64/python2.7/rexec.pyR+�scCs ||jkS(N(Rr(RR�((s/usr/lib64/python2.7/rexec.pyR,�scCsD|jt|j�}|j|_|j|_|j|_|_ dS(N( R.t__builtin__tnok_builtin_namestr_importR-tr_reloadRntr_openRmR8(RR((s/usr/lib64/python2.7/rexec.pyRx�scCs|jd�dS(Nt__main__(R9(R((s/usr/lib64/python2.7/rexec.pyR��scCsetj}t|�}|j||j�}i|_}x'tjj�D]\}}|||<qGWdS(N(R�RR-t copy_onlytok_posix_namestenvirontitems(RtosnameR�R�tetkeytvalue((s/usr/lib64/python2.7/rexec.pyR��s cCs�|jt|j�}|j|_dg|_td|j�|_|j |_ |jd}|jj�t|j �}|j�t|�|_dS(Nt RESTRICTEDR<(R�R<tok_sys_namesR:targvtmapR"tok_pathR=t r_exc_infotexc_infotkeysRRrtsortRvRt(RRtl((s/usr/lib64/python2.7/rexec.pyRzs cCsy|j|�}x-t|�D]}t||t||��qWx3|D]+}yt||�WqFtk rpqFXqFW|S(N(t copy_nonetdirRRtdelattrtAttributeError(RR�t exceptionsR�R((s/usr/lib64/python2.7/rexec.pyR.s cCs^|j|�}xH|D]@}yt||�}Wntk rEqnXt|||�qW|S(N(R�RR�R(RR�tnamesR�RR�((s/usr/lib64/python2.7/rexec.pyR�s cCs"|j|j�}|j|_|S(N(R9Rt__doc__(RR�R((s/usr/lib64/python2.7/rexec.pyR�#scCsR|jj|�}|dkr>|jj|�|j|<}n|jd|_|S(NR�(R:tgetR"Rqt new_modulet__builtins__(RR�R((s/usr/lib64/python2.7/rexec.pyR9*s cBs|jd�}||jUdS(sExecute code within a restricted environment. The code parameter must either be a string containing one or more lines of Python code, or a compiled code object, which will be executed in the restricted environment's __main__ module. R�N(R9t__dict__(RtcodeR((s/usr/lib64/python2.7/rexec.pytr_exec3scCs|jd�}t||j�S(sFEvaluate code within a restricted environment. The code parameter must either be a string containing a Python expression, or a compiled code object, which will be evaluated in the restricted environment's __main__ module. The value of the expression or code object will be returned. R�(R9tevalR�(RR�R((s/usr/lib64/python2.7/rexec.pytr_eval>s cCs#|jd�}t||j�dS(sfExecute the Python code in the file in the restricted environment's __main__ module. R�N(R9texecfileR�(RR8R((s/usr/lib64/python2.7/rexec.pyt r_execfileJscCs|jj||||�S(s=Import a module, raising an ImportError exception if the module is considered unsafe. This method is implicitly called by code executing in the restricted environment. Overriding this method in a subclass is used to change the policies enforced by a restricted environment. (R~t import_module(RR�tglobalstlocalstfromlist((s/usr/lib64/python2.7/rexec.pyR�Rs cCs|jj|�S(sReload the module object, re-parsing and re-initializing it. This method is implicitly called by code executing in the restricted environment. Overriding this method in a subclass is used to change the policies enforced by a restricted environment. (R~Rn(RR((s/usr/lib64/python2.7/rexec.pyR�]scCs|jj|�S(s@Unload the module. Removes it from the restricted environment's sys.modules dictionary. This method is implicitly called by code executing in the restricted environment. Overriding this method in a subclass is used to change the policies enforced by a restricted environment. (R~tunload(RR((s/usr/lib64/python2.7/rexec.pytr_unloadgs cCs}|jd}t|d�|_t|d�|_t|d�|_ttj�|_ttj �|_ ttj�|_dS(NR<tstdintstdouttstderr( R:Rtdelegate_stdintdelegate_stdouttdelegate_stderrRR<R�trestricted_stdinR�trestricted_stdoutR�trestricted_stderr(Rts((s/usr/lib64/python2.7/rexec.pytmake_delegate_filesus cCs�t|d�s|j�nt|d�s8|j�n|jd}|j|_|j|_|j|_ |j t_|jt_|j t_ dS(Nt save_stdinR�R<(Rt save_filesR�R:R�R�R�R�R�R�R�R<R�R�(RR�((s/usr/lib64/python2.7/rexec.pyt set_files~s cCs?|j�|jd}|j|_|j|_|j|_dS(NR<(t restore_filesR:R�R�R�R�R�R�(RR�((s/usr/lib64/python2.7/rexec.pytreset_files�s cCs(tj|_tj|_tj|_dS(N(R<R�R�R�tsave_stdoutR�tsave_stderr(R((s/usr/lib64/python2.7/rexec.pyR��scCs(|jt_|jt_|jt_dS(N(R�R<R�R�R�R�R�(R((s/usr/lib64/python2.7/rexec.pyR��scCs9|j�z|j�|||�}Wd|j�X|S(N(R�R�R�(RtfuncR(tkwtr((s/usr/lib64/python2.7/rexec.pyts_apply�s cGs|j|j|�S(s�Execute code within a restricted environment. Similar to the r_exec() method, but the code will be granted access to restricted versions of the standard I/O streams sys.stdin, sys.stderr, and sys.stdout. The code parameter must either be a string containing one or more lines of Python code, or a compiled code object, which will be executed in the restricted environment's __main__ module. (R�R�(RR(((s/usr/lib64/python2.7/rexec.pyts_exec�scGs|j|j|�S(s�Evaluate code within a restricted environment. Similar to the r_eval() method, but the code will be granted access to restricted versions of the standard I/O streams sys.stdin, sys.stderr, and sys.stdout. The code parameter must either be a string containing a Python expression, or a compiled code object, which will be evaluated in the restricted environment's __main__ module. The value of the expression or code object will be returned. (R�R�(RR(((s/usr/lib64/python2.7/rexec.pyts_eval�s cGs|j|j|�S(s!Execute the Python code in the file in the restricted environment's __main__ module. Similar to the r_execfile() method, but the code will be granted access to restricted versions of the standard I/O streams sys.stdin, sys.stderr, and sys.stdout. (R�R�(RR(((s/usr/lib64/python2.7/rexec.pyt s_execfile�s cGs|j|j|�S(s�Import a module, raising an ImportError exception if the module is considered unsafe. This method is implicitly called by code executing in the restricted environment. Overriding this method in a subclass is used to change the policies enforced by a restricted environment. Similar to the r_import() method, but has access to restricted versions of the standard I/O streams sys.stdin, sys.stderr, and sys.stdout. (R�R�(RR(((s/usr/lib64/python2.7/rexec.pyts_import�s cGs|j|j|�S(s�Reload the module object, re-parsing and re-initializing it. This method is implicitly called by code executing in the restricted environment. Overriding this method in a subclass is used to change the policies enforced by a restricted environment. Similar to the r_reload() method, but has access to restricted versions of the standard I/O streams sys.stdin, sys.stderr, and sys.stdout. (R�R�(RR(((s/usr/lib64/python2.7/rexec.pyts_reload�scGs|j|j|�S(s�Unload the module. Removes it from the restricted environment's sys.modules dictionary. This method is implicitly called by code executing in the restricted environment. Overriding this method in a subclass is used to change the policies enforced by a restricted environment. Similar to the r_unload() method, but has access to restricted versions of the standard I/O streams sys.stdin, sys.stderr, and sys.stdout. (R�R�(RR(((s/usr/lib64/python2.7/rexec.pyts_unload�sR�i����cCs4t|�}|dkr$td�nt|||�S(sGMethod called when open() is called in the restricted environment. The arguments are identical to those of the open() function, and a file object (or a class instance compatible with file objects) should be returned. RExec's default behaviour is allow opening any file for reading, but forbidding any attempt to write a file. This method is implicitly called by code executing in the restricted environment. Overriding this method in a subclass is used to change the policies enforced by a restricted environment. R�trbs/can't open files for writing in restricted mode(R�R�(tstrtIOErrorRm(RR8tmodetbuf((s/usr/lib64/python2.7/rexec.pyR��s cCs(tj�\}}}d}|||fS(N(R<R�R"(Rttytvattr((s/usr/lib64/python2.7/rexec.pyR�s(R?R@RARBRCRDRERFRGRHRIRJRKRLRMRNRORP(RQRRRSRTRURVRWRXRYRZR[R\R]R^R_( R`RaRbRcRdReRfRgRhRiRjRkRl(RmR8RnR-N((2RRR�RvR<R=R�RrR�R�R�R�tC_EXTENSIONt PY_SOURCER�R"RRwR6RyR+R,RxR�R�RzR.R�R�R9R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s/usr/lib64/python2.7/rexec.pyR{sd3 csddl}ddl}|jtjdd�\}}d}g}xI|D]A\}}|dkro|d}n|dkrJ|j|�qJqJWtd|��|r��jt|��_n|r|�jd_�jdj j dtj j|d��n�jdj j dd �tj }|r�|dd kr�yt|d�}Wq�tk r}} dtjd|dfGHdSXn|j�ryddl} Wntk r�nXddl�d�jf��fd ��Y}y|�jdj�j�Wq{tk r}|SXnd|j�} |j�t| |jd�}y�j|�Wn%tk ri}|S|j�dSXdS(Ni����isvt:is-vs-tR)R<R2t-s%s: can't open file %rtRestrictedConsolecseZ��fd�ZRS(cs4�jd|jd<�j�jj||f�dS(NR�R�(R:R�R�tInteractiveConsoletruncode(Rtco(R�R�(s/usr/lib64/python2.7/rexec.pyR�7s(RRR�((R�R�(s/usr/lib64/python2.7/rexec.pyR�6sR�texec(tgetoptt tracebackR<R�RuRRrRvR:R=tinsertR�tdirnameR�RmR�RRR�R�R�R�tinteractt SystemExitRRtcompileRR�t print_exc(R�R�toptsR(R)ttrustedtotatfptmsgRR�tnttexttc((R�R�s/usr/lib64/python2.7/rexec.pyttestsX - " R�(R�twarningsRR<R�R�R%R�t__all__RRRRR&R tFancyModuleLoaderR{tModuleImporterR}RpRR�RRb(((s/usr/lib64/python2.7/rexec.pyt<module>s* 4 �� 4
/home/jackpotjunglegam/../../lib64/libnfsidmap/../tcl8.6/../mysql/../python2.7/rexec.pyc