8 fou=open(sys.argv[2],"w")
12 lo_matcher=re.compile("\A(?P<left>.+)\s+-i\s+lo\s+-j\s+ACCEPT")
13 ip_matcher=re.compile("--(source|destination) %s"%ip)
14 for line in fin.readlines():
15 attempt=lo_matcher.match(line)
19 fou.write("%s --source %s -j ACCEPT\n"%(attempt.group('left'),ip))
20 fou.write("%s --destination %s -j ACCEPT\n"%(attempt.group('left'),ip))
23 attempt = ip_matcher.match(line)
24 # do not rewrite old lines for this ip
33 if __name__ == '__main__':