forked from miho030/Fox_CNFilter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FUCK_CN.py
29 lines (25 loc) · 844 Bytes
/
FUCK_CN.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
"""
CopyRight By 2019, Made by Nicht
> OpenSource GNU GPL.Ver3
"""
import os
cidr_old = ''
cidr_new = 'CN_ipv4-190420.txt'
number = 1
if cidr_old:
with open(cidr_old) as f:
for i, line in enumerate(f, start=1):
if not line.startswith('#') or not line.strip():
print('{} = {}'.format(i, line.strip()))
os.system('ufw delete deny from {} to any'.format(line.strip()))
else:
print('file not specified')
if cidr_new:
with open(cidr_new) as f:
for i, line in enumerate(f, start=1):
if not line.startswith('#') or not line.strip():
print('{} = {}'.format(i, line.strip()))
os.system('ufw insert {} deny from {} to any'.format(number, line.strip()))
else:
print('file not specified')