SSH.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Skynet2.0 作者: Skynet2-0 项目源码 文件源码
def run(self, command):
        """
        Runs a command over SSH on the client.

        command -- the command to execute.
        Return a tuple of the stdin, stdout, and stderr of the executing command,
        as a 3-tuple.
        """
        (ins, out, err) = self.client.exec_command(command)
        if self.use_log:
            with open("Skynet.log", 'a') as file:
                file.write("executing command: %s\n" % command)
                file.write("%s\n" % out.read().decode('utf-8'))
                file.write("%s\n" % err.read().decode('utf-8'))
                file.write("Exit status: %i\n\n" % out.channel.recv_exit_status())
        return (ins, out, err)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号