目录
centos下什么是nc
nc常用案例" >nc常用案例
首页 运维 CentOS centos下什么是nc

centos下什么是nc

Mar 23, 2022 pm 06:44 PM
centos

centos下的nc是“netcat”的简称,是一个网络工具,可以用于端口扫描、文件传输等,nc也可以实现任意TCP和UDP端口的侦听,可以利用“yum install nc -y”命令进行安装。

centos下什么是nc

本文操作环境:centos 7系统、Dell G3电脑。

centos下什么是nc

nc是netcat工具的简称,一个网络工具,可以用来端口扫描、文件传输等功能。

centos上面安装也很简单:

yum install nc -y
登录后复制

nc常用功能

  • 实现任意TCP/UDP端口的侦听,nc可以作为server以TCP或UDP方式侦听指定端口

  • 端口的扫描,nc可以作为client发起TCP或UDP连接

  • 机器之间传输文件

  • 机器之间网络测速

一般nc只用来做TCP/UDP协议的端口测试,其它功能少用!

nc帮助说明

# nc --help 
Ncat 7.50 ( https://nmap.org/ncat )
Usage: ncat [options] [hostname] [port]
Options taking a time assume seconds. Append 'ms' for milliseconds,
's' for seconds, 'm' for minutes, or 'h' for hours (e.g. 500ms).
  -4                         Use IPv4 only
  -6                         Use IPv6 only
  -U, --unixsock             Use Unix domain sockets only
  -C, --crlf                 Use CRLF for EOL sequence
  -c, --sh-exec <command>    Executes the given command via /bin/sh
  -e, --exec <command>       Executes the given command
      --lua-exec <filename>  Executes the given Lua script
  -g hop1[,hop2,...]         Loose source routing hop points (8 max)
  -G <n>                     Loose source routing hop pointer (4, 8, 12, ...)
  -m, --max-conns <n>        Maximum <n> simultaneous connections
  -h, --help                 Display this help screen
  -d, --delay <time>         Wait between read/writes
  -o, --output <filename>    Dump session data to a file
  -x, --hex-dump <filename>  Dump session data as hex to a file
  -i, --idle-timeout <time>  Idle read/write timeout
  -p, --source-port port     Specify source port to use
  -s, --source addr          Specify source address to use (doesn&#39;t affect -l)
  -l, --listen               Bind and listen for incoming connections
  -k, --keep-open            Accept multiple connections in listen mode
  -n, --nodns                Do not resolve hostnames via DNS
  -t, --telnet               Answer Telnet negotiations
  -u, --udp                  Use UDP instead of default TCP
      --sctp                 Use SCTP instead of default TCP
  -v, --verbose              Set verbosity level (can be used several times)
  -w, --wait <time>          Connect timeout
  -z                         Zero-I/O mode, report connection status only
      --append-output        Append rather than clobber specified output files
      --send-only            Only send data, ignoring received; quit on EOF
      --recv-only            Only receive data, never send anything
      --allow                Allow only given hosts to connect to Ncat
      --allowfile            A file of hosts allowed to connect to Ncat
      --deny                 Deny given hosts from connecting to Ncat
      --denyfile             A file of hosts denied from connecting to Ncat
      --broker               Enable Ncat&#39;s connection brokering mode
      --chat                 Start a simple Ncat chat server
      --proxy <addr[:port]>  Specify address of host to proxy through
      --proxy-type <type>    Specify proxy type ("http" or "socks4" or "socks5")
      --proxy-auth <auth>    Authenticate with HTTP or SOCKS proxy server
      --ssl                  Connect or listen with SSL
      --ssl-cert             Specify SSL certificate file (PEM) for listening
      --ssl-key              Specify SSL private key (PEM) for listening
      --ssl-verify           Verify trust and domain name of certificates
      --ssl-trustfile        PEM file containing trusted SSL certificates
      --ssl-ciphers          Cipherlist containing SSL ciphers to use
      --version              Display Ncat&#39;s version information and exit
登录后复制

nc常用案例

TCP监听测试

nc可作为server端192.168.10.11启动一个tcp的监听

nc -l 80
登录后复制

客户端测试方法:直接telnet该机器ip+端口

telnet 192.168.10.11 80

或:nmap 192.168.10.11 -p 80

UDP监听测试

nc作为server端启动一个udp的监听

nc -lu 80
登录后复制

通过netstat可以看到udp协议已经监听:

> # netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address   Foreign Address   State  PID/Program name   
udp        0      0 0.0.0.0:80      0.0.0.0:*                15401/nc
登录后复制

推荐教程:《centos教程

以上是centos下什么是nc的详细内容。更多信息请关注PHP中文网其他相关文章!

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
2 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
4 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
4 周前 By 尊渡假赌尊渡假赌尊渡假赌

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

centos怎么中文输入 centos怎么中文输入 Apr 07, 2024 pm 08:21 PM

CentOS 中使用中文输入的方法包括:使用 fcitx 输入法:安装并启用 fcitx,设置快捷键,按下快捷键切换输入法,输入拼音即可生成候选词。使用 iBus 输入法:安装并启用 iBus,设置快捷键,按下快捷键切换输入法,输入拼音即可生成候选词。

centos7怎么读取u盘文件 centos7怎么读取u盘文件 Apr 07, 2024 pm 08:18 PM

在 CentOS 7 中读取 U 盘文件,需要先连接 U 盘并确认其设备名称。然后,使用以下步骤读取文件:挂载 U 盘:mount /dev/sdb1 /media/sdb1(替换 "/dev/sdb1" 为实际设备名称)浏览 U 盘文件:ls /media/sdb1;cd /media/sdb1/目录;cat 文件名

centos7如何进入root权限 centos7如何进入root权限 Apr 02, 2024 pm 08:57 PM

进入 CentOS 7 的 root 权限有两种方法:使用 sudo 命令:终端输入 sudo su -,输入当前用户密码。直接登录 root 用户:登录屏幕选择 "Other",输入 "root" 和 root 密码。注意:在 root 权限下谨慎操作,以 sudo 权限执行任务,定期更改 root 密码。

SCP使用技巧-递归排除文件 SCP使用技巧-递归排除文件 Apr 22, 2024 am 09:04 AM

人们可以使用scp命令在网络主机之间安全地复制文件。它使用ssh进行数据传输和身份验证。典型的语法是:scpfile1user@host:/path/to/dest/scp-r/path/to/source/user@host:/path/to/dest/scp排除文件我不认为你可以在使用scp命令时过滤或排除文件。但是,有一个很好的解决方法来排除文件并使用ssh安全地复制它。本页面说明如何在使用scp递归复制目录时过滤或排除文件。如何使用rsync命令排除文件语法是:rsyncav-essh-

centos忘记密码登录怎么办 centos忘记密码登录怎么办 Apr 07, 2024 pm 07:33 PM

忘记 CentOS 密码的解决方案包括:单用户模式:进入单用户模式,使用 passwd root 重置密码。救援模式:使用 CentOS Live CD/USB 启动,挂载根分区并重置密码。远程访问:使用 SSH 远程连接,用 sudo passwd root 重置密码。

centos用户名密码忘了怎么办 centos用户名密码忘了怎么办 Apr 02, 2024 pm 08:54 PM

忘记 CentOS 用户名和密码后,有两种恢复访问权限的方法:重置 root 密码:重启服务器,在 GRUB 菜单中编辑内核命令行,添加“rw init=/sysroot/bin/sh”并按 Ctrl+x;单用户模式下挂载根文件系统并重置密码。使用救援模式:从 CentOS 安装 ISO 映像启动服务器,选择救援模式;挂载根文件系统,从 ISO 映像复制 chroot 环境,重置密码,退出 chroot 环境并重新启动服务器。

centos7怎么开启root权限 centos7怎么开启root权限 Apr 07, 2024 pm 08:03 PM

CentOS 7 默认禁用 root 权限,可按以下步骤开启:临时开启:终端输入 "su root",输入 root 密码。永久开启:编辑 "/etc/ssh/sshd_config",将 "PermitRootLogin no" 更改为 "yes",重启 SSH 服务。

centos7密码忘记了怎么办 centos7密码忘记了怎么办 Apr 02, 2024 pm 08:51 PM

CentOS 7 忘记密码的三种解决方法:单用户模式:重启系统,编辑内核选项,将 ro 更改为 rw init=/sysroot/bin/sh,使用 passwd 命令重置 root 密码。救援模式:从安装媒体启动,选择救援模式,挂载根文件系统,chroot 到根文件系统,使用 passwd 命令重置 root 密码。Grub2 命令行:重启系统,按 c 进入命令行,加载内核,挂载根文件系统,chroot 到根文件系统,使用 passwd 命令重置 root 密码。

See all articles