如何使用 NetCat for Windows 将二进制文件发送到 TCP 连接?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2040817/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use NetCat for Windows to send a binary file to a TCP connection?
提问by Lopper
回答by Lopper
I found the solution. Its
我找到了解决方案。它的
nc 127.0.0.1 1200 < binary.bin
In addition, if the response needs to be saved then
此外,如果需要保存响应,则
nc 127.0.0.1 1200 < binary.bin > response.bin
回答by FalcoGer
If you want to send it from a linux distribution to anybody, including windows PCs you can do something like this:
如果您想将它从 linux 发行版发送给任何人,包括 Windows PC,您可以执行以下操作:
{ echo -ne "HTTP/1.0 200 OK\r\n\r\n"; cat path/to/your/file/binary.bin ; } | nc -l 1200
The receiving end then just needs to browse to your IP Address in his web browser and gets a prompt to download. Needless to say port 1200 needs to be forwarded if you're behind a router.
然后接收端只需要在他的网络浏览器中浏览到您的 IP 地址并得到下载提示。不用说,如果您在路由器后面,则需要转发端口 1200。