diff --git a/sample.txt b/sample.txt index 0172808..9408819 100644 --- a/sample.txt +++ b/sample.txt @@ -11,6 +11,8 @@ group shodan object shodan-io2 object shodan-io3 - + server group shodan drop -server object local accept \ No newline at end of file +server object local accept +server proto 25 drop +server proto 842 drop \ No newline at end of file diff --git a/yaig.py b/yaig.py index 6aa68c9..23d1cad 100644 --- a/yaig.py +++ b/yaig.py @@ -173,7 +173,7 @@ try: for ip in getIPsInGroup(rule.source.value): generated_ruleset.append(ruletpl % (iface, ip, action, rule)) elif rule.source.object_type == TYPES.PROTO: - generated_ruleset.append("-A INPUT -i %s -p %s -j %s -m comment --comment \"%s\"" % (iface, rule.source.value, action, rule)) + generated_ruleset.append("-A INPUT -i %s -p tcp --destination-port %s -j %s -m comment --comment \"%s\"" % (iface, rule.source.value, action, rule)) for rule in global_defs: if rule.direction == NET_DIRECTION.SERVER: @@ -193,7 +193,7 @@ try: for ip in getIPsInGroup(rule.source.value): generated_ruleset.append(ruletpl % (ip, action, rule)) elif rule.source.object_type == TYPES.PROTO: - generated_ruleset.append("-A INPUT -i %s -p %s -j %s -m comment --comment \"%s\"" % (rule.source.value, action, rule)) + generated_ruleset.append("-A INPUT -p tcp --destination-port %s -j %s -m comment --comment \"%s\"" % (rule.source.value, action, rule)) for rule in generated_ruleset: print rule