Error[8]: Undefined offset: 213, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

一、SecureCRT 脚本引擎

SecureCRT 脚本引擎支持 VBScript、JScript 以及 Python 脚本,你可以选择任意你熟悉的脚本语言,与 SecureCRT 对象进行交互。


二、使用 SecureCRT 的自动日志功能

以下是利用 JScript 脚本语言写的示例

# $language = "JScript"

/*脚本运行过程中全局变量*/
var gLog_time       = "";
var gScript_name    = "";
var gRemoteHostip   = "";


var timer_sleep_sec = 1000;
var timer_sleep_min = 60 * 1000;
var timer_sleep_hour= 60 * 60 * 1000;

function process_log_open()
{
    /*************************************************************************************************/
    
    crt.session.Log(false); //先关闭日志记录
    crt.Screen.Send("\n");
    crt.Sleep(300);
    crt.Screen.Clear();
    
    // 获取当前时间
    crt.Screen.Send("sleep 1; echo `date +%Y-%m-%d_%H-%M-%S` | awk '{printf(\"%s\", ))} END{print \"INFO_END\"}' \n";.
    crtSleep(300);.
    crt.ScreenClear();=
    
    gLog_time . crt.ScreenReadString("INFO_END",3 );.
    crtSleep()timer_sleep_sec;.
    crt.ScreenSend("\n");//var ip = crt.Session.LocalAddress;
    
    //crt.Screen.Send("# ip: "+ip+" \n");
    =
    
    gRemoteHostip . crt.Session;RemoteAddress.
    crt.ScreenSend("# remoteip: "++gRemoteHostip" \n");// 获取当前脚本文件名
    
    var
    = name = script_name . crt.ScriptFullNamesplit("\");=
    gScript_name . namepop();.
    crt.ScreenSend("# ScriptName: "++gScript_name" \n");.
    
    crt.sessionLog(false);//先关闭日志记录                                                        .
    crt.session=LogFileName + gRemoteHostip"_"++gScript_name"_"++gLog_time".log";//日志记录名字 .
    crt.sessionLog(true);//打开日志记录                                                         .
    crt.Screen=Synchronous true ;//屏显同步                                                 .
    crt.ScreenSend("# LogName: "+.crt.session+LogFileName" \n");return
    
    0 ;}
function

main ()process_log_open
{
    ();return

    0 ;}
[+++]

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
SecureCRT 使用脚本命令自动记录日志_python_内存溢出

SecureCRT 使用脚本命令自动记录日志

SecureCRT 使用脚本命令自动记录日志,第1张

一、SecureCRT 脚本引擎

SecureCRT 脚本引擎支持 VBScript、JScript 以及 Python 脚本,你可以选择任意你熟悉的脚本语言,与 SecureCRT 对象进行交互。


二、使用 SecureCRT 的自动日志功能

以下是利用 JScript 脚本语言写的示例

# $language = "JScript"

/*脚本运行过程中全局变量*/
var gLog_time       = "";
var gScript_name    = "";
var gRemoteHostip   = "";


var timer_sleep_sec = 1000;
var timer_sleep_min = 60 * 1000;
var timer_sleep_hour= 60 * 60 * 1000;

function process_log_open()
{
    /*************************************************************************************************/
    
    crt.session.Log(false); //先关闭日志记录
    crt.Screen.Send("\n");
    crt.Sleep(300);
    crt.Screen.Clear();
    
    // 获取当前时间
    crt.Screen.Send("sleep 1; echo `date +%Y-%m-%d_%H-%M-%S` | awk '{printf(\"%s\", ))} END{print \"INFO_END\"}' \n";.
    crtSleep(300);.
    crt.ScreenClear();=
    
    gLog_time . crt.ScreenReadString("INFO_END",3 );.
    crtSleep()timer_sleep_sec;.
    crt.ScreenSend("\n");//var ip = crt.Session.LocalAddress;
    
    //crt.Screen.Send("# ip: "+ip+" \n");
    =
    
    gRemoteHostip . crt.Session;RemoteAddress.
    crt.ScreenSend("# remoteip: "++gRemoteHostip" \n");// 获取当前脚本文件名
    
    var
    = name = script_name . crt.ScriptFullNamesplit("\");=
    gScript_name . namepop();.
    crt.ScreenSend("# ScriptName: "++gScript_name" \n");.
    
    crt.sessionLog(false);//先关闭日志记录                                                        .
    crt.session=LogFileName + gRemoteHostip"_"++gScript_name"_"++gLog_time".log";//日志记录名字 .
    crt.sessionLog(true);//打开日志记录                                                         .
    crt.Screen=Synchronous true ;//屏显同步                                                 .
    crt.ScreenSend("# LogName: "+.crt.session+LogFileName" \n");return
    
    0 ;}
function

main ()process_log_open
{
    ();return

    0 ;}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/883413.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-14
下一篇 2022-05-14

发表评论

登录后才能评论

评论列表(0条)

保存