iptables-converter - python classes

iptables_converter.py:

convert iptables commands within a script into a correspondig iptables-save script

default filename to read is rules, to read some other

file, append: -s filename

output is written to stdout for maximum flexibilty

Author: Johannes Hubertz <johannes@hubertz.de> Date: 2015-03-17 version: 0.9.8 License: GNU General Public License version 3 or later

Have Fun!

class iptables_converter.Chains(name, tables)

this is for one type of tables

put_into_fgr(content)

fill this line into this tabular

reset()

name is one of filter, nat, raw, mangle, tables is a list of tables in that table-class

class iptables_converter.ConverterError(message)

on accidential case of error show given reason

class iptables_converter.Tables(fname='reference-one')

some chaingroups in tables are predef: filter, nat, mangle, raw

put_into_tables(line)

put line into matching Chains-object

read_file(fname)

read file into Tables-object

reset(fname)

all predefined Chains aka lists are setup as new here

table_printout()

printout nonempty tabulars in fixed sequence

iptables_converter.main()

main parses options, filnames and the like one option (-s) may be given: input-filename if none given, it defaults to: rules

class iptables_converter.Chains(name, tables)

this is for one type of tables

put_into_fgr(content)

fill this line into this tabular

reset()

name is one of filter, nat, raw, mangle, tables is a list of tables in that table-class

class iptables_converter.Tables(fname='reference-one')

some chaingroups in tables are predef: filter, nat, mangle, raw

put_into_tables(line)

put line into matching Chains-object

read_file(fname)

read file into Tables-object

reset(fname)

all predefined Chains aka lists are setup as new here

table_printout()

printout nonempty tabulars in fixed sequence