linux远程连接工具SecureCRT


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.


This script requires a session configuration in which a
log file is defined.


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):


(Comment will be prefaced with current timestamp: “ + now
“Add Comment To SecureCRT Log File
“ + 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 
 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 “
“ and then replace this tag with a 
 as we 
# have done in this example:
textToAdd = “
/********************************************/ 

* “ + now + “: 
* “ + textToAdd.replace(“
“ “
* “) + “

/********************************************/ 


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  SecureCRTActivator.exe
     文件     1708032  2008-12-16 12:29  SecureCRTccme_base.dll
     文件         382  2008-12-16 12:29  SecureCRTccme_base.dll.manifest
     文件      902144  2010-11-16 17:23  SecureCRTClientConfigUI66U.dll
     文件      273408  2010-11-16 17:23  SecureCRTCommonUI66U.dll
     目录           0  2012-09-17 16:11  SecureCRTConfig
     文件         145  2013-02-25 16:51  SecureCRTConfigButtonBarV2.ini
     文件        1885  2011-11-21 10:27  SecureCRTConfigColor Schemes.ini
     文件       50923  2013-02-25 16:52  SecureCRTConfigFileTypes.ini
     文件       10714  2013-02-25 16:52  SecureCRTConfigGlobal.ini
     文件          63  2012-01-06 15:29  SecureCRTConfigQuickSync.ini
     文件          69  2011-11-22 12:09  SecureCRTConfigRecent File List SecureCRT.ini
     文件          70  2011-12-29 12:41  SecureCRTConfigRecent File List SecureFX.ini
     文件       31797  2013-02-25 16:51  SecureCRTConfigSCRTMenuToolbar.ini
     目录           0  2013-02-25 16:51  SecureCRTConfigSessions
     文件        9488  2011-11-21 10:27  SecureCRTConfigSessionsDefault.ini
     文件          74  2013-02-25 16:52  SecureCRTConfigSessions\__FolderData__.ini
     文件       55418  2013-02-25 16:52  SecureCRTConfigSFXMenuToolbar.ini
     文件         482  2011-11-21 10:27  SecureCRTConfigSSH2.ini
     文件      518144  2010-11-16 17:23  SecureCRTConnectDialog66U.dll
     文件     1744896  2008-12-16 12:29  SecureCRTcryptocme2.dll
     文件         382  2008-12-16 12:29  SecureCRTcryptocme2.dll.manifest
     文件        1607  2008-12-16 12:29  SecureCRTcryptocme2.sig
     文件      222720  2010-11-16 17:23  SecureCRTFTP.dll
     文件      230400  2010-11-16 17:23  SecureCRTFTPSSL.dll
     目录           0  2012-09-17 16:11  SecureCRTKeymaps
     文件        5239  2004-03-17 14:47  SecureCRTKeymapsCRiSP.key
     文件        2173  2004-03-17 14:47  SecureCRTKeymapsdoorway.key
     文件        9953  2004-03-17 14:47  SecureCRTKeymapsVShell.key
     文件        1843  2004-03-17 14:47  SecureCRTKeymapsvt100.key
............此处省略80个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)