144.4. ncat - Concatenate and redirect sockets

简介:

nc - TCP/IP swiss army knife

按照 ncat

# yum search nc | grep nmap
nmap-ncat.x86_64 : Nmap's Netcat replacement

yum install nmap-ncat
		

144.4.1. TCP 数据传输

Server

nc -l 8080 > test.txt
			

Client

cat /etc/hosts | nc your_server 8080
			

144.4.2. UDP 数据传输

Server 端

nc -4 -u -l 9000
			

Client 端

cat /etc/passwd | nc -4 -u 47.90.1.240 9000
			

144.4.3. 始终保持服务器开启

-k, --keep-open Accept multiple connections in listen mode

# nc -l 8087 -k
			

这是你可以持续想服务器端发送数据

144.4.4. 传输视频流

服务端,这里我们从一个视频文件中读入并重定向输出到netcat客户端

$cat video.avi | nc -l 3000
			

客户端,从socket中读入数据并通过管道传递给 mplayer播放该视频。

$nc 172.16.0.10 3000 | mplayer -vo x11 -cache 3000 -			
			




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
5月前
|
Java 编译器 C++
Protocol Buffers(proto3) 指南
Protocol Buffers(proto3) 指南
49 0
|
8月前
|
存储 编译器 C++
从Proto到C++:探索Protocol Buffers的强大转换机制
从Proto到C++:探索Protocol Buffers的强大转换机制
813 4
|
8月前
|
Java
Forward与redirect的区别
总结:Forward适合在同一个应用内部进行页面跳转和数据共享,效率高;Redirect适合在不同应用间或需要完全不同上下文的页面跳转,涉及两次请求,URL地址会改变。选择使用哪种方式取决于具体的需求和场景。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
171 0
|
自然语言处理 知识图谱
ACL2022 Document-Level Event Argument Extraction via Optimal Transport
事件论元抽取(EAE)是事件抽取的子任务之一,旨在识别每个实体在特定事件触发词中的作用。尽管先前的工作在句子级EAE方面取得了成功,但对文档级的探索较少。
121 0
|
开发工具 git
解决 HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
解决 HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
1907 0
Uncaught DOMException: Blocked a frame with origin "http://localhost:8000" from accessing a cross-origin frame.
Uncaught DOMException: Blocked a frame with origin "http://localhost:8000" from accessing a cross-origin frame.
1406 0
|
Web App开发 安全 前端开发
Mixed Content: The page at was loaded over HTTPS, but requested an insecure imag
Mixed Content: The page at was loaded over HTTPS, but requested an insecure imag
502 0
Mixed Content: The page at was loaded over HTTPS, but requested an insecure imag
|
iOS开发 MacOS
curl: (4) A requested feature, protocol or option was not found
curl: (4) A requested feature, protocol or option was not found
286 0
curl: (4) A requested feature, protocol or option was not found