-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated gh-pages for commit a66d959
Merge: 9b4393d 5b37e04 Author: ldx <v.nebehaj@gmail.com> Merge pull request #80 from bchatelard/master
- Loading branch information
Showing
40 changed files
with
925 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
|
||
import iptc | ||
|
||
for name in iptc.Table.ALL: | ||
table = iptc.Table(name) | ||
table.autocommit = False | ||
for chain in table.chains: | ||
if chain.name.startswith('iptc_'): | ||
print "Removing", chain.name | ||
table.delete_chain(chain) | ||
table.commit() | ||
table.refresh() | ||
|
||
for name in iptc.Table6.ALL: | ||
table = iptc.Table6(name) | ||
table.autocommit = False | ||
for chain in table.chains: | ||
if chain.name.startswith('iptc_'): | ||
print "Removing", chain.name | ||
table.delete_chain(chain) | ||
table.commit() | ||
table.refresh() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python | ||
|
||
import gc | ||
import sys | ||
import iptc | ||
|
||
#rule = iptc.Rule() | ||
#rule.src = "127.0.0.1" | ||
#rule.protocol = "udp" | ||
#rule.target = rule.create_target("ACCEPT") | ||
# | ||
#match = rule.create_match("comment") | ||
#match.comment = "this is a test comment" | ||
|
||
chain = iptc.Chain(iptc.Table(iptc.Table.FILTER), "INPUT") | ||
#chain.insert_rule(rule) | ||
|
||
while True: | ||
for r in chain.rules: | ||
c = r.matches[0].comment | ||
print >> sys.stderr, "comment", c | ||
#print >> sys.stderr, "garbage", gc.garbage | ||
#print >> sys.stderr, "buffers", iptc.BUFFERS | ||
#print >> sys.stderr, len(iptc.BUFFERS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python | ||
|
||
import iptc | ||
import time | ||
|
||
table = iptc.Table('nat') | ||
chain = iptc.Chain(table, 'PREROUTING') | ||
for port in ['8080', '9090', '10101']: | ||
rule = iptc.Rule() | ||
rule.position = 1 | ||
rule.dst = "127.0.0.1" | ||
rule.protocol = "udp" | ||
rule.dport = port | ||
target = rule.create_target("DNAT") | ||
target.to_destination = '127.0.0.0:' + port | ||
chain.insert_rule(rule) | ||
#table.commit() | ||
#table.refresh() | ||
|
||
time.sleep(3) | ||
|
||
table.autocommit = False | ||
print "deleting ", len(chain.rules), "rules from", table.name, "/", chain.name | ||
rules = chain.rules | ||
for rule in rules: | ||
chain.delete_rule(rule) | ||
table.commit() | ||
table.refresh() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.