• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >linux shell > 使用netcat(瑞士军刀)进行文件传输

使用netcat(瑞士军刀)进行文件传输

作者:hebedich 字体:[增加 减小] 来源:互联网

hebedich 通过本文主要向大家介绍了netcat,netcat下载,netcat使用,netcat官网,netcat使用方法等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

nc(netcat)被誉为网络工具中的“瑞士军刀”,体积虽小但功能强大,nc最简单的功能是端口扫描,这里我主要笔记一下它作为文件传输的妙用。

首先看一下帮助信息。

$ 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]
</div>

端口扫描:

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

简单文件传输:

客户端:

$ nc -l 192.168.1.11 1234 > passwd.txt &
</div>

服务端:

$ nc 192.168.1.11 1234 < /etc/passwd
</div>

也可以是

cat /etc/passwd | nc 192.168.1.11 1234
</div>

服务端ip是192.169.1.11,端口是1234

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

</div>

您可能想查找下面的文章:

  • 使用netcat(瑞士军刀)进行文件传输

相关文章

  • Linux Shell的一些使用小技巧收集
  • Shell脚本实现根据文件的修改时间来分类文件
  • shell对比文件内容脚本分享
  • Shell脚本实现乱序排列文件内容的多种方法(洗牌问题)
  • 利用shell获取指定日期前N天的日期
  • shell编程基础知识小结
  • shell中的数组操作小结和冒泡排序实现脚本分享
  • 对用户输入的判断的shell实现代码
  • 浅谈ubuntu 中sudo update与upgrade的作用及区别
  • 一个简洁的全自动安装LNMP服务器环境的Shell脚本分享

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Shell逐行读取文件的4种方法
    • 最快捷登陆ssh 服务器的方法
    • shell脚本中28个特殊字符的作用简明总结
    • Linux中scp命令获取远程文件的方法
    • Shell实现系统时间和BIOS时间同步校准脚本分享
    • 解决VirtualBox中Ubuntu 14.04屏幕分辨率不能设置的问题
    • Shell脚本中获取进程ID的方法
    • Linux下date命令,格式化输出,时间设置方法
    • Linux 怎么实现添加FTP用户并设置权限的方法
    • 一句话Shell命令关闭不需要的随机启动服务

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有