#Plan: #Create a program where it will receive a string of data #That string will be added to a dictionary, with the ip attributes as its keys #simulate a filter. Like give it a shell script input with one of the attributes #And have it present the thingies... #check in Julios visualization what is presented when filtered import socket import argparse import sys import select import json parser = argparse.ArgumentParser() parser.add_argument('filter', type = str) args = parser.parse_args() soc = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #soc.setblocking(0) soc.bind(('localhost', 2702)) temp = 1 num = 0 filterArray = [] soc.settimeout(5) while temp: print ("waiting to receive message") num = num + 1 #ready = select.select([soc], [], [], timeout_in_seconds) try: data, address = soc.recvfrom(2702) print "\nreceived %s message" %num newData = json.loads(data) except socket.error: print "\nNo message to receive, leave loop" temp = 0 for k, v in newData.items(): if k == args.filter: print k filterArray.append(v) print filterArray