Commit 8770bf0 1 parent 4d8db3f commit 8770bf0 Copy full SHA for 8770bf0
File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 6
6
7
7
This module is consuming the global channel.
8
8
9
- It first performs a regex to find IP addresses and then matches those IPs to
9
+ It first performs a regex to find IP addresses and then matches those IPs to
10
10
some configured ip ranges.
11
11
12
12
The list of IP ranges are expected to be in CIDR format (e.g. 192.168.0.0/16)
16
16
17
17
import time
18
18
import re
19
+ import sys
19
20
from pubsublogger import publisher
20
21
from packages import Paste
21
22
from Helper import Process
@@ -60,8 +61,12 @@ def search_ip(message):
60
61
p = Process (config_section )
61
62
62
63
ip_networks = []
63
- for network in p .config .get ("IP" , "networks" ).split ("," ):
64
- ip_networks .append (IPv4Network (network ))
64
+ try :
65
+ for network in p .config .get ("IP" , "networks" ).split ("," ):
66
+ ip_networks .append (IPv4Network (network ))
67
+ except :
68
+ print ('Please provide a list of valid IP addresses' )
69
+ sys .exit (0 )
65
70
66
71
67
72
# Sent to the logging a description of the module
@@ -78,4 +83,3 @@ def search_ip(message):
78
83
79
84
# Do something with the message from the queue
80
85
search_ip (message )
81
-
You can’t perform that action at this time.
0 commit comments