部分服务器使用单独的key,为了方便,写了这2个脚本

2个版本,都需要Python

Windows版

win_crt_conf.py

cygwin版

cygwin_crt_conf.py

cygwin下可以用find+sed+unix2dos实现,但真的太慢了,Python快啊

2个文件要修改的地方是一样的

需要使用单独key的SecureCRT配置文件目录

crt_conf_dir = ‘E:\\CRT_CONF’

定义key文件的位置,identify为private key的名字

key_path_new = ‘S:”Identity Filename”=E:\CRT_KEY\identify’

原理,每个服务器配置都定义了使用全局key还是会话key

这个是使用全局key

D:”Use Global Public Key”=00000001

定义使用的key文件路径

S:”Identity Filename”=

定义使用会话key

D:”Use Global Public Key”=00000000

E:\CRT_KEY\identify为要使用的会话key

S:”Identity Filename”=E:\CRT_KEY\identify

win_crt_conf.py

[python]

#!D:\\Python27\\python

#-*-coding=utf-8-*-

import os,sys,re

crt_conf_dir = ‘E:\\CRT_CONF’

global_public_key_true = ‘D:”Use Global Public Key”=00000001’

global_public_key_false = ‘D:”Use Global Public Key”=00000000’

key_path_old = ‘S:”Identity Filename”=’

key_path_new = ‘S:”Identity Filename”=E:\CRT_KEY\identify’

re_global_public_key = re.compile(global_public_key_true,re.DOTALL)

re_key_path = re.compile(‘S:”Identity Filename”=(.*)’)

os.chdir(crt_conf_dir)

c1 = os.walk(os.getcwd())

filelist = []

for c2 in c1:

for c3 in c2[2]:

filelist.append(os.path.join(c2[0],c3))

for filename in filelist:

fileread = open(filename,’r’)

filer = fileread.read()

pub_key = re.sub(re_global_public_key,global_public_key_false,filer,0)

key_path = re.sub(re_key_path,key_path_new,pub_key,0)

fileread.close()

fileok = open(filename,’w’)

fileok.write(key_path)

fileok.close()

print filename,’替换成功!’

[/python]

cygwin_crt_conf.py

[python]

#!/usr/bin/python

#-*-coding=utf-8-*-

import os,sys,re

crt_conf_dir = ‘/cygdrive/e/CRT_CONF’

global_public_key_true = ‘D:”Use Global Public Key”=00000001’

global_public_key_false = ‘D:”Use Global Public Key”=00000000’

key_path_old = ‘S:”Identity Filename”=’

key_path_new = ‘S:”Identity Filename”=E:\CRT_KEY\identify’

re_global_public_key = re.compile(global_public_key_true,re.DOTALL)

re_key_path = re.compile(‘S:”Identity Filename”=(.*)’)

os.chdir(crt_conf_dir)

c1 = os.walk(os.getcwd())

filelist = []

for c2 in c1:

for c3 in c2[2]:

filelist.append(os.path.join(c2[0],c3))

for filename in filelist:

fileread = open(filename,’r’)

filer = fileread.read()

pub_key = re.sub(re_global_public_key,global_public_key_false,filer,0)

key_path = re.sub(re_key_path,key_path_new,pub_key,0)

fileread.close()

fileok = open(filename,’w’)

fileok.write(key_path)

fileok.close()

print filename,’Replace successful!’

[/python]

主要参考了http://blog.591by.com/show-214-1

