Commit 9293ba4e authored by Michal Čihař's avatar Michal Čihař

Support executing commands directly

This correctly handles direct execution of commands, for example
'ssh honeypot uname -a'.

Fixes #1
parent d2e7f4e2
......@@ -137,6 +137,23 @@ class ProxySSHSession(SSHSessionForUnixConchUser):
fcntl.ioctl(self.pty.fileno(), tty.TIOCSWINSZ, struct.pack('4H', *self.winSize))
self.avatar.conn.transport.transport.setTcpNoDelay(1)
# pylint: disable=invalid-name
def execCommand(self, proto, cmd):
"""
Custom implementation of exec - proxy to real SSH to honeypot.
"""
# pylint: disable=no-member
self.pty = reactor.spawnProcess(
proto,
executable='/usr/bin/sshpass',
args=self.honeypot_ssh_arguments + [cmd],
env=self.environ,
path='/',
uid=None,
gid=None,
usePTY=self.ptyTuple,
)
@property
def honeypot_ssh_arguments(self):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment