%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/3/cwd/usr/lib/python2.7/site-packages/ufw/
Upload File :
Create Path :
Current File : //proc/3/cwd/usr/lib/python2.7/site-packages/ufw/applications.pyo

�
V�Vc@s�dZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
Z
e
jddkr�ddlZnddl
Z
d�Zd�Zd	�Zd
�Zd�Zd�ZdS(
s'applications.py: common classes for ufwi����N(tdebugtwarn(tUFWErroriicCsTtjj|�s-td�}t|��nd}i}tj|�}|j�d}tjd�}x�|D]�}|d|}tjj	|�s�qnn|j
|�r�td|�qnn|jd�s|jd	�s|jd
�s|jd�s|jd�s|jd
�r+td|�qnnd}	ytj
|�t
j}	Wn.tk
r{td�|}
t|
�qnnX|	|kr�td�|}
t|
�qnn||	|kr�td�|}
t|
�qnn||	7}tjddkrtj�}ntj�}y|j|�Wn.tk
rQtd�|}
t|
�qnnXx�|j�D]�}t|�dkr�td�|}
t|
�q_nt|�s�td�|}
t|
�q_ny1tjj|�td�|}
t|
�w_Wntk
rnXt}
x�|j|�D]�\}}t|�dkr`td�|}
t|
�t}
Pnt|�dkrtd�i|d6|d6}
t|
�t}
PqqW|
r�q_n||kr�td�|}
t|
�ni}x'|j|�D]\}}|||<q�Wyt ||�|||<Wq_tk
rG}t|�q_Xq_WqnW|S(swGet profiles found in profiles database.  Returns dictionary with
       profile name as key and tuples for fields
    s!Profiles directory does not existi
iis^\.t/sSkipping '%s': hidden files	.dpkg-news	.dpkg-olds
.dpkg-dists.rpmnews.rpmsavet~s
Skipping '%s'sSkipping '%s': couldn't statsSkipping '%s': too bigs*Skipping '%s': too many files read alreadyisSkipping '%s': couldn't processi@sSkipping '%s': name too longsSkipping '%s': invalid names$Skipping '%s': also in /etc/servicessSkipping '%s': field too longs4Skipping '%(value)s': value too long for '%(field)s'tvaluetfields(Duplicate profile '%s', using last foundi(i�(!tostpathtisdirt_RtlistdirtsorttretcompiletisfiletsearchRtendswithtstattST_SIZEt	ExceptionRtsystversion_infotConfigParsertRawConfigParsertconfigparsertreadtsectionstlentvalid_profile_nametufwtutiltget_services_prototFalsetitemstTruetverify_profile(tprofiles_dirterr_msgtmax_sizetprofilestfilest
total_sizetpattftabs_pathtsizetwarn_msgtcdicttptskiptkeyRtpdictte((s4/usr/lib/python2.7/site-packages/ufw/applications.pytget_profiless�













	


cCsF|dkrtSyt|�tSWnnXtjd|�rBtStS(s0Only accept a limited set of characters for nametalls ^[a-zA-Z0-9][a-zA-Z0-9 _\-\.+]*$(R!tintR
tmatchR#(tname((s4/usr/lib/python2.7/site-packages/ufw/applications.pyR�s
cCsedddg}x~|D]v}||krUtd�i|d6|d6}t|��q||std�i|d6|d6}t|��qqW|djd�}y�x{|D]s}tjj|�\}}|d	kr�d
|ks�d|kr�t|��ntjjd||�}	t|	�q�WWn9t	k
r`}
t|
�td
�|}t|��nXt
S(s'Make sure profile has everything neededttitletdescriptiontportss/Profile '%(fn)s' missing required field '%(f)s'tfnR,s1Profile '%(fn)s' has empty required field '%(f)s't|tanyt:t,tACCEPTsInvalid ports in profile '%s'(R
RtsplitRRtparse_port_prototcommontUFWRuleRRR#(R:tprofilet
app_fieldsR,R&R=R1tporttprototruleR5((s4/usr/lib/python2.7/site-packages/ufw/applications.pyR$�s.
	
	
$
cCs3d}d}||kr/||r/||}n|S(s#Retrieve the title from the profiletR;((RHtsR((s4/usr/lib/python2.7/site-packages/ufw/applications.pyt	get_title�s

cCs3d}d}||kr/||r/||}n|S(s)Retrieve the description from the profileRMR<((RHRNR((s4/usr/lib/python2.7/site-packages/ufw/applications.pytget_description�s

cCs<g}d}||kr8||r8||jd�}n|S(s'Retrieve a list of ports from a profileR=R?(RD(RHR=R((s4/usr/lib/python2.7/site-packages/ufw/applications.pyt	get_ports�s
(t__doc__RR
Rtufw.utilRRRt
ufw.commonRRRRRR6RR$RORPRQ(((s4/usr/lib/python2.7/site-packages/ufw/applications.pyt<module>s 	w				

Zerion Mini Shell 1.0