| Server IP : 61.19.30.66 / Your IP : 216.73.216.15 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python2.7/dist-packages/ufw/ |
Upload File : |
ó
¢¢^Oc @ s¢ d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z d d l m
Z
d „ Z d „ Z d „ Z
d „ Z d „ Z d
„ Z d S( s' applications.py: common classes for ufwiÿÿÿÿN( t debugt warn( t UFWErrorc C s t j j | ƒ s- t d ƒ } t | ƒ ‚ n d } i } t j | ƒ } | j ƒ d } t j d ƒ } x–| D]Ž} | d | } t j j | ƒ sš qn n | j
| ƒ r½ t d | ƒ qn n | j d ƒ s| j d ƒ s| j d
ƒ s| j d ƒ s| j d ƒ s| j d
ƒ r+t d | ƒ qn n d } y t j
| ƒ t
j } Wn. t k
r{t d ƒ | }
t |
ƒ qn n X| | k r¨t d ƒ | }
t |
ƒ qn n | | | k rØt d ƒ | }
t |
ƒ qn n | | 7} t j ƒ } y | j | ƒ Wn. t k
r/t d ƒ | }
t |
ƒ qn n XxÉ| j ƒ D]»} t | ƒ d k rut d ƒ | }
t |
ƒ q=n t | ƒ s¡t d ƒ | }
t |
ƒ q=n y1 t j j | ƒ t d ƒ | }
t |
ƒ w=Wn t k
rån Xt }
x— | j | ƒ D]† \ } } t | ƒ d k r>t d ƒ | }
t |
ƒ t }
Pn t | ƒ d k rüt d ƒ i | d 6| d 6}
t |
ƒ t }
PqüqüW|
r’q=n | j | ƒ r¾t d ƒ | }
t |
ƒ n i } x' | j | ƒ D] \ } } | | | <qÔW| | | <q=Wqn W| S( sw Get profiles found in profiles database. Returns dictionary with
profile name as key and tuples for fields
s! Profiles directory does not existi
i i s ^\.t /s Skipping '%s': hidden files .dpkg-news .dpkg-olds
.dpkg-dists .rpmnews .rpmsavet ~s
Skipping '%s's Skipping '%s': couldn't stats Skipping '%s': too bigs* Skipping '%s': too many files read alreadys Skipping '%s': couldn't processi@ s Skipping '%s': name too longs Skipping '%s': invalid names$ Skipping '%s': also in /etc/servicess Skipping '%s': field too longs4 Skipping '%(value)s': value too long for '%(field)s't valuet fields( Duplicate profile '%s', using last foundi ( i ( t ost patht isdirt _R t listdirt sortt ret compilet isfilet searchR t endswitht statt ST_SIZEt ExceptionR t ConfigParsert RawConfigParsert readt sectionst lent valid_profile_namet ufwt utilt get_services_protot Falset itemst Truet has_key( t profiles_dirt err_msgt max_sizet profilest filest
total_sizet patt ft abs_patht sizet warn_msgt cdictt pt skipt keyR t pdict( ( s4 /usr/lib/python2.7/dist-packages/ufw/applications.pyt get_profiles s¦
c C sF | d k r t Sy t | ƒ t SWn n Xt j d | ƒ rB t St S( s0 Only accept a limited set of characters for namet alls ^[a-zA-Z0-9][a-zA-Z0-9 _\-\.+]*$( R t intR
t matchR ( t name( ( s4 /usr/lib/python2.7/dist-packages/ufw/applications.pyR ‰ s
c C s[ d d d g } x | D]y } | j | ƒ sX t d ƒ i | d 6| d 6} t | ƒ ‚ q | | s t d ƒ i | d 6| d 6} t | ƒ ‚ q q W| d j d ƒ } t | ƒ d k rÌ t d
ƒ | } t SyO xH | D]@ } t j j | ƒ \ } } t j j
d | | ƒ } t | ƒ qÖ WWn9 t k
rV}
t |
ƒ t d ƒ | } t | ƒ ‚ n Xt
S(
s' Make sure profile has everything neededt titlet descriptiont portss/ Profile '%(fn)s' missing required field '%(f)s't fnR) s1 Profile '%(fn)s' has empty required field '%(f)s't |i s No ports found in profile '%s't ACCEPTs Invalid ports in profile '%s'( R! R
R t splitR R R R t parse_port_protot commont UFWRuleR R R ( R6 t profilet
app_fieldsR) R# R9 R. t portt protot rulet e( ( s4 /usr/lib/python2.7/dist-packages/ufw/applications.pyt verify_profileœ s0
c C s6 d } d } | j | ƒ r2 | | r2 | | } n | S( s# Retrieve the title from the profilet R7 ( R! ( RA t sR ( ( s4 /usr/lib/python2.7/dist-packages/ufw/applications.pyt get_title¿ s
c C s6 d } d } | j | ƒ r2 | | r2 | | } n | S( s) Retrieve the description from the profileRH R8 ( R! ( RA RI R ( ( s4 /usr/lib/python2.7/dist-packages/ufw/applications.pyt get_descriptionÇ s
c C s? g } d } | j | ƒ r; | | r; | | j d ƒ } n | S( s' Retrieve a list of ports from a profileR9 R; ( R! R= ( RA R9 R ( ( s4 /usr/lib/python2.7/dist-packages/ufw/applications.pyt get_portsÏ s
( t __doc__R R R
R t ufw.utilR R R t
ufw.commonR R2 R RG RJ RK RL ( ( ( s4 /usr/lib/python2.7/dist-packages/ufw/applications.pyt <module> s o #