From 71922f9def5c635942d9f32ad5576f582935042d Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 28 Nov 2017 09:46:06 +0100 Subject: [PATCH] add: Python script to test if the ZMQ feed works as expected --- bin/feeder/test-zmq.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 bin/feeder/test-zmq.py diff --git a/bin/feeder/test-zmq.py b/bin/feeder/test-zmq.py new file mode 100644 index 00000000..2bedf3fe --- /dev/null +++ b/bin/feeder/test-zmq.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# This file is part of AIL framework - Analysis Information Leak framework +# +# +# Python script to test if the ZMQ feed works as expected +# + +import sys +import zmq + +port = "5556" + +context = zmq.Context() +socket = context.socket(zmq.SUB) +socket.connect ("tcp://crf.circl.lu:%s" % port) + +# 101 Name of the pastes only +# 102 Full pastes in raw base64(gz) + +topicfilter = "102" +socket.setsockopt(zmq.SUBSCRIBE, topicfilter) + +while True: + message = socket.recv() + print (message) + if topicfilter == "102": + topic, paste, messagedata = message.split() + print paste, messagedata + else: + print (message)