-
Notifications
You must be signed in to change notification settings - Fork 221
/
main.py
52 lines (38 loc) · 1.15 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
__author__ = 'xsank'
import os.path
import tornado.ioloop
import tornado.web
import tornado.httpserver
import tornado.options
from tornado.options import options
from config import init_config
from urls import handlers
from ioloop import IOLoop
settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
)
class Application(tornado.web.Application):
def __init__(self):
tornado.web.Application.__init__(self, handlers, **settings)
def welcome(port):
print('''
Welcome to the webssh!
__ __
_ _____ / /_ __________/ /_
| | /| / / _ \/ __ \/ ___/ ___/ __ \\
| |/ |/ / __/ /_/ (__ |__ ) / / /
|__/|__/\___/_.___/____/____/_/ /_/
Now start~
Please visit the localhost:%s from the explorer~
''' % port)
def main():
init_config()
options.parse_config_file("webssh.conf")
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
IOLoop.instance().start()
welcome(options.port)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()