资源简介
SecureCRT linux 远程连接工具
代码片段和文件信息
# $language = “python“
# $interface = “1.0“
# AddCommentToLogFile.py
#
# Description:
# This example script allows you to add a custom line of text to your
# SecureCRT log file. The user will be prompted for the text to add
# to the log file; logging will be stopped; the text provided by the
# user will be appended to the log file; then SecureCRT logging will
# be restarted.
#
# This method only works with connections associated with a Session
# configuration in which a log file is specified.
#
# Demonstrates:
# - How to prompt for user input using the SecureCRT InputBox() function.
# - How to access Session.LogFileName to determine the log file name
# stored for the current session.
# - How to use the Session.Logging property to determine if logging
# is currently active.
# - How to use the Python replace() method to substitute substrings
# within an existing string.
# - How to use the Python file object to open an existing text file
# and append data.
#
import datetime
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def Main():
# Make this script tab safe
tab = crt.GetscriptTab()
if tab.Session.LogFileName == ““ :
crt.Dialog.MessageBox(“Error.\n\n\
This script requires a session configuration in which a\
log file is defined.\n\n\
Specify a Log file name in Session Options ““Terminal\
Log File““ and run this script again.“)
return
# 1. Stop logging to free up the log file for writing by our script.
tab.Session.Log(False)
# 2. Prompt the user for the text to add to the log file.
now = str(datetime.datetime.now())
textToAdd = crt.Dialog.Prompt(
“Add comment to log file (use \\r\\n to separate multiple lines):\n\n\
(Comment will be prefaced with current timestamp: “ + now
“Add Comment To SecureCRT Log File\n“ + now + “: “)
# Prompt returns ““ if the user cancels
if textToAdd == ““:
return
# 3. Write data to the file. If you want to include a newline you must
# concat a \n character to the end of the line. Note also that you can
# wrap the comment with certain markers and not require the user to enter
# these markers when prompted. Although the prompt function only allows
# one line per entry you can set up a tag that can be used to represent
# a new line such as “\r\n“ and then replace this tag with a \n as we
# have done in this example:
textToAdd = “\n/********************************************/ \n\
* “ + now + “: \n* “ + textToAdd.replace(“\r\n“ “\n* “) + “\n\
/********************************************/ \n“
WriteToFile(tab.Session.LogFileName textToAdd)
# 4. Start up logging again making sure we append rather than overwrite.
tab.Session.Log(True True)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def WriteToFile(filename data):
# filename: Full path to file
# data: data to be written to the szFile
f = fil
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-09-17 16:11 SecureCRT\
文件 422400 2010-11-16 16:17 SecureCRT\Activator.exe
文件 1708032 2008-12-16 12:29 SecureCRT\ccme_ba
文件 382 2008-12-16 12:29 SecureCRT\ccme_ba
文件 902144 2010-11-16 17:23 SecureCRT\ClientConfigUI66U.dll
文件 273408 2010-11-16 17:23 SecureCRT\CommonUI66U.dll
目录 0 2012-09-17 16:11 SecureCRT\Config\
文件 145 2013-02-25 16:51 SecureCRT\Config\ButtonBarV2.ini
文件 1885 2011-11-21 10:27 SecureCRT\Config\Color Schemes.ini
文件 50923 2013-02-25 16:52 SecureCRT\Config\FileTypes.ini
文件 10714 2013-02-25 16:52 SecureCRT\Config\Global.ini
文件 63 2012-01-06 15:29 SecureCRT\Config\QuickSync.ini
文件 69 2011-11-22 12:09 SecureCRT\Config\Recent File List SecureCRT.ini
文件 70 2011-12-29 12:41 SecureCRT\Config\Recent File List SecureFX.ini
文件 31797 2013-02-25 16:51 SecureCRT\Config\SCRTMenuToolbar.ini
目录 0 2013-02-25 16:51 SecureCRT\Config\Sessions\
文件 9488 2011-11-21 10:27 SecureCRT\Config\Sessions\Default.ini
文件 74 2013-02-25 16:52 SecureCRT\Config\Sessions\__FolderData__.ini
文件 55418 2013-02-25 16:52 SecureCRT\Config\SFXMenuToolbar.ini
文件 482 2011-11-21 10:27 SecureCRT\Config\SSH2.ini
文件 518144 2010-11-16 17:23 SecureCRT\ConnectDialog66U.dll
文件 1744896 2008-12-16 12:29 SecureCRT\cryptocme2.dll
文件 382 2008-12-16 12:29 SecureCRT\cryptocme2.dll.manifest
文件 1607 2008-12-16 12:29 SecureCRT\cryptocme2.sig
文件 222720 2010-11-16 17:23 SecureCRT\FTP.dll
文件 230400 2010-11-16 17:23 SecureCRT\FTPSSL.dll
目录 0 2012-09-17 16:11 SecureCRT\Keymaps\
文件 5239 2004-03-17 14:47 SecureCRT\Keymaps\CRiSP.key
文件 2173 2004-03-17 14:47 SecureCRT\Keymaps\doorway.key
文件 9953 2004-03-17 14:47 SecureCRT\Keymaps\VShell.key
文件 1843 2004-03-17 14:47 SecureCRT\Keymaps\vt100.key
............此处省略80个文件信息
相关资源
- Linux设备驱动开发详解:基于最新的
- 华清远见培训全部资料
- Linux设备驱动开发详解:基于最新的
- 清晰文字版《鸟哥的Linux私房菜》第四
- glibc-2.16.0.tar.gz
- Linux设备驱动开发详解-基于最新的L
- SecureCRT工具
- Linux设备驱动开发详解:基于最新的
- 鸟哥的Linux私房菜-基础学习篇(第四
- 智能家居系统代码
- linux/unix系统编程手册下
- ARM Linux内核源码剖析高清+目录
- jdk-8u151-linux-arm64-vfp-hflt.tar.gz
- LINUX系统及编程基础.pdf
- DevOps故障排除:Linux服务器运维最佳实
- chrome linux 32 deb
- cmake-3.15.3-Linux-x86_64.tar.gz
- Linux多线程服务端编程 - 陈硕高清完整
- windows 访问LINUX 分区ExtFS for Windows 4.
- securecrt8.5含注册机
-
Visual em
bedLinux Tools 0.2.9 - securecrt.pj.zip
- Linux程序设计(第4版) (图灵程序设
- tensorflow-1.2.1-cp35-cp35m-linux_x86_64.whl
- 奶瓶1.2.1linux
- 深入理解BOOTLOADER 胡尔佳 高清扫描p
- Linux 教程166249
- 红帽Linux9
- Xilinx Zynq SoC与嵌入式Linux设计实战指南
- linux centos7_64 gcc依赖安装包
评论
共有 条评论