_rulesutils module (daxfi package).
This module provide utilities for both the RuleBuilder and Rule classes.
Copyright 2001, 2002 Davide Alberani <alberanid@libero.it>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Imported modules
|
|
from daxfi import iplib
from daxfi._exceptions import *
from daxfi._syslog import *
import socket
|
Functions
|
|
|
|
mergeRuleWithUDC
|
mergeRuleWithUDC ( rule, chains )
Merge a rule, with a user-defined target, with the
referred chain (and recurse in sub-chains).
|
|
modifyRuleData
|
modifyRuleData (
rd,
convAttributes={},
convSections={},
forEveryAttribute=None,
)
Modify the given RuleData object. The object is modified in place.
|
|
transf_fatal
|
transf_fatal ( v )
Raise an exception because a rule with this option/extension
cannot be built with the currently used firewall.
Exceptions
|
|
CreateRulesError, 'Cannot insert a key in a rule for ' + 'this firewall'
|
|
|
transf_icmp
|
transf_icmp ( v )
Return a numeric representation of icmp type/code.
|
|
transf_ip
|
transf_ip ( v )
Manage IP address.
Return an IP in dotted notation with the right netmask.
|
|
transf_ip_nomask
|
transf_ip_nomask ( v )
Return an IP without the netmask.
|
|
transf_ip_remove_default
|
transf_ip_remove_default ( v )
Remove the default value for IP addresses.
Exceptions
|
|
RemoveOptionError, 'remove the default value'
|
|
|
transf_normalize
|
transf_normalize ( v )
Check for a space after an exclamation mark and strip white spaces.
|
|
transf_port
|
transf_port ( v )
Return the port number.
Given a port name, return the protocol number.
|
|
transf_port_remove_default
|
transf_port_remove_default ( v )
Remove the default value for port numbers.
Exceptions
|
|
RemoveOptionError, 'remove the default value'
|
|
|
transf_proto
|
transf_proto ( v )
Return the protocol number.
Given a protocol name, return the protocol number.
|
|
transf_remove
|
transf_remove ( v )
Simply remove an entry.
Exceptions
|
|
RemoveOptionError, 'remove this option'
|
|
|
transf_remove_section
|
transf_remove_section ( v )
Raise an exception that force the modify_option function to
completely discard the current section.
Exceptions
|
|
RemoveSectionError, 'cannot use this extension with this firewall'
|
|
|
transf_sort
|
transf_sort ( v )
For options that need to be sorted.
Given a string with comma separated items, these items are sorted;
if portions of the string are sparated by slashes, the order of these
groups is preserved.
|
|