mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-27 00:07:16 +00:00
add: Python script to test if the ZMQ feed works as expected
This commit is contained in:
parent
e3fc5f2fba
commit
71922f9def
1 changed files with 32 additions and 0 deletions
32
bin/feeder/test-zmq.py
Normal file
32
bin/feeder/test-zmq.py
Normal file
|
@ -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)
|
Loading…
Reference in a new issue