Permalink
Browse files

add a template for using hpfeeds.py

  • Loading branch information...
1 parent b8d5cd5 commit d8eabb2b04e42c3c69a8ed4c89dff8f3580fdf55 @rep committed Aug 10, 2012
Showing with 40 additions and 0 deletions.
  1. +40 −0 cli/template.py
View
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+#
+# this will grab just the binary payload and write it to $filedir/md5sum
+
+import os
+import sys
+import datetime
+import json
+import hashlib
+import logging
+logging.basicConfig(level=logging.WARNING)
+
+import hpfeeds
+
+HOST = '192.168.168.113'
+PORT = 10000
+CHANNELS = ['dionaea.shellcodeprofiles', 'dionaea.capture', 'thug.events', ]
+IDENT = 'ident'
+SECRET = 'secret'
+
+def main():
+ hpc = hpfeeds.new(HOST, PORT, IDENT, SECRET)
+ print >>sys.stderr, 'connected to', hpc.brokername
+
+ def on_message(identifier, channel, payload):
+ print 'msg', identifier, channel, payload
+
+ def on_error(payload):
+ print >>sys.stderr, ' -> errormessage from server: {0}'.format(payload)
+ hpc.stop()
+
+ hpc.subscribe(CHANNELS)
+ hpc.run(on_message, on_error)
+ hpc.close()
+ return 0
+
+if __name__ == '__main__':
+ try: sys.exit(main())
+ except KeyboardInterrupt:sys.exit(0)
+

0 comments on commit d8eabb2

Please sign in to comment.