Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
paramiko.SSHClient.runscript = _ssh_runscript
def _pysftp_init(self, ssh):
self._sftp_live = True
self._transport = ssh.get_transport()
self._sftp = paramiko.SFTPClient.from_transport(self._transport)
def _put_dir(sftp, fr, to):
sftp.makedirs(to)
sftp.put_d(os.path.expanduser(fr), to)
def _put_key(sftp, name):
sftp.put(os.path.expanduser(f'~/.ssh/{name}'), f'.ssh/{name}')
sftp.chmod(f'.ssh/{name}', 600)
pysftp.Connection.__init__ = _pysftp_init
pysftp.Connection.put_dir = _put_dir
pysftp.Connection.put_key = _put_key
def interact(region=''):
os.execvp('ipython', ['ipython', '--autocall=2', '-ic',
f'import fastec2; e=fastec2.EC2("{region}")'])