summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2014-02-13 09:48:51 +0200
committerFilipp Lepalaan <f@230.to>2014-02-13 09:48:51 +0200
commitb512e81120bb79bb60e8fad116ffbfac3d268acc (patch)
treec78b55683e731a8c38da708f2e922bd9eed79715
downloadintercheck-b512e81120bb79bb60e8fad116ffbfac3d268acc.tar.gz
intercheck-b512e81120bb79bb60e8fad116ffbfac3d268acc.tar.bz2
intercheck-b512e81120bb79bb60e8fad116ffbfac3d268acc.zip
Initial commit
-rw-r--r--app.py30
-rw-r--r--index.html19
2 files changed, 49 insertions, 0 deletions
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 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>intercheck 0.001</title>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
+ <style type="text/css">
+ body {
+
+ }
+ </style>
+</head>
+<body>
+{% block main %}
+ <form method="post" action="/scan/">
+ <button type="submit">Go!</button>
+ </form>
+{% end %}
+</body>
+</html>