def __init__(self, parent):
"""
This module will communicate via RPC
with RabbitMQ and ultimately with
our fuzzing server
"""
self.parent = parent
self.ae = parent.ae
self.cfg = parent.cfg
host = self.cfg.get('server_info', 'host')
credentials = pika.PlainCredentials(
self.cfg.get('server_info', 'user'),
self.cfg.get('server_info', 'pass'))
try:
self.connection = pika.BlockingConnection(pika.ConnectionParameters(
host = host,
credentials = credentials,
retry_delay = 10,
connection_attempts = 5))
self.ae.m_ok("Connected to server (broker): %s" % host)
except Exception as e:
self.ae.m_fatal("Could not connect to server")
self.ae.m_fatal(e)
self.channel = self.connection.channel()
result = self.channel.queue_declare(exclusive = True)
self.callback_queue = result.method.queue
self.channel.basic_consume(self.on_response, no_ack = True,
queue = self.callback_queue)
评论列表
文章目录