Merge pull request #2 from DocArmoryTech/DocArmoryTech-options

Parameterise listening port and address
main
Alexandre Dulaunoy 2020-11-03 13:19:35 +01:00 committed by GitHub
commit a1c96ff1a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -1,12 +1,17 @@
import tornado.ioloop
import tornado.web
from tornado.escape import json_decode, json_encode
from tornado.options import define, options
import os.path
import sys
import json
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):
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'])
if __name__ == "__main__":
application.listen(8889)
tornado.options.parse_command_line()
application.listen(options.port, address=options.address)
tornado.ioloop.IOLoop.instance().start()