diff --git a/iptables-graph b/iptables-graph index 9e09c94..80eb425 100755 --- a/iptables-graph +++ b/iptables-graph @@ -2,6 +2,7 @@ import sys import re import string +import html all_chains = { 'raw': {'PREROUTING':list(), 'OUTPUT':list()}, 'filter': {'INPUT':list(), 'OUTPUT':list(), 'FORWARD':list()}, @@ -15,6 +16,8 @@ line_list = input_string.splitlines() current_table = None for line in line_list: token_list = line.split() + if len(token_list) == 0: + continue if token_list[0][1:] in all_chains.keys(): current_table = token_list[0][1:] continue @@ -57,18 +60,18 @@ for table in all_chains: tmp_body = node_name + """ [label=<
| """ + chain + """ |
| """ + table + """ |
| """ + html.escape(chain) + """ |
| """ + html.escape(table) + """ |
| """ + chain + """ |
| """ + table + """ |
| """ + html.escape(chain) + """ |
| """ + html.escape(table) + """ |
| """ + rule["rule_body"] + """ |
| end |