diff options
author | Renan de Souza <renan.souza@setinet.com.br> | 2019-10-29 14:59:18 -0300 |
---|---|---|
committer | Renan de Souza <renan.souza@setinet.com.br> | 2019-10-29 14:59:18 -0300 |
commit | d619ba08572d1404970c04a0e65a39b75a69c78e (patch) | |
tree | 13af928b2399a0692383fdb3a7417a7b41cf9274 /utils/toripaddr2list.py | |
parent | fbea243e563abe0799307afa939514af56e1bff0 (diff) | |
parent | d2f04f5bdfe986082ca5e5f479a99e4c24a5a898 (diff) |
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'utils/toripaddr2list.py')
-rwxr-xr-x | utils/toripaddr2list.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/utils/toripaddr2list.py b/utils/toripaddr2list.py index 13cc8e1e6..47c5412e5 100755 --- a/utils/toripaddr2list.py +++ b/utils/toripaddr2list.py @@ -9,6 +9,12 @@ if len (sys.argv) != 2 : with open(sys.argv[1]) as fp: for cnt, line in enumerate(fp): - ipaddr = line.rstrip() - print(" { 0x"+socket.inet_aton(ipaddr).hex()+", /* "+ipaddr+" */, 32, NDPI_PROTOCOL_TOR },") + x = line.rstrip().split("/") + ipaddr = x[0] + cidr = x[1] + + if(cidr == None): + cidr = "32" + + print(" { 0x"+socket.inet_aton(ipaddr).hex().upper()+" /* "+ipaddr+"/"+cidr+" */, "+cidr+", NDPI_PROTOCOL_XYX },") |