2018-04-16 12:50:04 +00:00
|
|
|
#!/usr/bin/env python3.5
|
2017-11-28 08:46:06 +00:00
|
|
|
# -*- 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)
|
|
|
|
|
2018-04-16 12:50:04 +00:00
|
|
|
topicfilter = b"102"
|
2017-11-28 08:46:06 +00:00
|
|
|
socket.setsockopt(zmq.SUBSCRIBE, topicfilter)
|
2018-04-16 12:50:04 +00:00
|
|
|
print('b0')
|
2017-11-28 08:46:06 +00:00
|
|
|
while True:
|
|
|
|
message = socket.recv()
|
2018-04-16 12:50:04 +00:00
|
|
|
print('b1')
|
2017-11-28 08:46:06 +00:00
|
|
|
print (message)
|
2018-04-16 12:50:04 +00:00
|
|
|
if topicfilter == b"102":
|
2017-11-28 08:46:06 +00:00
|
|
|
topic, paste, messagedata = message.split()
|
2018-04-16 12:50:04 +00:00
|
|
|
print(paste, messagedata)
|
2017-11-28 08:46:06 +00:00
|
|
|
else:
|
|
|
|
print (message)
|