Skip to content
Snippets Groups Projects
  • Ramin Yaghoubzadeh's avatar
    b3d33372
    Updated ipaaca helper scripts: · b3d33372
    Ramin Yaghoubzadeh authored
    ipaaca-iu-sniffer optionally takes a list of category arguments
    (if not specified, it still listens for everything).
    ipaaca-iu-injector needs to be provided with a category name
    and, optionally, with key-value pairs for the payload, as such:
    $ ipaaca-iu-injector  murmlfile  data  smile_3sec.us
    b3d33372
    History
    Updated ipaaca helper scripts:
    Ramin Yaghoubzadeh authored
    ipaaca-iu-sniffer optionally takes a list of category arguments
    (if not specified, it still listens for everything).
    ipaaca-iu-injector needs to be provided with a category name
    and, optionally, with key-value pairs for the payload, as such:
    $ ipaaca-iu-injector  murmlfile  data  smile_3sec.us
ipaaca-iu-sniffer.py 545 B
#!/usr/bin/env python

import time
import logging
import ipaaca
import sys

def my_update_handler(iu, event_type, local):
	t=time.localtime()
	print str(t.tm_hour)+':'+str(t.tm_min)+':'+str(t.tm_sec),
	print(event_type+': '+unicode(iu))

cats = []
if len(sys.argv)>1:
	cats = sys.argv[1:]

ib = ipaaca.InputBuffer('SnifferIn', [''] if len(cats)==0 else cats)
ib.register_handler(my_update_handler)

print("Listening for IU events of "+("any category..." if len(cats)==0 else "categories: "+' '.join(cats)))
print('')
while True:
	time.sleep(1)