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,7 +100,9 @@ class firewall:
|
|||
"""
|
||||
Détruit une entrée dans le firewall
|
||||
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:
|
||||
os.system("iptables -L -n > /tmp/firewall")
|
||||
except:
|
||||
|
@ -110,14 +112,30 @@ class firewall:
|
|||
count=0
|
||||
for line in fileinput.input('/tmp/firewall'):
|
||||
count=count+1
|
||||
if "Chain" in line:
|
||||
if "Chain" in line:
|
||||
tmp=line.split(' ')
|
||||
chaine=tmp[1]
|
||||
count=0
|
||||
if ip in line:
|
||||
os.system("iptables -L")
|
||||
test("iptables -D %s %i"%(chaine,count))
|
||||
if ip in line:
|
||||
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")
|
||||
|
||||
def paire_macip(self,ip,mac):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue