zoukankan      html  css  js  c++  java
  • securtcrt session配置转xshell的session配置

    参数:

    1.securtcrt的session目录

    2.一个xshell的模版文件

    3.输出目录(必须不存在,自动创建)

    #!/usr/bin/python
    # -*- coding:utf-8 -*-
    #转换secrt的session文件到xshell的session文件
    import os
    from sys import *
    
    def gen_xshell_session(path, tpl_file, out_session):
        os.mkdir(out_session)
        for f in os.listdir(path):
            print(f)
            fn = path + '/' + f
            if  os.path.isdir(fn):
                od = out_session + '/' + f
                gen_xshell_session(fn, tpl_file, od)
            else:
                if f.startswith('__'):
                    continue
                ext = f.find('.ini')
                ip = f[0:ext]
                xshell_cfg_file = out_session + '/' + ip + '.xsh'
                ifn = open(tpl_file, 'r')
                lns = ifn.readlines()
                ifn.close()
                tpl = os.path.basename(tpl_file)
                tpl_n = tpl.find('.xsh')
                tpl_ip = tpl[0:tpl_n]
                ofn = open(xshell_cfg_file, 'w')
                for ln in lns:
                    ln = ln.replace(tpl_ip, ip)
                    ofn.write(ln)
                ofn.close()
    
    
    
    
    
    
    if __name__ == '__main__':
        secrt_session = argv[1]
        xshell_xsh_tpl_file = argv[2]
        xshell_out_session_dir = argv[3]
    
        gen_xshell_session(secrt_session, xshell_xsh_tpl_file, xshell_out_session_dir)
    
     
  • 相关阅读:
    arm单板上移植gdb
    video on web
    chromium源码阅读
    CE-HTML简介
    multi-tap
    DPDK 网卡RSS(receive side scaling)简介
    c语言实现带LRU机制的哈希表
    Linux TCP协议使用的变量
    scp源码浅析
    Linux e1000e网卡驱动
  • 原文地址:https://www.cnblogs.com/moodlxs/p/3403828.html
Copyright © 2011-2022 走看看