a a l'air de fonctionner comme a.
Reste tester la blacklist. On attend Fred pour a. darcs-hash:20041027215630-1d643-bf07c0d8a288582f01951d9556cbfe205d8bc57f.gz
This commit is contained in:
parent
507d0dfc85
commit
83786855db
1 changed files with 23 additions and 5 deletions
|
@ -100,6 +100,8 @@ class firewall:
|
||||||
"""
|
"""
|
||||||
Détruit une entrée dans le firewall
|
Détruit une entrée dans le firewall
|
||||||
Note: Il faut *os.systemer lourdement* cette fonction.
|
Note: Il faut *os.systemer lourdement* cette fonction.
|
||||||
|
Ce serait pas mal de factoriser par ici, mais de toute façon la
|
||||||
|
méthode ne me plaît pas du tout.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
os.system("iptables -L -n > /tmp/firewall")
|
os.system("iptables -L -n > /tmp/firewall")
|
||||||
|
@ -115,9 +117,25 @@ class firewall:
|
||||||
chaine=tmp[1]
|
chaine=tmp[1]
|
||||||
count=0
|
count=0
|
||||||
if ip in line:
|
if ip in line:
|
||||||
os.system("iptables -L")
|
|
||||||
test("iptables -D %s %i"%(chaine,count))
|
|
||||||
count=count-1
|
count=count-1
|
||||||
|
test("iptables -D %s %i"%(chaine,count))
|
||||||
|
os.system("rm -f /tmp/firewall")
|
||||||
|
try:
|
||||||
|
os.system("iptables -t nat -L -n > /tmp/firewall")
|
||||||
|
except:
|
||||||
|
print "Impossible de créer le fichier d'états /tmp/firewall"
|
||||||
|
exit()
|
||||||
|
chaines=[]
|
||||||
|
count=0
|
||||||
|
for line in fileinput.input('/tmp/firewall'):
|
||||||
|
count=count+1
|
||||||
|
if "Chain" in line:
|
||||||
|
tmp=line.split(' ')
|
||||||
|
chaine=tmp[1]
|
||||||
|
count=0
|
||||||
|
if ip in line:
|
||||||
|
count=count-1
|
||||||
|
test("iptables -t nat -D %s %i"%(chaine,count))
|
||||||
os.system("rm -f /tmp/firewall")
|
os.system("rm -f /tmp/firewall")
|
||||||
|
|
||||||
def paire_macip(self,ip,mac):
|
def paire_macip(self,ip,mac):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue