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/fail2ban/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/fail2ban/tests/__pycache__/clientbeautifiertestcase.cpython-310.pyc
o

��_/$�@s^dZdZdZddlZddlmZddlmZddlmZdd	l	m
Z
mZGd
d�dej�Z
dS)zAlexander Koeppez>Copyright (c) 2016 Cyril Jaquier, 2011-2013 Yaroslav Halchenko�GPL�N�)�
Beautifier)�version)�IPAddr)�UnknownJailException�DuplicateJailExceptioncs�eZdZ�fdd�Z�fdd�Zdd�Zdd�Zd	d
�Zdd�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*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Z�ZS)5�BeautifierTestcstt|���t�|_dS)z Call before every test case N)�superr	�setUpr�b��self��	__class__��I/usr/lib/python3/dist-packages/fail2ban/tests/clientbeautifiertestcase.pyr!szBeautifierTest.setUpcstt|���dS)z Call after every test case N)r
r	�tearDownr
rrrr&szBeautifierTest.tearDowncCs(dg}|j�|�|�|j��|�dS)N�test)r�setInputCmd�assertEqual�getInputCmd)r�cmdrrr�testGetInputCmd*szBeautifierTest.testGetInputCmdcC�&|j�dg�|�|j�d�d�dS)N�ping�pongzServer replied: pong�rrr�beautifyr
rrr�testPing/�zBeautifierTest.testPingcCs&|j�dg�|�|j�t�t�dS)Nr)rrrrrr
rrr�testVersion3r zBeautifierTest.testVersioncCr)N�add�sshzAdded jail sshrr
rrr�testAddJail7r zBeautifierTest.testAddJailcC�&|j�dg�|�|j�d�d�dS)N�startzJail startedrr
rrr�
testStartJail;r zBeautifierTest.testStartJailcCs(|j�ddg�|�|j�d�d�dS)N�stopr#zJail stoppedrr
rrr�testStopJail?szBeautifierTest.testStopJailcCr%)Nr(zShutdown successfulrr
rrr�testShutdownCr zBeautifierTest.testShutdownc	Cs�|j�dg�ddddgff}d}|�|j�|�|�|j�ddg�dgd�fd	d
ddtd
�td�td�gfgff}d}|d7}|d7}|d7}|d7}|d7}|d7}|d7}|d7}|�|j�|�|�dS)N�status)zNumber of jailsrz	Jail listr#�exim4z4Status
|- Number of jails:	0
`- Jail list:	ssh exim4�Filter))zCurrently failedr)zTotal failedr)z	File list�/var/log/auth.log�Actions)zCurrently banned�)zTotal bannedr0zBanned IP listz192.168.0.1z::ffff:10.2.2.1z2001:db8::1zStatus for the jail: ssh
z
|- Filter
z|  |- Currently failed:	0
z|  |- Total failed:	0
z#|  `- File list:	/var/log/auth.log
z`- Actions
z   |- Currently banned:	3
z   |- Total banned:	3
z6   `- Banned IP list:	192.168.0.1 10.2.2.1 2001:db8::1�rrrrr�r�response�outputrrr�
testStatusGs4
���zBeautifierTest.testStatuscCr)N�	flushlogszrolled overzlogs: rolled overrr
rrr�
testFlushLogslr zBeautifierTest.testFlushLogscC�,|j�ddg�d}|�|j�d�|�dS)N�get�syslogsocketz!Current syslog socket is:
`- auto�autor�rr4rrr�testSyslogSocketp�zBeautifierTest.testSyslogSocketcCr8)Nr9�	logtargetz3Current logging target is:
`- /var/log/fail2ban.logz/var/log/fail2ban.logrr<rrr�
testLogTargetur>zBeautifierTest.testLogTargetcCr8)Nr9�loglevelzCurrent logging level is 'INFO'�INFOrr<rrr�testLogLevelzr>zBeautifierTest.testLogLevelcCsH|j�ddg�d}d|}|�|j�|�|�|�|j�d�d�dS)Nr9�dbfilez"/var/lib/fail2ban/fail2ban.sqlite3zCurrent database file is:
`- �Database currently disabledrr2rrr�
testDbFiles
zBeautifierTest.testDbFilecCs@|j�ddg�d}|�|j�d�|�|�|j�d�d�dS)Nr9�
dbpurgeagez.Current database purge age is:
`- 86400secondsi�QrErr<rrr�testDbPurgeAge�szBeautifierTest.testDbPurgeAgecCs�|j�gd��g}d}|�|j�|�|�dg}d}|�|j�|�|�|j�gd��ddg}d}|d7}|�|j�|�|�|j�gd	��dg}|�|j�|�|�dS)
N)r9�sshd�logpathzNo file is currently monitoredr.z3Current monitored log file(s):
`- /var/log/auth.log)�setrI�
addlogpath�/var/log/messagesrMzCurrent monitored log file(s):
z)|- /var/log/messages
`- /var/log/auth.log)rKrI�
dellogpathrMr)rr3r4�	outputaddrrr�testLogPath�szBeautifierTest.testLogPathcCs,|j�gd��d}|�|j�d�|�dS)N)r9rI�logencodingz%Current log encoding is set to:
UTF-8zUTF-8rr<rrr�testLogEncoding�r>zBeautifierTest.testLogEncodingcCs�|j�gd��|�|j�g�d�|j�gd��ddgg}d}|d7}|�|j�|�|�|�dd	g�|d
7}|�|j�|�|�|j�gd��|�|d�|�|j�|�|�d
�d�dS)N)r9rI�journalmatchzNo journal match filter set)rKrI�addjournalmatch�
_SYSTEMD_UNITzsshd.servicezCurrent match filter:
z_SYSTEMD_UNIT sshd.service�_COMMrIz
 + _COMM sshd)rKrI�deljournalmatch�z + r)rrrr�append�remove�splitr2rrr�testJournalMatch�s