securecrt批量登录linux,SecureCRT批量配置使用会话key相关推荐

  1. 实验室远程登录Linux服务器并配置环境

    实验室远程登录Linux服务器并配置环境 配置服务器环境的前提是已经登陆进入实验室服务器 如何登入服务器:手把手教你如何连上实验室的服务器_万事胜意-CSDN博客_实验室服务器 如何添加账户和设置密码 ...

  2. SecureCRT 远程登录 Linux(开启 SSH)

    SecureCRT 是一款 SSH 客户端,方便用户在 Windows下登录 Linux. SSH 是 Secure Shell 的缩写,是建立在 应用层 和 传输层 基础上的 安全协议,能够有效防止 ...

  3. 使用SecureCrt远程登录Linux安装配置教程

    1. 首先验证安装secureCRT的本地机和linux服务器能否ping的通: 2. 判断linux 服务端是否安装了ssh 若未安装的话: apt-get installopenssh-serve ...

  4. python脚本批量登录crt_Python实现批量新建SecureCRT Session

    最近因为工作需要,我需要在ssh的时候保存几千台网关的session,工作量相当大(也就是ssh的时候需要记住用户名和密码,然后还要再session选项中录入enable密码,相当繁琐),而且设备的用 ...

  5. 用Kickstart批量安装Linux系统、Kickstart安装,linux批量安装;Linux的Kickstart的 无人值守安装;linux pxe自动安装linux系统...

    用Kickstart批量安装Linux|Kickstart,批量安装:Linux的Kickstart的 无人值守安装:linux pxe自动安装linux系统: KickStart + DHCP + ...

  6. 【YM】ssh命令 远程登录Linux

    [YM]ssh命令 远程登录Linux spfanlost 2017.10.08 14:51:24 字数 646 阅读 1,008 菜鸟学Linux命令:ssh命令 远程登录 如何通过ssh远程登录l ...

  7. securecrt配置linux账号密码,配置SecureCRT密钥连接Linux

    配置SecureCRT密钥连接Linux SSH公钥加密的方式使得对方即使截取了帐号密码,在没有公钥私钥的情况下,依然无法远程ssh登录系统,这样就大大加强了远程登录的安全性. 1.编辑配置文件 /e ...

  8. SecureCRT密钥远程登录Linux

    一:环境 SecureCRT版本:SecureCRT_5.1.3 linux版本: [root@angelT ~]# cat /etc/redhat-release CentOS release 6. ...

  9. SecureCRT密钥key远连接程ssh证书登录Linux

    国内大部分人用的系统是windows,而windows下有很多ssh客户端图形工作,最流行,功能最强大的就是SecureCRT了,所以我会单独针对SecureCRT简单讲下实现ssh证书登录Linux ...

  10. SSH免密登录(内含批量配置脚本)

    原文地址:itweknow.cn/detail?id=6- ,欢迎大家访问. 在我们的集群环境搭建过程中可能会很需要SSH免密登录,互相之间传文件只需要一个SCP命令,连密码都不用输,很方便.那么这篇 ...

最新文章

  1. OpenCV中泛洪填充算法解析与应用
  2. java中布尔值做比较_Java中的三态布尔值
  3. web前端CSS2学习2017.6.22
  4. 集合差异比较算法及性能测试
  5. UITableView使用总结和性能优化
  6. Android Sensor Driver(四)——IIC总线和驱动
  7. 找出满足要求的三位数
  8. 李航《统计学习方法》SMO算法推导中的思考
  9. MySQL分页查询优化
  10. Origin软件绘制柱形图
  11. 常见的搜索引擎蜘蛛有哪些
  12. lisp角度转换弪度_弧度角度换算(弧度角度换算器)
  13. selenium上传附件的两种方式(普通上传和借助AutoIt识别Windows上传窗口)
  14. Python链接数据库
  15. Unity笔记之UGUI Text首行缩进、改变文本颜色、文本间距调节
  16. 计算机网络cidr是啥,计算机网络(4.11)网络层- 无分类编址CIDR
  17. 时间与日期——瞬时(Instant)
  18. 10分钟白嫖大厂程序员都在用的在线工具网站
  19. 给研发培训资料两篇(架构设计大数据)
  20. linux 命令行 mpv,在Ubuntu本机编译mpv,秒杀其他播放器

热门文章

  1. 面向对象17:抽象类和抽象方法、创建抽象类的匿名子类对象、模板方法设计模式
  2. 几个常用的shell脚本
  3. 【题解专栏】南华大学19级软卓选拔赛题解
  4. 金币 详解(C++)
  5. C++小游戏——推箱子
  6. 功夫小子实践开发-Menu家族学习及开始菜单场景的实现
  7. 5加载stm32 keil_【STM32笔记】在SRAM、FLASH中调试代码的配置方法(附详细步骤)...
  8. 某计算机有五级中断L4,2011计算机基础考研组成原理部分
  9. java匹配uri_使用查询字符串中的:在Java中创建URI
  10. jquery css,attr,val方法