前言全局说明

putty串口serial传输文件plink

一块板子,在没有网络情况下,只能用串口去访问,而网上说的 rz/sz/zmode 都是要在有网的情况下安装相应文件包后,才能使用。

putty 套件中提供了命令行 plink 可以尝试上传文件

一、说明

环境:

Windows 11 家庭版 23H2 22631.3737

二、putty 安装方式(略)

网上有很多, 这里不再重复。

三、plink 帮助

3.1 英文 0.78 版

C:\>plink

Plink: command-line connection utility

Release 0.78

Usage: plink [options] [user@]host [command]

("host" can also be a PuTTY saved session name)

Options:

-V print version information and exit

-pgpfp print PGP key fingerprints and exit

-v show verbose messages

-load sessname Load settings from saved session

-ssh -telnet -rlogin -raw -serial

force use of a particular protocol

-ssh-connection

force use of the bare ssh-connection protocol

-P port connect to specified port

-l user connect with specified username

-batch disable all interactive prompts

-proxycmd command

use 'command' as local proxy

-sercfg configuration-string (e.g. 19200,8,n,1,X)

Specify the serial configuration (serial only)

The following options only apply to SSH connections:

-pwfile file login with password read from specified file

-D [listen-IP:]listen-port

Dynamic SOCKS-based port forwarding

-L [listen-IP:]listen-port:host:port

Forward local port to remote address

-R [listen-IP:]listen-port:host:port

Forward remote port to local address

-X -x enable / disable X11 forwarding

-A -a enable / disable agent forwarding

-t -T enable / disable pty allocation

-1 -2 force use of particular SSH protocol version

-4 -6 force use of IPv4 or IPv6

-C enable compression

-i key private key file for user authentication

-noagent disable use of Pageant

-agent enable use of Pageant

-no-trivial-auth

disconnect if SSH authentication succeeds trivially

-noshare disable use of connection sharing

-share enable use of connection sharing

-hostkey keyid

manually specify a host key (may be repeated)

-sanitise-stderr, -sanitise-stdout, -no-sanitise-stderr, -no-sanitise-stdout

do/don't strip control chars from standard output/error

-no-antispoof omit anti-spoofing prompt after authentication

-m file read remote command(s) from file

-s remote command is an SSH subsystem (SSH-2 only)

-N don't start a shell/command (SSH-2 only)

-nc host:port

open tunnel in place of session (SSH-2 only)

-sshlog file

-sshrawlog file

log protocol details to a file

-logoverwrite

-logappend

control what happens when a log file already exists

-shareexists

test whether a connection-sharing upstream exists

3.2 中文 0.81 版

Plink:命令行连接工具

版本 0.81

使用方法:plink [选项] [用户@]主机 [命令]

("主机" 也可以是 PuTTY 保存的会话名称)

选项:

-V 显示版本信息并退出

-pgpfp 显示 PGP 密钥指纹并退出

-v 显示详细消息

-load sessname 从保存的会话加载设置

-ssh -telnet -rlogin -raw -serial

强制使用特定协议

-ssh-connection

强制使用基本的 ssh-连接协议

-P 端口 连接到指定端口

-l 用户名 使用指定用户名连接

-batch 禁用所有交互式提示

-proxycmd 命令

使用 '命令' 作为本地代理

-sercfg 配置字符串(例如,19200,8,n,1,X)

指定串行配置(仅限串行)

以下选项仅适用于 SSH 连接:

-pwfile 文件 从指定文件读取密码登录

-D [监听-IP:]监听端口

动态基于 SOCKS 的端口转发

-L [监听-IP:]监听端口:目标主机:目标端口

将本地端口转发到远程地址

-R [监听-IP:]监听端口:目标主机:目标端口

将远程端口转发到本地地址

-X -x 启用 / 禁用 X11 转发

-A -a 启用 / 禁用代理转发

-t -T 启用 / 禁用伪终端分配

-1 -2 强制使用特定的 SSH 协议版本

-4 -6 强制使用 IPv4 或 IPv6

-C 启用压缩

-i 密钥文件 用于用户身份验证的私钥文件

-noagent 禁用 Pageant 的使用

-agent 启用 Pageant 的使用

-no-trivial-auth

如果 SSH 认证轻易成功则断开连接

-noshare 禁用连接共享

-share 启用连接共享

-hostkey 密钥ID

手动指定主机密钥(可重复)

-sanitise-stderr, -sanitise-stdout, -no-sanitise-stderr, -no-sanitise-stdout

对标准输出/错误执行/不执行控制字符剥离

-no-antispoof 认证后省略反欺骗提示

-m 文件 从文件读取远程命令

-s 远程命令是一个 SSH 子系统(仅 SSH-2)

-N 不启动shell/命令(仅 SSH-2)

-nc 主机:端口

以隧道代替会话打开(仅 SSH-2)

-sshlog 文件

-sshrawlog 文件

将协议详细信息记录到文件中

-logoverwrite

-logappend

控制当日志文件已存在时的行为

-shareexists

测试是否存在连接共享的上游

四、plink 传文件

4.1 重定向文件到 串口

plink.exe -serial -sercfg ... < input.txt

4.2

plink.exe -serial COM4 -sercfg 115200,8,n,1,N

-serial COM4 : 指定串口连接COM4

-sercfg 115200,8,n,1,N

115200 : 传输波特率

8: 数据位8bit(Any single digit from 5 to 9 sets the number of data bits)

n: 奇偶校验(parity: ‘n’ for none, ‘o’ for odd, ‘e’ for even, ‘m’ for mark and ‘s’ for space.)

1: 停止位(‘1’, ‘1.5’ or ‘2’ sets the number of stop bits)

N: 控制流(flow control: ‘N’ for none, ‘X’ for XON/XOFF, ‘R’ for RTS/CTS and ‘D’ for DSR/DTR.)

免责声明:本号所涉及内容仅供安全研究与教学使用,如出现其他风险,后果自负。

参考、来源:

https://cloud.tencent.com/developer/ask/sof/112150867

https://the.earth.li/~sgtatham/putty/0.81/htmldoc/Chapter7.html

https://www.haiyun.me/archives/putty-plink.html

https://cloud.tencent.com/developer/ask/sof/106458148/answer/106357392

https://the.earth.li/~sgtatham/putty/0.66/htmldoc/Chapter7.html (Release 0.66)

https://blog.csdn.net/le_17_4_6/article/details/86466891 (Release 0.70)

https://the.earth.li/~sgtatham/putty/0.81/htmldoc/Chapter7.html (Release 0.81)

https://documentation.help/PuTTY/using-cmdline-sercfg.html

https://blog.csdn.net/kaspar1992/article/details/139242982 (#### 3.2)