Python으로 쓸 수 있는 최강 간단한 SSH 모듈. (paramiko가 필요함)
이것보다 간단할 수가 있을까...

import ssh

# 연결
s
= ssh.Connection('example.com')

# 파일 보내기
s.put('hello.txt')

# 파일 받기
s.get('goodbye.txt')

# 명령어 실행
s.execute('du -h --max-depth=0')

s.close()


참고http://commandline.org.uk/code/#sshpy

사용예제 : http://commandline.org.uk/python/sftp-python-really-simple-ssh/ 
(사용자들의 댓글에 추가사항이나 그런게 있어서 보는게 좋을 듯...)

소스파일 : http://media.commandline.org.uk//code/ssh.txt




로그방식이나 그런 걸 위해서 내부소스 수정은 약간 해야할 듯.
아니면 자기한테 딱 맞게 한 번 더 wrapping 하던지...




'Python' 카테고리의 다른 글

paramiko 설치  (0) 2009.10.09
[Python] PostgreSQL 사용하기  (0) 2009.10.05
[Python] Queue, Stack  (2) 2009.10.05
[Python] multi-thread에 queue 이용하기  (0) 2009.10.05
[Python] threading 객체사용  (5) 2009.10.05
Posted by bloodguy
,