Table of Contents

Class: RuleBuilderBase daxfi/RuleBuilder.py

Class used to build a set of Rule objects.

This is the base class for firewall-specific RuleBuilder classes.

Methods   
__init__
_localInfoSubstitution
_modifyDom
clean
create
createFromDOM
getDom
getRules
parseOnly
parseXMLFile
parseXMLString
setDom
setFirewallName
setRuleClass
setSubstitutionDict
  __init__ 
__init__ ( self,  substitutionDict={} )

  _localInfoSubstitution 
_localInfoSubstitution ( self,  s )

Substitute well known strings in the XML file with user supplied data.

  _modifyDom 
_modifyDom ( self )

Modify the attributes for this rule.

This method is called by the setDom() method; it handles the first_transformation and section_transformation dictionaries to modify the DOM object so that it can be compare with the ones from other rules.

  clean 
clean ( self )

Reset the builder.

  create 
create (
        self,
        action='append',
        pos='-1',
        target='DROP',
        chain='INPUT',
        source='0.0.0.0/0.0.0.0',
        destination='0.0.0.0/0.0.0.0',
        interface='',
        proto='all',
        sport='',
        dport='',
        log=0,
        )

Create a set of rules with the given parameters. By default the chain is INPUT and the target is drop.

  createFromDOM 
createFromDOM ( self,  dom )

Create a set of rules from a given DOM.

  getDom 
getDom ( self )

Get the DOM.

  getRules 
getRules ( self,  returnAll=0 )

Return the rules for this DOM.

Elaborate the current DOM and return a set of Rule object. By default return an empty list if the single-rule processing instruction is set and the rule is a logging one (useful porting rules dumped by a ipchains firewall to a iptables firewall) and manage the rule-number attribute.

  parseOnly 
parseOnly ( self,  s )

Only parse a XML string; an hack used for performance reasons.

  parseXMLFile 
parseXMLFile ( self,  fname )

Parse a given XML file; return a list of Rule objects.

  parseXMLString 
parseXMLString ( self,  s )

Parse a given XML string; return a list of Rule objects.

  setDom 
setDom ( self,  o )

Set the DOM we're working on.

  setFirewallName 
setFirewallName ( self,  fn )

Another hack.

  setRuleClass 
setRuleClass ( self,  rc )

An hack.

  setSubstitutionDict 
setSubstitutionDict ( self,  dict )

Set the substitution dictionary.


Table of Contents

This document was automatically generated on Sat Sep 1 13:50:21 2001 by HappyDoc version r1_5