mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-23 06:37:15 +00:00
Cleanup.
* Remove useless subscriber * Fix typo in the config file * Update Helper accordingly
This commit is contained in:
parent
d7a7da4814
commit
623e876f3b
22 changed files with 10 additions and 45 deletions
|
@ -31,6 +31,7 @@ class Redis_Queues(object):
|
||||||
self.subscriber_name = subscriber_name
|
self.subscriber_name = subscriber_name
|
||||||
|
|
||||||
self.sub_channel = self.config.get(conf_section, conf_channel)
|
self.sub_channel = self.config.get(conf_section, conf_channel)
|
||||||
|
self.sub_address = self.config.get(conf_section, 'address')
|
||||||
self.redis_channel = self.sub_channel + self.subscriber_name
|
self.redis_channel = self.sub_channel + self.subscriber_name
|
||||||
|
|
||||||
# Redis Queue
|
# Redis Queue
|
||||||
|
@ -40,11 +41,10 @@ class Redis_Queues(object):
|
||||||
port=self.config.getint(config_section, "port"),
|
port=self.config.getint(config_section, "port"),
|
||||||
db=self.config.getint(config_section, "db"))
|
db=self.config.getint(config_section, "db"))
|
||||||
|
|
||||||
def zmq_sub(self, conf_section):
|
def zmq_sub(self):
|
||||||
sub_address = self.config.get(conf_section, 'adress')
|
|
||||||
context = zmq.Context()
|
context = zmq.Context()
|
||||||
self.sub_socket = context.socket(zmq.SUB)
|
self.sub_socket = context.socket(zmq.SUB)
|
||||||
self.sub_socket.connect(sub_address)
|
self.sub_socket.connect(self.sub_address)
|
||||||
self.sub_socket.setsockopt(zmq.SUBSCRIBE, self.sub_channel)
|
self.sub_socket.setsockopt(zmq.SUBSCRIBE, self.sub_channel)
|
||||||
|
|
||||||
def zmq_pub(self, config_section, config_channel):
|
def zmq_pub(self, config_section, config_channel):
|
||||||
|
@ -74,6 +74,7 @@ class Redis_Queues(object):
|
||||||
return self.r_queues.srem('SHUTDOWN_FLAGS', flag)
|
return self.r_queues.srem('SHUTDOWN_FLAGS', flag)
|
||||||
|
|
||||||
def redis_queue_subscribe(self, publisher):
|
def redis_queue_subscribe(self, publisher):
|
||||||
|
self.zmq_sub()
|
||||||
publisher.info("Suscribed to channel {}".format(self.sub_channel))
|
publisher.info("Suscribed to channel {}".format(self.sub_channel))
|
||||||
while True:
|
while True:
|
||||||
msg = self.sub_socket.recv()
|
msg = self.sub_socket.recv()
|
||||||
|
|
|
@ -34,5 +34,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'feed'
|
subscriber_name = 'feed'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -32,5 +32,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'categ'
|
subscriber_name = 'categ'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -48,9 +48,6 @@ if __name__ == "__main__":
|
||||||
pub_config_section = 'PubSub_Longlines'
|
pub_config_section = 'PubSub_Longlines'
|
||||||
h.zmq_pub(pub_config_section, None)
|
h.zmq_pub(pub_config_section, None)
|
||||||
|
|
||||||
# Subscriber
|
|
||||||
h.zmq_sub(config_section)
|
|
||||||
|
|
||||||
# SCRIPT PARSER #
|
# SCRIPT PARSER #
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='''This script is a part of the Analysis Information \
|
description='''This script is a part of the Analysis Information \
|
||||||
|
|
|
@ -31,5 +31,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'line'
|
subscriber_name = 'line'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -32,5 +32,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'tokenize'
|
subscriber_name = 'tokenize'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -42,9 +42,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
|
|
||||||
# Subscriber
|
|
||||||
h.zmq_sub(config_section)
|
|
||||||
|
|
||||||
# FUNCTIONS #
|
# FUNCTIONS #
|
||||||
publisher.info("""ZMQ Attribute is Running""")
|
publisher.info("""ZMQ Attribute is Running""")
|
||||||
|
|
||||||
|
|
|
@ -32,5 +32,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'attributes'
|
subscriber_name = 'attributes'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -18,9 +18,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
|
|
||||||
# Subscriber
|
|
||||||
h.zmq_sub(config_section)
|
|
||||||
|
|
||||||
# FUNCTIONS #
|
# FUNCTIONS #
|
||||||
publisher.info("Creditcard script subscribed to channel creditcard_categ")
|
publisher.info("Creditcard script subscribed to channel creditcard_categ")
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'cards'
|
subscriber_name = 'cards'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -41,9 +41,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
|
|
||||||
# Subscriber
|
|
||||||
h.zmq_sub(config_section)
|
|
||||||
|
|
||||||
# REDIS #
|
# REDIS #
|
||||||
r_serv1 = redis.StrictRedis(
|
r_serv1 = redis.StrictRedis(
|
||||||
host=h.config.get("Redis_Level_DB", "host"),
|
host=h.config.get("Redis_Level_DB", "host"),
|
||||||
|
|
|
@ -32,5 +32,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'curve'
|
subscriber_name = 'curve'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -31,9 +31,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
|
|
||||||
# Subscriber
|
|
||||||
h.zmq_sub(config_section)
|
|
||||||
|
|
||||||
# REDIS #
|
# REDIS #
|
||||||
# DB OBJECT & HASHS ( DISK )
|
# DB OBJECT & HASHS ( DISK )
|
||||||
# FIXME increase flexibility
|
# FIXME increase flexibility
|
||||||
|
|
|
@ -14,5 +14,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'duplicate'
|
subscriber_name = 'duplicate'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -26,5 +26,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'indexer'
|
subscriber_name = 'indexer'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -21,9 +21,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
|
|
||||||
# Subscriber
|
|
||||||
h.zmq_sub(config_section)
|
|
||||||
|
|
||||||
# REDIS #
|
# REDIS #
|
||||||
r_serv2 = redis.StrictRedis(
|
r_serv2 = redis.StrictRedis(
|
||||||
host=h.config.get("Redis_Cache", "host"),
|
host=h.config.get("Redis_Cache", "host"),
|
||||||
|
|
|
@ -14,5 +14,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'emails'
|
subscriber_name = 'emails'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -39,9 +39,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
|
|
||||||
# Subscriber
|
|
||||||
h.zmq_sub(config_section)
|
|
||||||
|
|
||||||
# FUNCTIONS #
|
# FUNCTIONS #
|
||||||
publisher.info("Script subscribed to channel onion_categ")
|
publisher.info("Script subscribed to channel onion_categ")
|
||||||
|
|
||||||
|
|
|
@ -31,5 +31,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'tor'
|
subscriber_name = 'tor'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -31,9 +31,6 @@ if __name__ == "__main__":
|
||||||
pub_config_channel = 'channel'
|
pub_config_channel = 'channel'
|
||||||
h.zmq_pub(pub_config_section, pub_config_channel)
|
h.zmq_pub(pub_config_section, pub_config_channel)
|
||||||
|
|
||||||
# Subscriber
|
|
||||||
h.zmq_sub(config_section)
|
|
||||||
|
|
||||||
# REDIS #
|
# REDIS #
|
||||||
r_serv2 = redis.StrictRedis(
|
r_serv2 = redis.StrictRedis(
|
||||||
host=h.config.get("Redis_Cache", "host"),
|
host=h.config.get("Redis_Cache", "host"),
|
||||||
|
|
|
@ -15,5 +15,4 @@ if __name__ == "__main__":
|
||||||
subscriber_name = 'urls'
|
subscriber_name = 'urls'
|
||||||
|
|
||||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||||
h.zmq_sub(config_section)
|
|
||||||
h.redis_queue_subscribe(publisher)
|
h.redis_queue_subscribe(publisher)
|
||||||
|
|
|
@ -38,31 +38,31 @@ db = 1
|
||||||
|
|
||||||
# PUB / SUB : ZMQ
|
# PUB / SUB : ZMQ
|
||||||
[Feed]
|
[Feed]
|
||||||
adress = tcp://crf.circl.lu:5556
|
address = tcp://crf.circl.lu:5556
|
||||||
topicfilter = 102
|
topicfilter = 102
|
||||||
|
|
||||||
[PubSub_Global]
|
[PubSub_Global]
|
||||||
adress = tcp://127.0.0.1:5000
|
address = tcp://127.0.0.1:5000
|
||||||
channel = filelist
|
channel = filelist
|
||||||
|
|
||||||
[PubSub_Longlines]
|
[PubSub_Longlines]
|
||||||
adress = tcp://127.0.0.1:5001
|
address = tcp://127.0.0.1:5001
|
||||||
channel_0 = Longlines
|
channel_0 = Longlines
|
||||||
channel_1 = Shortlines
|
channel_1 = Shortlines
|
||||||
|
|
||||||
[PubSub_Words]
|
[PubSub_Words]
|
||||||
adress = tcp://127.0.0.1:5002
|
address = tcp://127.0.0.1:5002
|
||||||
channel_0 = words
|
channel_0 = words
|
||||||
|
|
||||||
[PubSub_Categ]
|
[PubSub_Categ]
|
||||||
adress = tcp://127.0.0.1:5003
|
address = tcp://127.0.0.1:5003
|
||||||
channel_0 = creditcard_categ
|
channel_0 = creditcard_categ
|
||||||
channel_1 = mails_categ
|
channel_1 = mails_categ
|
||||||
channel_2 = onion_categ
|
channel_2 = onion_categ
|
||||||
channel_3 = web_categ
|
channel_3 = web_categ
|
||||||
|
|
||||||
[PubSub_Url]
|
[PubSub_Url]
|
||||||
adress = tcp://127.0.0.1:5004
|
address = tcp://127.0.0.1:5004
|
||||||
channel = urls
|
channel = urls
|
||||||
# country code logged as critical
|
# country code logged as critical
|
||||||
cc_critical = DE
|
cc_critical = DE
|
||||||
|
|
Loading…
Reference in a new issue