如何使用netcat进行文件传输

发布时间:2021-09-16 14:49:54 作者:小新
来源:亿速云 阅读:154

这篇文章将为大家详细讲解有关如何使用netcat进行文件传输,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

首先看一下帮助信息。

$ nc -h
OpenBSD netcat (Debian patchlevel 1.105-7ubuntu1)
This is nc from the netcat-openbsd package. An alternative nc is available
in the netcat-traditional package.
usage: nc [-46bCDdhjklnrStUuvZz] [-I length] [-i interval] [-O length]
   [-P proxy_username] [-p source_port] [-q seconds] [-s source]
   [-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol]
   [-x proxy_address[:port]] [destination] [port]
  Command Summary:
    -4    Use IPv4
    -6    Use IPv6
    -b    Allow broadcast
    -C    Send CRLF as line-ending
    -D    Enable the debug socket option
    -d    Detach from stdin
    -h    This help text
    -I length  TCP receive buffer length
    -i secs    Delay interval for lines sent, ports scanned
    -j    Use jumbo frame
    -k    Keep inbound sockets open for multiple connects
    -l    Listen mode, for inbound connects
    -n    Suppress name/port resolutions
    -O length  TCP send buffer length
    -P proxyuser  Username for proxy authentication
    -p port    Specify local port for remote connects
      -q secs    quit after EOF on stdin and delay of secs
    -r    Randomize remote ports
    -S    Enable the TCP MD5 signature option
    -s addr    Local source address
    -T toskeyword  Set IP Type of Service
    -t    Answer TELNET negotiation
    -U    Use UNIX domain socket
    -u    UDP mode
    -V rtable  Specify alternate routing table
    -v    Verbose
    -w secs    Timeout for connects and final net reads
    -X proto  Proxy protocol: "4", "5" (SOCKS) or "connect"
    -x addr[:port]  Specify proxy address and port
    -Z    DCCP mode
    -z    Zero-I/O mode [used for scanning]
  Port numbers can be individual or ranges: lo-hi [inclusive]

端口扫描:

$ nc -z -v -n 127.0.0.1 20-100
...
Connection to 127.0.0.1 80 port [tcp/*] succeeded!
...

简单文件传输:

客户端:

$ nc -l 192.168.1.11 1234 > passwd.txt &

服务端:

$ nc 192.168.1.11 1234 < /etc/passwd

也可以是

cat /etc/passwd | nc 192.168.1.11 1234

服务端ip是192.169.1.11,端口是1234

如此,当两台linux机器需要简单传输文件时,再好不过了~

关于“如何使用netcat进行文件传输”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

推荐阅读:
  1. 使用nc文件传输
  2. netcat,nmap常用例子

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

netcat

上一篇:MySQL主从配置及mysqldump备份的步骤

下一篇:Shell脚本编写的可靠建议有哪些

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》