mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 15:13:36 +00:00
Merge pull request #59 from onjin/master
Support to pass command with arguments to --cmd option
This commit is contained in:
@@ -36,7 +36,8 @@ tornado.options.define("more", default=False,
|
||||
tornado.options.define("host", default='localhost', help="Server host")
|
||||
tornado.options.define("port", default=57575, type=int, help="Server port")
|
||||
tornado.options.define("shell", help="Shell to execute at login")
|
||||
tornado.options.define("cmd", help="Command to run instead of shell")
|
||||
tornado.options.define("cmd",
|
||||
help="Command to run instead of shell, f.i.: 'ls -l'")
|
||||
tornado.options.define("unsecure", default=False,
|
||||
help="Don't use ssl not recommended")
|
||||
tornado.options.define("login", default=True,
|
||||
|
||||
@@ -191,12 +191,12 @@ class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
|
||||
'if you want to log as different user\n')
|
||||
sys.exit(1)
|
||||
|
||||
args = [
|
||||
tornado.options.options.cmd
|
||||
or tornado.options.options.shell or self.callee.shell
|
||||
]
|
||||
if not tornado.options.options.cmd:
|
||||
if tornado.options.options.cmd:
|
||||
args = tornado.options.options.cmd.split(' ')
|
||||
else:
|
||||
args = [tornado.options.options.shell or self.callee.shell]
|
||||
args.append('-i')
|
||||
|
||||
os.execvpe(args[0], args, env)
|
||||
# This process has been replaced
|
||||
|
||||
|
||||
Reference in New Issue
Block a user