在putty Release 6.0基础上针对ssh登录,修改为保存密码,自动登录(近似)
2007-11-11 02:43
363 查看
仅供参考,后果自负-_-
1、安装VS2003,下载putty Release 6.0(http://www.putty.nl/download.html)的源码。
2、在putty.h的struct config_tag中添加变量
在char username[100];这行的下面添加:
char password[100];
3、修改settings.c,将变量写入、读出注册表。
在write_setting_s(sesskey, "UserName", cfg->username);这行下面添加:
write_setting_s(sesskey, "password", cfg->password);
在gpps(sesskey, "UserName", "", cfg->username, sizeof(cfg->username));下面添加:
gpps(sesskey, "password", "", cfg->password, sizeof(cfg->password));
4、在config.c添加用于输入密码的控件
在
/*
* A sub-panel Connection/Data, containing options that
* decide on data to send to the server.
*/
if (!midsession) {
后面添加:
c = ctrl_editbox(s, "Auto-login password", 'w', 50,
HELPCTX(connection_password),
dlg_stdeditbox_handler, I(offsetof(Config,password)),
I(sizeof(((Config *)0)->password)));
c->editbox.password = 1; //设置该ctrl_editbox不为明文。输入的字符以*代替。
5、修改ssh.c,使保存的密码生效
共需要修改两个地方:
(1)用于交互式,使用solaris10测试
大约添加在7500行的
/*
* Send the responses to the server.
*/
前面。
(2)非交互式,使用RedHat AS4测试
大约添加在7573行的
在
/*
* Squirrel away the password. (We may need it later if
* asked to change it.)
*/
与
s->password = dupstr(s->cur_prompt->prompts[0]->result);
free_prompts(s->cur_prompt);
之间。
下面是需要添加的内容:
////////////////////////////////////////////////////////////////////////////////////////
if (ssh->cfg.password[0] != '/0'&& !strcmp("123",s->cur_prompt->prompts[0]->result))
{
strcpy(s->cur_prompt->prompts[0]->result, ssh->cfg.password);
}
////////////////////////////////////////////////////////////////////////////////////////
6、登录方法
在设置界面的Connection->Data输入用户名、密码。
登录后,输123,即可登录系统。当然改为其它的都可以。
////////////////////////
本次实现, 参考http://blog.csdn.net/wwwsq/archive/2007/07/27/1712827.aspx
1、安装VS2003,下载putty Release 6.0(http://www.putty.nl/download.html)的源码。
2、在putty.h的struct config_tag中添加变量
在char username[100];这行的下面添加:
char password[100];
3、修改settings.c,将变量写入、读出注册表。
在write_setting_s(sesskey, "UserName", cfg->username);这行下面添加:
write_setting_s(sesskey, "password", cfg->password);
在gpps(sesskey, "UserName", "", cfg->username, sizeof(cfg->username));下面添加:
gpps(sesskey, "password", "", cfg->password, sizeof(cfg->password));
4、在config.c添加用于输入密码的控件
在
/*
* A sub-panel Connection/Data, containing options that
* decide on data to send to the server.
*/
if (!midsession) {
后面添加:
c = ctrl_editbox(s, "Auto-login password", 'w', 50,
HELPCTX(connection_password),
dlg_stdeditbox_handler, I(offsetof(Config,password)),
I(sizeof(((Config *)0)->password)));
c->editbox.password = 1; //设置该ctrl_editbox不为明文。输入的字符以*代替。
5、修改ssh.c,使保存的密码生效
共需要修改两个地方:
(1)用于交互式,使用solaris10测试
大约添加在7500行的
/*
* Send the responses to the server.
*/
前面。
(2)非交互式,使用RedHat AS4测试
大约添加在7573行的
在
/*
* Squirrel away the password. (We may need it later if
* asked to change it.)
*/
与
s->password = dupstr(s->cur_prompt->prompts[0]->result);
free_prompts(s->cur_prompt);
之间。
下面是需要添加的内容:
////////////////////////////////////////////////////////////////////////////////////////
if (ssh->cfg.password[0] != '/0'&& !strcmp("123",s->cur_prompt->prompts[0]->result))
{
strcpy(s->cur_prompt->prompts[0]->result, ssh->cfg.password);
}
////////////////////////////////////////////////////////////////////////////////////////
6、登录方法
在设置界面的Connection->Data输入用户名、密码。
登录后,输123,即可登录系统。当然改为其它的都可以。
////////////////////////
本次实现, 参考http://blog.csdn.net/wwwsq/archive/2007/07/27/1712827.aspx
相关文章推荐
- ubuntu 16.04 修改默认root密码,设置root用户自动登录,ssh root登录
- Linux SSH 客户端保存密码 自动登录服务端
- 修改PuTTY实现保存密码自动登录
- ssh免密码自动登录及相关问题解决
- Chrome 62 的大坑:修改密码后始终使用保存的旧密码登录
- ssh自动登录及命令执行结果保存
- Putty保存密码,自动登录
- 原创思考 NSUserDefaults实现自动登录--保存账号和密码--记住登录状态
- Android实例demo6之界面登录、sharedperference、自动登录、保存密码
- RHCE_LAB(2)SSH远程登录自动验证(不输入用户登录密码)的实现
- winform设计一个登录界面和修改密码的界面-自动切换窗体(问题[已解] 望一起讨论)(技术改变世界-cnblog)
- 【Struts2+Hibernate3+Spring3】利用SSH整合,完成打印用户表,用户登录、注册、修改密码系统
- mstsc保存用户名和密码,实现自动登录远程桌面
- 更好的自动ssh登录,用公共key实现无密码ssh
- ios-day13-01(私人通讯录。控制器之间的数据传递、保存密码和自动登录的实现、普通对象的归档、UITableView的局部刷新和向左滑动删除功能等等)
- Chrome 62 的大坑:修改密码后始终使用保存的旧密码登录
- 安卓Shareprefrence实现记住密码自动登录以及保存在shareprefrence里面数据如何加密解密
- Linux基础教程 linux无密码ssh登录设置