openssh-wrapper

OpenSSH Pythonラッパー
今すぐダウンロード

openssh-wrapper ランキングとまとめ

広告

  • Rating:
  • ライセンス:
  • BSD License
  • 出版社名:
  • NetAngels team
  • 出版社のWebサイト:
  • https://github.com/NetAngels/

openssh-wrapper タグ


openssh-wrapper 説明

OpenSSH Pythonラッパー 状況によっては、OpenSSH SSHコマンドラインユーティリティの周りのシンプルなラッパーがParamiko Machinery.OpenSSHラッパーよりも好ましいようです。 OpenSSHクライアントとPythonのインタプリタがインストールされていることを確認してから、OpenSSH-Wrapper Package.Usage SampleImpleコマンドの実行>>> OpenSSH_Wrapper Import SSHConnection >>> conn = sshconnection( 'localhost'、 'root') >>> Ret = conn.run( 'whoami')>>>印刷RetCommand:whoamistdout:rootstderr:returncode:0 >>> ret.command'whoami '>>> ret.stdout'root' >>> ret.stderr '' >>> ret.returnCode0if Pythonインタプリタはリモートマシンにインストールされているため、Pythonコードをリモートで実行することもできます。 Stdin >>> Ret = conn.run( 'whoami')>>> print conn.run( 'print "hello world"'、インタプリタ= '/ usr / binからのコードを実行できる他のインタプリタについても同様です。 /python'.stdouthello Worldyet world userful実行方法オプションはforward_ssh_agentです(Paramikoがまだ持っていない機能)。 root @ localhostがそうでない間にFoobarサーバーへのサポートとしてアクセスできるとしますので、SSHエージェント転送$ eval `ssh-agent`agent pid 5272 $ ssh-addidentity:/home/me/.ssh/id_rsaを利用できます。 (/home/ssh/id_rsa)$ python >>> conn = sshconnection( 'localhost'、 'root')>>> print conn.run( 'ssh support @ foobar "whoami"'、forward_ssh_agent = true ).stdoutsupportand最後に、ファイルをローカルからリモートマシンにコピーする方法を示すサンプルがあります>>> fd = open( 'test.txt'、 'w')>>> fd.write( 'Hello World')> >> fd.close()>>> OpenSSH_WrapperのインポートSSHConnection >>> conn = sshconnection( 'localhost'、 'root')>>> conn.scp( 'test.txt'、target = '/ tmp')> >> print conn.run( 'cat /tmp/test.txt'.stdouthello世界の要件: ・Python


openssh-wrapper 関連ソフトウェア