Commit 8c350a26 authored by Bogdan Bodnar's avatar Bogdan Bodnar

Use shutil.which for dynamic searching location of sshpass

parent caff5009
"""
Implementation of SSH proxy using Twisted.
"""
try:
from shutil import which
except ImportError:
from shutilwhich import which
import fcntl
import json
......@@ -44,6 +48,7 @@ class SSHConnection(SSHConnectionTwisted):
"""
Overridden SSHConnection for disabling logs a traceback about a failed direct-tcpip connections
"""
# pylint: disable=invalid-name,inconsistent-return-statements
def ssh_CHANNEL_OPEN(self, packet):
# pylint: disable=unbalanced-tuple-unpacking
......@@ -169,7 +174,7 @@ class ProxySSHSession(SSHSessionForUnixConchUser):
# pylint: disable=no-member
self.pty = reactor.spawnProcess(
proto,
executable='/usr/bin/sshpass',
executable=which('sshpass'),
args=self.honeypot_ssh_arguments,
env=self.environ,
path='/',
......@@ -191,7 +196,7 @@ class ProxySSHSession(SSHSessionForUnixConchUser):
# pylint: disable=no-member
self.pty = reactor.spawnProcess(
proto,
executable='/usr/bin/sshpass',
executable=which('sshpass'),
args=self.honeypot_ssh_arguments + [cmd],
env=self.environ,
path='/',
......
......@@ -31,6 +31,7 @@ setup(
'twisted[conch]>={}'.format(TWISTED_VERSION),
'requests',
'cachetools',
'shutilwhich;python_version<="2.7"',
],
extras_require={
'test': EXTRA_TEST_REQUIRE,
......
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