【Linux实用工具一】sshpass+netcat+lrzsz

1. sshpass-非交互式ssh工具

Sshpass 是一种使用 SSH 所谓的“交互式键盘密码身份验证”非交互式执行密码身份验证的工具。换句话说,允许在命令行中指定密码进行ssh相关操作,而不需要在执行ssh后再次手动输入密码,非常实用!

1.1 源码

Non-interactive ssh password auth download | SourceForge.netDownload Non-interactive ssh password auth for free. Sshpass is a tool for non-interactivly performing password authentication with SSH's so called "interactive keyboard password authentication". Most user should use SSH's more secure public key authentiaction instead.https://sourceforge.net/projects/sshpass/

1.2 编译

./configure && make
cp sshpass /usr/bin/sshpass

1.3 使用

1.3.1 登录

sshpass -p 密码 ssh 账号@主机

1.3.2 远程拷贝

# 将本地的文件拷贝到远程主机上
sshpass -p 密码 scp 本地文件 账号@主机:远程文件
# 将远程主机上的文件拷贝到本地
sshpass -p 密码 scp 账号@主机:远程文件 本地文件

1.3.3 远程执行命令

# sshpass -p 密码 ssh 账号@主机 "命令"
sshpass -p 密码 ssh 账号@主机 "ifconfig"

2. netcat-功能强大的网络工具

netcat号称瑞士军刀,短小精悍、功能实用,是一个简单、可靠的网络工具。

2.1 源码

The GNU netcat download | SourceForge.netDownload The GNU netcat for free. The networking swiss army knife. A rewrite of the well-known networking tool, but more portable, with new features and fully GNU compliant.https://sourceforge.net/projects/netcat/

2.2 编译

./configure && make
cp src/netcat /usr/bin/nc

2.3 使用

2.3.1 常用选项

-c, --close                close connection on EOF from stdin
-e, --exec=PROGRAM         program to exec after connect
-g, --gateway=LIST         source-routing hop point[s], up to 8
-G, --pointer=NUM          source-routing pointer: 4, 8, 12, ...
-h, --help                 显示帮助信息
-i, --interval=SECS        delay interval for lines sent, ports scanned
-l, --listen               监听模式,需要使用-p指定本地端口,否则使用随机端口
-L, --tunnel=ADDRESS:PORT  forward local port to remote address
-n, --dont-resolve         numeric-only IP addresses, no DNS
-o, --output=FILE          output hexdump traffic to FILE (implies -x)
-p, --local-port=NUM       指定本地端口
-r, --randomize            randomize local and remote ports
-s, --source=ADDRESS       指定源IP或者主机
-t, --tcp                  TCP模式(默认缺省)
-T, --telnet               answer using TELNET negotiation
-u, --udp                  UDP模式
-v, --verbose              显示详细信息,-vv显示更多
-V, --version              显示版本信息
-x, --hexdump              hexdump incoming and outgoing traffic
-w, --wait=SECS            timeout for connects and final net reads
-z, --zero                 端口扫描

2.3.2 探测服务端口

# --探测tcp指定端口是否可达
nc -z -v 127.0.0.1 22
# --如果不使用-v选项,不打印任何输出,可通过判断执行结果来判断,0表示端口可达,1表示不可达
nc -z 127.0.0.1 22
[ $? = 0 ] && echo open || echo close

# --探测udp指定端口是否可达
nc -u -z -v ip port

# --探测指定范围(1-50000)的端口哪些可访问,将会打印可访问的端口信息
nc -z -v 127.0.0.1 1-50000

未完待续。。。。。

3. lrzsz-文件传输工具

lrzsz用于在linux和windows间传输文件,非常方便

3.1 源码

lrzszhttps://www.ohse.de/uwe/software/lrzsz.html

3.2 编译

./configure && make
cp src/lrz /usr/bin/rz
cp src/lsz /usr/bin/sz

3.3 使用

3.3.1 上传

# --普通上传
rz
# --覆盖上传
rz -y

3.3.2 下载

sz 文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值