aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2020-01-08 22:44:30 +0100
committerLuca Deri <deri@ntop.org>2020-01-08 22:44:30 +0100
commit498b34621945237c462ad7302b129bb6cacc846b (patch)
treef75f10ca92eaf99d54cd71d3f2d2d5e57cccfbed /utils
parent3e66bbc5bc0b46fcd456f9f0b75d66a2615fea98 (diff)
Added bootstrap ethereum nodes
Diffstat (limited to 'utils')
-rwxr-xr-xutils/toripaddr2list.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/utils/toripaddr2list.py b/utils/toripaddr2list.py
index 47c5412e5..0257e4098 100755
--- a/utils/toripaddr2list.py
+++ b/utils/toripaddr2list.py
@@ -9,12 +9,18 @@ if len (sys.argv) != 2 :
with open(sys.argv[1]) as fp:
for cnt, line in enumerate(fp):
- x = line.rstrip().split("/")
- ipaddr = x[0]
- cidr = x[1]
-
- if(cidr == None):
- cidr = "32"
+ line = line.rstrip()
- print(" { 0x"+socket.inet_aton(ipaddr).hex().upper()+" /* "+ipaddr+"/"+cidr+" */, "+cidr+", NDPI_PROTOCOL_XYX },")
+ if(line != ""):
+ x = line.split("/")
+
+ if(len(x) == 2):
+ ipaddr = x[0]
+ cidr = x[1]
+ else:
+ ipaddr = line
+ cidr = "32"
+
+ if(ipaddr != ""):
+ print(" { 0x"+socket.inet_aton(ipaddr).hex().upper()+" /* "+ipaddr+"/"+cidr+" */, "+cidr+", NDPI_PROTOCOL_XYX },")