From b512e81120bb79bb60e8fad116ffbfac3d268acc Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Thu, 13 Feb 2014 09:48:51 +0200 Subject: Initial commit --- app.py | 30 ++++++++++++++++++++++++++++++ index.html | 19 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 app.py create mode 100644 index.html diff --git a/app.py b/app.py new file mode 100644 index 0000000..b5c092a --- /dev/null +++ b/app.py @@ -0,0 +1,30 @@ +import re +import subprocess +import tornado.ioloop +import tornado.web +from tornado import template + +class MainHandler(tornado.web.RequestHandler): + def initialize(self): + self.loader = template.Loader('/Users/filipp/Projects/intercheck') + + def get(self): + self.write(self.loader.load("index.html").generate()) + + +class ScanHandler(tornado.web.RequestHandler): + def get(self): + result = subprocess.check_output(['nmap', self.request.remote_ip]) + for r in re.finditer(r'(\d+/[a-z]{3})\s([a-z]+)\s+(.+)', result): + t = r.groups() + self.write({'port': t[0], 'state': t[1], 'service': t[2]}) + + +application = tornado.web.Application([ + (r'/', MainHandler), + (r'/scan/', ScanHandler), +]) + +if __name__ == '__main__': + application.listen(8888) + tornado.ioloop.IOLoop.instance().start() diff --git a/index.html b/index.html new file mode 100644 index 0000000..89cb1f5 --- /dev/null +++ b/index.html @@ -0,0 +1,19 @@ + + + + intercheck 0.001 + + + + +{% block main %} +
+ +
+{% end %} + + -- cgit v1.2.3