Skip to content

Commit 90f0768

Browse files
committed
initial commit
1 parent d00bbe6 commit 90f0768

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎iptables-list.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
importsys
3+
try: f=open(sys.argv[1])
4+
exceptIndexError: f=sys.stdin
5+
6+
ll=[l.rstrip() forlinf]
7+
delf
8+
9+
importre
10+
11+
defprint_zone(name,prefix):
12+
forlin (lforlinllifre.match("-\\w %s\\b"%re.escape(name),l)):
13+
printprefix+l
14+
m=re.search("-j (\\w+)\\b",l)
15+
ifm:
16+
print_zone(m.group(1),prefix+"\t")
17+
18+
r=re.compile("-P (\\w+)\\b")
19+
zz= [r.match(l).group(1) forlinllifr.match(l)]
20+
forzinzz:
21+
print_zone(z,"")
22+
print

0 commit comments

Comments
(0)