"zBeautifierTest.testJournalMatchcCsd|j�gd��d}d}|�|j�d�|d�|�|j�|�|d�|�|j�d�|d�dS)N)r9rI�datepatternzCurrent date pattern set to: )N�Default DetectorszNot set/requiredr^)rrztest (test)r�rr4r3rrr�testDatePattern�s���zBeautifierTest.testDatePatterncCs�|j�gd��d}|�|j�g�|�|j�gd��tdd�td�tdd�td	�g}d
}|d7}|d7}|d
7}|d7}|�|j�|�|�dS)N)r9rI�ignoreipz No IP address/network is ignored)rKrI�addignoreipz	127.0.0.0�z::1z
2001:db8::� z::ffff:10.0.2.1z)These IP addresses/networks are ignored:
z|- 127.0.0.0/8
z|- ::1
z|- 2001:db8::/32
z`- 10.0.2.1r1r_rrr�testIgnoreIP�s�zBeautifierTest.testIgnoreIPcC�P|j�gd��d}|�|j�g�|�d}|d7}|�|j�ddg�|�dS)N)r9rI�	failregexz No regular expression is definedz.The following regular expression are defined:
z|- [0]: ^$
`- [1]: .*z^$z.*rr<rrr�
testFailRegex��zBeautifierTest.testFailRegexcCsN|j�gd��d}|�|j�g�|�d}|d7}|�|j�dg�|�dS)N)r9rI�actionszNo actions for jail sshdz)The jail sshd has the following actions:
ziptables-multiportrr<rrr�testActions�szBeautifierTest.testActionscCsP|j�gd��d}|�|j�g�|�d}|d7}d}|�|j�|�|�dS)N)r9rI�actionproperties�iptablesz+No properties for jail sshd action iptablesz;The jail sshd action iptables has the following properties:z
actionban, actionunban)�	actionban�actionunbanrr_rrr�testActionProperties�sz#BeautifierTest.testActionPropertiescCrf)N)r9rI�
actionmethodsrmz(No methods for jail sshd action iptablesz9The jail sshd action iptables has the following methods:
z
ban, unban�ban�unbanrr<rrr�testActionMethods�riz BeautifierTest.testActionMethodscCs^td�}d}|�|j�|�|�td�}d}|�|j�|�|�d}|�|j�t��|�dS)NrIz(Sorry but the jail 'sshd' does not existzThe jail 'sshd' already existsz Sorry but the command is invalid)rrr�
beautifyErrorr�
IndexErrorr2rrr�testBeautifyError�sz BeautifierTest.testBeautifyError)�__name__�
__module__�__qualname__rrrrr!r$r'r)r*r5r7r=r@rCrFrHrPrRr\r`rerhrkrprtrw�
__classcell__rrrrr	s6%		

r	)�
__author__�
__copyright__�__license__�unittest�client.beautifierrr�server.ipdnsr�
exceptionsrr�TestCaser	rrrr�<module>s

https://t.me/RX1948 - 2025