mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 10:04:41 +00:00
(captiveportal, new) work in progress script base
This commit is contained in:
parent
518f6cc157
commit
cc88cada8f
@ -139,11 +139,12 @@ class IPFW(object):
|
||||
break
|
||||
|
||||
# add accounting rule
|
||||
DEVNULL = open(os.devnull, 'w')
|
||||
subprocess.call(['/sbin/ipfw', 'add', 'count','ip','from', address, 'to', 'any'],
|
||||
stdout=DEVNULL, stderr=DEVNULL)
|
||||
subprocess.call(['/sbin/ipfw', 'add', 'count','ip','from', 'any', 'to', address],
|
||||
stdout=DEVNULL, stderr=DEVNULL)
|
||||
if newRuleid != -1:
|
||||
DEVNULL = open(os.devnull, 'w')
|
||||
subprocess.call(['/sbin/ipfw', 'add', str(newRuleid), 'count','ip','from', address, 'to', 'any'],
|
||||
stdout=DEVNULL, stderr=DEVNULL)
|
||||
subprocess.call(['/sbin/ipfw', 'add', str(newRuleid), 'count','ip','from', 'any', 'to', address],
|
||||
stdout=DEVNULL, stderr=DEVNULL)
|
||||
|
||||
def del_accounting(self, address):
|
||||
""" remove ip address from accounting rules
|
||||
@ -153,5 +154,5 @@ class IPFW(object):
|
||||
acc_info = self.list_accounting_info()
|
||||
if address in acc_info:
|
||||
DEVNULL = open(os.devnull, 'w')
|
||||
subprocess.call(['/sbin/ipfw', 'delete', acc_info[address]['rule']],
|
||||
subprocess.call(['/sbin/ipfw', 'delete', str(acc_info[address]['rule'])],
|
||||
stdout=DEVNULL, stderr=DEVNULL)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user