Skip to content

Commit

Permalink
Revert "External sshpass command now supports complex passwords"
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-lancini committed Jul 26, 2018
1 parent f48f8a3 commit c4db8aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions needle/core/device/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def cleanup(self):

def shell(self):
"""Spawn a system shell on the device."""
cmd = 'sshpass -p \'{password}\' ssh {hostverification} -p {port} {username}@{ip}'.format(password=self._password,
cmd = 'sshpass -p "{password}" ssh {hostverification} -p {port} {username}@{ip}'.format(password=self._password,
hostverification=Constants.DISABLE_HOST_VERIFICATION,
port=self._port,
username=self._username,
Expand All @@ -259,4 +259,4 @@ def pull(self, src, dst):
def push(self, src, dst):
"""Push a file on the device."""
self.printer.info("Pushing: %s -> %s" % (src, dst))
self.remote_op.upload(src, dst)
self.remote_op.upload(src, dst)
8 changes: 4 additions & 4 deletions needle/core/device/remote_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def command_blocking(self, cmd, internal=True):
def command_interactive(self, cmd):
"""Run a command which requires an interactive shell."""
self._device.printer.debug("[REMOTE CMD] Remote Interactive Command: %s" % cmd)
cmd = 'sshpass -p \'{password}\' ssh {hostverification} -p {port} -t {username}@{ip} "{cmd}"'.format(password=self._device._password,
cmd = 'sshpass -p "{password}" ssh {hostverification} -p {port} -t {username}@{ip} "{cmd}"'.format(password=self._device._password,
hostverification=Constants.DISABLE_HOST_VERIFICATION,
port=self._device._port,
username=self._device._username,
Expand All @@ -111,7 +111,7 @@ def command_interactive(self, cmd):
def command_interactive_tty(self, cmd):
"""Run a command in a full TTY shell."""
self._device.printer.debug("[REMOTE CMD] Remote Interactive TTY Command: %s" % cmd)
cmd = 'sshpass -p \'{password}\' ssh {hostverification} -p {port} -t {username}@{ip} "{cmd}"'.format(password=self._device._password,
cmd = 'sshpass -p "{password}" ssh {hostverification} -p {port} -t {username}@{ip} "{cmd}"'.format(password=self._device._password,
hostverification=Constants.DISABLE_HOST_VERIFICATION,
port=self._device._port,
username=self._device._username,
Expand Down Expand Up @@ -164,7 +164,7 @@ def download(self, src, dst, recursive=False):
src, dst = Utils.escape_path_scp(src), Utils.escape_path(dst)
self._device.printer.debug("Downloading: %s -> %s" % (src, dst))

cmd = 'sshpass -p \'{password}\' scp {hostverification} -P {port}'.format(password=self._device._password,
cmd = 'sshpass -p "{password}" scp {hostverification} -P {port}'.format(password=self._device._password,
hostverification=Constants.DISABLE_HOST_VERIFICATION,
port=self._device._port)
if recursive: cmd += ' -r'
Expand All @@ -179,7 +179,7 @@ def upload(self, src, dst, recursive=True):
src, dst = Utils.escape_path_scp(src), Utils.escape_path_scp(dst)
self._device.printer.debug("Uploading: %s -> %s" % (src, dst))

cmd = 'sshpass -p \'{password}\' scp {hostverification} -P {port}'.format(password=self._device._password,
cmd = 'sshpass -p "{password}" scp {hostverification} -P {port}'.format(password=self._device._password,
hostverification=Constants.DISABLE_HOST_VERIFICATION,
port=self._device._port)
if recursive: cmd += ' -r'
Expand Down

0 comments on commit c4db8aa

Please sign in to comment.