[paramiko] scp not sftp
Rafael Ugolini
rafael.ugolini at vexcorp.com
Mon May 21 14:11:20 PDT 2007
Hi,
I'm trying to use "scp" with paramiko to use with some old SSH version (v1).
In SSHv1 scp work like this:
1. you open a connection to the remote host
2. create the channel
3. exec scp -t filename
4. send file info, eg. (C0664 SIZE 1\n)
5. send data
How do you guys think I can do this ?
I did 2 methods and i failed with both.
####### This one it stay on the first send
def sendfile(self, path):
chan = self._trans.open_session()
chan.set_combine_stderr(True)
f = file(path)
print "send exec"
chan.recv(1024)
chan.send("execscp -v -t %s" % )
chan.recv(1024)
print "send mode and data"
chan.send("C0664 %d 1\n" % os.stat(path)[6])
chan.send("%s" % f.read())
print "close"
chan.close()
f.close()
####### Simple doesn't work
def sendfile(self, path):
chan = self._trans.open_session()
chan.set_combine_stderr(True)
f = file(path)
print "send exec"
chan.exec_command("scp -v -t %s" % )
chan.recv(1024)
print "send mode and data"
chan.send("C0664 %d 1\n" % os.stat(path)[6])
chan.send("%s" % f.read())
print "close"
chan.close()
f.close()
Thanks,
Rafael Ugolini
More information about the paramiko
mailing list