Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of the nc command in Linux

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how the nc command works in Linux. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

Linux common command nc command full name netcat, used to set up the router. It can read and write data over TCP and UDP networks. By combining with other tools and redirects, you can use it in multiple ways in scripts. It's amazing what can be done with the netcat command.

nc is used to set up routers and is the swiss army knife in network tools

phrasing nc [-hlnruz][-g][-G][-i][-o][-p] [-s][-v...] [-w][Host Name][Communication Port...] Option-g Sets router hop communication gateways up to 8. -G Sets the source route pointer to a multiple of 4. -h Online help. -i Set time intervals for transmitting messages and scanning communication ports. -l Use listening mode to control incoming data. -n Use IP addresses directly, not through a domain name server. -o Specifies the name of the file into which the incoming and outgoing data is stored in hexadecimal notation. -p Sets the communication port used by the local host. -r random number Specifies the communication port between the local and remote hosts. -s Sets the IP address of the local host sending packets. -u Uses UDP transport protocol. -v shows the execution of the command. -w Sets the time to wait for a connection. -z Use 0 input/output mode, only when scanning communication ports. Example TCP Port Scan

[root@localhost ~]# nc -v -z -w2 192.168.0.3 1-100 192.168.0.3: inverse host lookup failed: Unknown host (UNKNOWN) [192.168.0.3] 80 (http) open (UNKNOWN) [192.168.0.3] 23 (telnet) open (UNKNOWN) [192.168.0.3] 22 (ssh) open scan port range of 192.168.0.3 is 1-100 scan UDP port

[root@localhost ~]# nc -u -z -w2 192.168.0.1 1-1000 #scan 192.168.0.3 port range is 1-1000 scan specified port

[root@localhost ~]# nc -nvv 192.168.0.1 80 #scan 80 port (UNKNOWN) [192.168.0.1] 80 (?) open y //user input to see if outbound port 443 from server to destination is blocked by firewall

nc -vz acme-v02.api.letsencrypt.org 443 -w2 # Ncat: Version 7.50 ( https://nmap.org/ncat ) # Ncat: Connected to 23.77.214.183:443. # Ncat: 0 bytes sent, 0 bytes received in 0.07 seconds. About "What is the use of nc command in Linux" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report