Parameterise listening port and address
Uses tornado.options to `define` the port and ip address on which tai-server listens. Default options maintain current functionality (i.e. listen on 0.0.0.0:8889)pull/2/head
parent
af9764bee1
commit
14376c39c7
|
@ -1,12 +1,17 @@
|
||||||
|
|
||||||
import tornado.ioloop
|
import tornado.ioloop
|
||||||
import tornado.web
|
import tornado.web
|
||||||
|
|
||||||
from tornado.escape import json_decode, json_encode
|
from tornado.escape import json_decode, json_encode
|
||||||
|
from tornado.options import define, options
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
define('port', default=8889, help='port to listen on')
|
||||||
|
define('address', default='0.0.0.0', help='address to listen on')
|
||||||
|
|
||||||
class Query(tornado.web.RequestHandler):
|
class Query(tornado.web.RequestHandler):
|
||||||
|
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
|
@ -102,6 +107,6 @@ for threat_actor in threat_actors['values']:
|
||||||
tai_country[threat_actor['meta']['country'].lower()].append(threat_actor['uuid'])
|
tai_country[threat_actor['meta']['country'].lower()].append(threat_actor['uuid'])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
application.listen(8889)
|
tornado.options.parse_command_line()
|
||||||
|
application.listen(options.port, address=options.address)
|
||||||
tornado.ioloop.IOLoop.instance().start()
|
tornado.ioloop.IOLoop.instance().start()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue