Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_audit.cpython-310.pyc
o

�9j��@s�dZddlZddlZddlZddlmZddlmZddlmZe	ed�r*e	ed�s/e�
d��e�d	�ZGd
d�dej
�ZedkrGe��dSdS)
z)Tests for sys.audit and sys.addaudithook
�N)�support)�
import_helper)�	os_helper�addaudithook�auditz.test only relevant when sys.audit is availablezaudit-tests.pyc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�ZdS)*�	AuditTestNcGs�tjtjdtg|�dtjtjd��/}|��tj�|j�tj	�|j	�|j
r8|�d�|j	��Wd�dSWd�dS1sCwYdS)N�-X utf8�utf-8��encoding�stdout�stderr�)
�
subprocess�Popen�sys�
executable�AUDIT_TESTS_PY�PIPE�waitr�
writelinesr
�
returncode�fail�join)�self�args�p�r�&/usr/lib/python3.10/test/test_audit.py�do_tests��	"�zAuditTest.do_testcGs�g}tjtjdtg|�dtjtjd��#}|��tj�|j�|j	dd�|j
D�d�|j�fWd�S1s9wYdS)Nrr	r
cSsg|]	}|���d��qS)� )�strip�	partition)�.0�linerrr�
<listcomp>.sz(AuditTest.run_python.<locals>.<listcomp>r)rrrrrrrr
rrrr)rr�eventsrrrr�
run_python"s�
�$�zAuditTest.run_pythoncC�|�d�dS)N�
test_basic�r�rrrrr)2�zAuditTest.test_basiccCr()N�test_block_add_hookr*r+rrrr-5r,zAuditTest.test_block_add_hookcCr()N�!test_block_add_hook_baseexceptionr*r+rrrr.8r,z+AuditTest.test_block_add_hook_baseexceptioncC�t�d�|�d�dS)N�marshal�test_marshal�r�
import_modulerr+rrrr1;�
zAuditTest.test_marshalcCr/)N�pickle�test_pickler2r+rrrr6@r4zAuditTest.test_picklecCr()N�test_monkeypatchr*r+rrrr7Er,zAuditTest.test_monkeypatchcCs|�dtj�dS)N�	test_open)rr�TESTFNr+rrrr8HszAuditTest.test_opencCr()N�
test_cantracer*r+rrrr:Kr,zAuditTest.test_cantracecCr()N�	test_mmapr*r+rrrr;Nr,zAuditTest.test_mmapcCs6|�d�\}}}|s|�d|���|�dg|�dS)N�test_excepthookzExpected fatal exception
)zsys.excepthookr zRuntimeError('fatal-error'))r'r�assertSequenceEqual�rrr&r
rrrr<Qs�zAuditTest.test_excepthookcCsJ|�d�\}}}|r|�|�|�|ddd�|�|ddd�dS)N�test_unraisablehookrzsys.unraisablehook�zDRuntimeError('nonfatal-error') Exception ignored for audit hook test)r'r�assertEqualr>rrrr?Zs

�zAuditTest.test_unraisablehookcCs�t�d�|�d�\}}}|r|�|�|�|ddd�|�|ddd�|dd}|�|�|�dd	|�d
�g|d�|�dd	|�d�g|d�|�d
d	|g|d�dS)N�winreg�test_winregrzwinreg.OpenKey�zwinreg.OpenKey/resultr@zwinreg.EnumKeyr z 0z 10000�zwinreg.PyHKEY.Detach�)rr3r'rrA�
assertTruer=)rrr&r
�expectedrrrrCes


zAuditTest.test_winregcCs�t�d�|�d�\}}}|r|�|�tjrt|ddi�|�|ddd�|�|ddd�|�|d	dd
�|�|d	d	�	d��dS)N�socket�test_socket�sep�
rzsocket.gethostnamerDzsocket.__new__r@zsocket.bindz('127.0.0.1', 8080))
rr3r'rr�verbose�printrArG�endswithr>rrrrJss

zAuditTest.test_socketcCsP|�d�\}}}|r|�|�tjrt|ddi�|�dd�|D�gd��dS)N�test_gcrKrLcS�g|]}|d�qS�rr)r#�eventrrrr%��z%AuditTest.test_gc.<locals>.<listcomp>)zgc.get_objectszgc.get_referrerszgc.get_referents)r'rrrMrNrAr>rrrrP�s
�zAuditTest.test_gccCs�t�d�|�d�\}}}|r|�|�tjrt|ddi�|�|ddd�|�|ddd�|�|d	dd
�|d	ddkrP|�d|d	d�dSdS)
Nzhttp.client�test_http_clientrKrLrzhttp.client.connectr@zwww.python.org 80rDzhttp.client.sendz
[cannot send]�HTTP)	rr3r'rrrMrNrA�assertInr>rrr�	test_http�s

�zAuditTest.test_httpcCs~t�d�}|�d�\}}}|r|�|�tjrt|ddi�dd�|D�}ddgd	}t|jd
�r7|ddg7}|�	||�dS)
N�sqlite3�test_sqlite3rKrLcSrQrRr)r#�evrrrr%�rTz*AuditTest.test_sqlite3.<locals>.<listcomp>zsqlite3.connectzsqlite3.connect/handler@�enable_load_extensionzsqlite3.enable_load_extensionzsqlite3.load_extension)
rr3r'rrrMrN�hasattr�
ConnectionrA)rrYrr&r
�actualrHrrrrZ�s

�zAuditTest.test_sqlite3cCs�t�d�}|�d�\}}}|r|�|�tjr"tdg|�Rddi�|�|ddd|j��fd	d|j	�d
�fdd|j
�fdd	d|j	�d
�fddd|j��fddd|j�d|j��fddd|j��fdg	�dS)N�syslog�test_syslogzEvents:rKz
  zsyslog.openlogr z	python 0 z
syslog.syslogz testzsyslog.setlogmask)zsyslog.closelogrrz test2zaudit-tests.py 0 zaudit-tests.py zNone 0 )
rr3r'rrrMrNr=�LOG_USER�LOG_INFO�	LOG_DEBUG�
LOG_NDELAY�
LOG_LOCAL0)rr`rr&r
rrrra�s&

��zAuditTest.test_syslogcCs&|�d�\}}}|r|�|�dSdS)N�test_not_in_gc)r'r)rr�_r
rrrrg�s�zAuditTest.test_not_in_gc)�__name__�
__module__�__qualname__�maxDiffrr'r)r-r.r1r6r7r8r:r;r<r?rCrJrPrXrZrargrrrrrs,
	

r�__main__)�__doc__rr�unittest�testr�test.supportrrr]�SkipTest�findfiler�TestCaserri�mainrrrr�<module>s

;�

Youez - 2016 - github.com/yon3zu
LinuXploit