Révision e7fae17e
Ajouté par Thomas Noël il y a plus de 9 ans
usr/local/univnautes/sp/ipfw_context_list.py | ||
---|---|---|
1 |
#!/usr/bin/env python |
|
2 |
|
|
3 |
from socket import * |
|
4 |
IP_FW_CTX_GET = 95 |
|
5 |
s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW) |
|
6 |
buf = s.getsockopt(IPPROTO_IP, IP_FW_CTX_GET, 1000) |
|
7 |
for l in buf.split('\n'): |
|
8 |
ctx = l.strip().split(':')[0] |
|
9 |
if ctx: |
|
10 |
print ctx |
|
11 |
|
usr/local/univnautes/sp/update-whitelists.sh | ||
---|---|---|
56 | 56 |
tr -d ' ' | \ |
57 | 57 |
sed 's#\(^[^/]*$\)#\1/32#' > $WLDIR/all |
58 | 58 |
|
59 |
|
|
60 |
/usr/local/bin/php -q << EOPHP |
|
61 |
<?php |
|
62 |
|
|
63 |
require_once("functions.inc"); |
|
64 |
require_once("filter.inc"); |
|
65 |
require_once("shaper.inc"); |
|
66 |
|
|
67 |
\$wladdresses = ''; |
|
68 |
\$wlfile = file('$WLDIR/all', |
|
69 |
FILE_IGNORE_NEW_LINES + FILE_SKIP_EMPTY_LINES); |
|
70 |
foreach (\$wlfile as \$a) { |
|
71 |
\$wladdresses .= \$a . ' '; |
|
72 |
} |
|
73 |
|
|
74 |
if (!is_array(\$config['aliases']['alias'])) |
|
75 |
\$config['aliases']['alias'] = array(); |
|
76 |
\$a_aliases = &\$config['aliases']['alias']; |
|
77 |
|
|
78 |
foreach (\$a_aliases as \$n => \$alias) { |
|
79 |
if (\$alias['name'] == 'whitelist') { |
|
80 |
\$whitelist = &\$a_aliases[\$n]; |
|
81 |
break; |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
\$whitelist['address'] = \$wladdresses; |
|
86 |
\$whitelist['detail'] = ''; |
|
87 |
\$whitelist['descr'] = 'DO NOT MODIFY THIS LIST ! auto-updated @ ' . date('r'); |
|
88 |
|
|
89 |
if (write_config()) { |
|
90 |
filter_configure(); |
|
91 |
exit(0); |
|
92 |
} else { |
|
93 |
exit(1); |
|
94 |
} |
|
95 |
|
|
96 |
?> |
|
97 |
EOPHP |
|
59 |
# FIXME |
Formats disponibles : Unified diff
ipfw_context_list.py (just for the record)