o _@sFdZdZdZddlmZmZddlmZmZee Z GdddZ dS) z!Cyril Jaquier, Yaroslav Halchenkoz:Copyright (c) 2004 Cyril Jaquier, 2013- Yaroslav HalchenkoGPL)UnknownJailExceptionDuplicateJailException) getLoggerloggingc@s6eZdZd ddZddZddZdd Zd d ZdS) BeautifierNcC ||_dSN_Beautifier__inputCmdselfcmdr|7}W|S|dd?vrt|dkrd@}W|SdA}|dd0D] } |d1| d7}q|d!|d07}W|S|ddBvrt|dkrdC}W|SdD}d} |dd0D]}|dEt | dF|d7}| d 7} q|dGt | dF|d07}W|S|ddHkrt|dkrdI|d }W|SdJ|d }|dK|7}W|S|ddLkr>t|dkr*dM|d |d,f}W|SdN|d |d,f}|dK|7}W|S|ddOkrmt|dkrYdP|d |d,f}W|SdQ|d |d,f}|dK|7}W|S|ddRkr|ddSkrt|t rt|d,krdn|d,}|dTkrd}||}W|SW|SW|SW|StytdUtjdV||jtt jkdWt|t|}Y|Sw)XNz Beautify z with pingzServer replied: versionstartz Jail startedstopzShutdown successfulz Jail stoppedaddz Added jail flushlogszlogs: echo statuszStatus for the jail: %sz`-z|-z%s %sz z| z %s %s: %sStatus r syslogsocketzCurrent syslog socket is: z`- logtargetzCurrent logging target is: loglevelzCurrent logging level is dbfilezDatabase currently disabledzCurrent database file is: dbpurgeagezCurrent database purge age is: z `- %iseconds)logpath addlogpath dellogpathzNo file is currently monitoredzCurrent monitored log file(s): z|- logencodingz Current log encoding is set to: ) journalmatchaddjournalmatchdeljournalmatchzNo journal match filter setzCurrent match filter: z + css|]}d|VqdS)rN)join).0resrrr sz&Beautifier.beautify.. datepatternzCurrent date pattern set to: zNot set/requiredz%sz%s (%s))ignoreip addignoreip delignoreipz No IP address/network is ignoredz)These IP addresses/networks are ignored: ) failregex addfailregex delfailregex ignoreregexaddignoreregexdelignoreregexz No regular expression is definedz.The following regular expression are defined: z|- [z]: z`- [actionszNo actions for jail %sz'The jail %s has the following actions: z, actionpropertiesz#No properties for jail %s action %sz4The jail %s action %s has the following properties: actionmethodsz No methods for jail %s action %sz1The jail %s action %s has the following methods: banipgetz --with-timez)Beautifier error. Please report the errorzBeautify %r with %r failed)exc_info)logSyslogreprr lenr1 enumerateappend isinstancelistmapstrintr getLevelName ExceptionwarningerrorgetEffectiveLevelDEBUG)r responseinCmsgnres1prefix1mres2prefix2valpathipclseprrrbeautify0s      ~ | z * , geb_$\ YV SPNKF C@=  9752-) "             zBeautifier.beautifycCsftd||j|}t|trd|jdd}|St|tr#d}|St|tr1d|jdd}|S)NzBeautify (error) %r with %rzSorry but the jail 'rz' does not existz Sorry but the command is invalidz The jail 'z' already exists)rEdebugr rKrargs IndexErrorr)r rVrXrrr beautifyErrors   zBeautifier.beautifyErrorr )__name__ __module__ __qualname__rrrrerirrrrr%s  rN) __author__ __copyright__ __license__ exceptionsrrhelpersrrrjrErrrrrs