Parsers Documentation

This page contains the Parsers Package documentation.

The simplenificparser Module

class netbench.classification.parsers.simplenificparser.SimpleNificParser

Bases: netbench.classification.parsers.bruleparser.BRuleParser

Rule parser according to the simplified NIFIC rule format.

load_file(filename)

Load rules from a file, return True if parsing was successfull.

filename: Name of file in NIFIC format.

netbench.classification.parsers.simplenificparser.checkip(ip)
Check if the given string contains a valid IPv4 prefix Return the value of the address
netbench.classification.parsers.simplenificparser.checkmac(mac)
Check if the given string contains a valid MAC address Return the value of the address
netbench.classification.parsers.simplenificparser.ishex(s)
Check if given string is a valid hexadecimal number
netbench.classification.parsers.simplenificparser.process_action(linearray)
Process the action of the rule Return parsed conditions in a dictionary
netbench.classification.parsers.simplenificparser.process_flags(flags)
Compute the value of the given flags
netbench.classification.parsers.simplenificparser.process_from_to(linearray, i, s)

Process the ‘from’ (or ‘to’) part of the rule [‘from’ src_addr [‘mac’ src_mac][‘port’ src_port]]

Return parsed conditions in a dictionary

netbench.classification.parsers.simplenificparser.process_priority(linearray)
Process the priority of the rule and return its value
netbench.classification.parsers.simplenificparser.process_proto(linearray, i)
Process the protocol of the rule Return parsed conditions in a dictionary

The bruleparser Module

Module with abstract class for all rule parsers.

class netbench.classification.parsers.bruleparser.BRuleParser

Bases: object

Base abstract class for all rule parsers.

check_rules()
Process rules and remove duplicates, rules with no effect (covered by other rules) etc.
get_rules()
Return RuleSet with parsed rules.
load_file(filename)

Load rules from a file, return True if parsing was successfull. Abstract method.

filename: Name of file in appropriate format.

Table Of Contents

Previous topic

Classification Documentation

Next topic

Algorithms Documentation

This Page