-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiptool.py
47 lines (27 loc) · 840 Bytes
/
iptool.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import iptools
heystack = input ("Enter IPs/subnets/ranges (HeyStack):")
heystack = heystack.strip()
parts = heystack.split(",")
heystack = []
for part in parts:
if '-' in part:
r = part.split('-')
heystack.append((r[0],r[1]))
else:
heystack.append(part)
#keys = input ("Enter IPs/subnets/ranges (Key(s)):")
heystack = iptools.IpRangeList(*[line for line in heystack])
keys = input ("Enter IPs/subnets/ranges (Keys):")
keys = keys.strip()
parts = keys.split(",")
keys = []
for part in parts:
if '-' in part:
r = part.split('-')
keys.append((r[0],r[1]))
else:
keys.append(part)
keys = iptools.IpRangeList(*[line for line in keys])
for key in keys:
if key not in heystack:
print(key)