summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2014-02-14 11:28:23 +0200
committerFilipp Lepalaan <f@230.to>2014-02-14 11:28:23 +0200
commit6c6e80216c7c8ba1840bf05672a82fa427b6acd8 (patch)
treeb861baca1173e4426fbf63c7c28cabcbbc7a86e5
parent4360585272f9c32913bee2b4b203e9588717ddbb (diff)
downloadintercheck-6c6e80216c7c8ba1840bf05672a82fa427b6acd8.tar.gz
intercheck-6c6e80216c7c8ba1840bf05672a82fa427b6acd8.tar.bz2
intercheck-6c6e80216c7c8ba1840bf05672a82fa427b6acd8.zip
Better
-rw-r--r--app.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/app.py b/app.py
index cca136c..ba29028 100644
--- a/app.py
+++ b/app.py
@@ -1,4 +1,6 @@
+import os
import re
+import sys
import logging
import sqlite3
import subprocess
@@ -6,19 +8,23 @@ import tornado.ioloop
import tornado.web
from tornado import template
+
+def initialize(self):
+ logging.debug('INITIALIZING')
+ conn = sqlite3.connect(":memory:")
+ cursor = conn.cursor()
+ cursor.execute('CREATE TABLE notes (kw text value text)')
+
+
class MainHandler(tornado.web.RequestHandler):
def initialize(self):
- self.loader = template.Loader('/Users/filipp/Projects/intercheck')
+ self.loader = template.Loader(os.path.dirname(__file__))
def get(self):
self.write(self.loader.load("index.html").generate())
class ScanHandler(tornado.web.RequestHandler):
- def initialize(self):
- conn = sqlite3.connect(":memory:")
- self.cursor = conn.cursor()
- self.cursor.execute('CREATE TABLE notes kw text value text')
def get(self):
commands = ('nmap', 'help', '?', '!',)
@@ -49,18 +55,15 @@ class ScanHandler(tornado.web.RequestHandler):
self.write(out)
-class HelpHandler(tornado.web.RequestHandler):
- def get(self):
- out = {'results': list()}
-
-
application = tornado.web.Application([
(r'/', MainHandler),
(r'/scan/', ScanHandler),
- (r'/help/', HelpHandler),
])
if __name__ == '__main__':
+ if 'init' in sys.argv:
+ initialize()
+
application.listen(8888)
logging.basicConfig(level=logging.DEBUG)
logging.debug('intercheck ready for action...')