【问题标题】:Recording SSH sessions on linux using Python [closed]使用 Python 在 Linux 上记录 SSH 会话 [关闭]
【发布时间】:2014-12-20 15:47:13
【问题描述】:

我需要使用 Python 记录 Linux 中的所有 SSH 活动。 python中是否有关于如何捕获整个远程SSH会话的示例?

我需要捕获它们并存储它们。

我将不胜感激。

谢谢, 莎拉

【问题讨论】:

  • 你想记录什么样的活动?您要记录传出连接还是传入连接?
  • 不,我想记录在终端/控制台和 SSH 上键入的所有内容

标签: python ssh


【解决方案1】:

试试script。它是一个内置的 Linux 命令,可将交互式控制台上发生的所有事情记录到一个文件中。

用法很简单:script [log filename] [command] [args...]。举个例子:

$ script ssh_log ssh remotehost
Script started, output file is ssh_log
remotehost:~$ logout
Script done, output file is ssh_log
$ cat ssh_log
remotehost:~$ logout

【讨论】:

  • 谢谢你这个......但我需要在 python 中使用这个,因为我需要对存储的数据进行加密。
猜你喜欢
  • 2017-01-28
  • 2013-10-21
  • 1970-01-01
  • 1970-01-01
  • 2014-05-11
  • 2017-04-07
  • 1970-01-01
  • 1970-01-01
  • 2016-01-06
相关资源
最近更新 更多