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

Summarize several methods of port state judgment in Linux environment.

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Nc command

Syntax: nc-z-v-n IPADDRESS port

-z for port scanning only, 0 input and output

-v displays the instruction execution process

-n use the IP address directly, not through the domain name server

[root@shansibleqa] # nc-z-v-n IP 22Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to IP:22.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. [root@shansibleqa] # nc-z-v-n IP 587Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to IP:587.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.

2. Wget command

Syntax: wget ip:port

If it passes through

[root@shansibleqa] # wget IP:22--2019-12-24 17 wget IP:22--2019 43 wget IP:22--2019 50-http://IP:22/Connecting to IP:22... Connected.HTTP request sent, awaiting response... 200 No headers, assuming HTTP/0.9Length: unspecified

If it doesn't work,

[root@shansibleqa] # wget IP:80--2019-12-24 17 wget IP:80--2019 43 wget IP:80--2019 56-http://IP/Connecting to IP:80... Failed: No route to host.

3. Shell command

Syntax: ssh-v-p port IP

Be able to connect

[root@shansibleqa] # ssh-v-p 80 XX.XX.XX.XXOpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017debug1: Reading configuration data / etc/ssh/ssh_configdebug1: / etc/ssh/ssh_config line 58: Applying options for * debug1: Connecting to XX.XX.XX.XX [XX.XX.XX.XX] port 80.debug1: Connection established.debug1: permanently_set_uid: 0

Can't connect.

[root@shansibleqa] # ssh-v-p 23 XX.XX.XX.XXOpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017debug1: Reading configuration data / etc/ssh/ssh_configdebug1: / etc/ssh/ssh_config line 58: Applying options for * debug1: Connecting to XX.XX.XX.XX [XX.XX.XX.XX] port 23.debug1: connect to address XX.XX.XX.XXport 23: Connection timed outssh: connect to host XX.XX.XX.XXport 23: Connection timed out

4. Curl command

Syntax: curl ip:port

Port communication

[root@shansibleqa ~] # curl ip:22SSH-2.0-OpenSSH_7.4curl: (56) Recv failure: Connection reset by peer

The port is blocked.

[root@shansibleqa ~] # curl ip:443curl: (52) Empty reply from server

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

Servers

Wechat

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

12
Report