Обновлён вывод тестирования

master
FiliN 2 years ago
parent f5b4d804ca
commit 75cb8ef0ea
  1. 8
      mikrotik.py
  2. 44
      route.txt
  3. 6
      subnets.py

@ -0,0 +1,8 @@
import sys
for prefix in sys.stdin:
prefix = prefix.strip('\n')
print(prefix)
print('/ip route')
print('add comment=rnic92 distance=1 dst-address=185.71.81.144/29 gateway=195.123.208.1')

@ -0,0 +1,44 @@
1.0.0.0/8
96.0.0.0/5
108.0.0.0/6
8.0.0.0/5
176.0.0.0/5
16.0.0.0/5
2.0.0.0/7
32.0.0.0/4
50.0.0.0/7
52.0.0.0/8
54.0.0.0/7
56.0.0.0/5
160.0.0.0/4
184.0.0.0/6
192.0.0.0/4
104.0.0.0/8
64.0.0.0/3
4.0.0.0/7
128.0.0.0/3
188.0.0.0/8
212.0.0.0/7
112.0.0.0/5
124.0.0.0/7
190.0.0.0/7
208.0.0.0/6
216.0.0.0/5
28.0.0.0/6
106.0.0.0/7
26.0.0.0/7
120.0.0.0/6
126.0.0.0/8
215.0.0.0/8
226.0.0.0/7
228.0.0.0/7
230.0.0.0/8
235.0.0.0/8
239.0.0.0/8
243.0.0.0/8
245.0.0.0/8
248.0.0.0/6
253.0.0.0/8
254.0.0.0/7
49.0.0.0/8
6.0.0.0/8

@ -9,9 +9,9 @@ parser.add_argument('-s', '--summask', type=int, help='Суммаризация
args = parser.parse_args()
def read_ips():
prefixes = {}
ip_cnt,prefixes = 0, {}
for line in sys.stdin:
line = line.strip('\n')
line, ip_cnt = line.strip('\n'), ip_cnt + 1
try:
if ipaddress.ip_network(line) or ipaddress.ip_address(line):
prefix = ipaddress.ip_network(line).network_address.compressed
@ -23,6 +23,8 @@ def read_ips():
prefixes[prefix] = prefixlen
except ValueError:
continue #bad subnet address
if args.test:
print('{} IP/Net -> stdin'.format(ip_cnt))
return prefixes

Loading…
Cancel
Save