Displays a list of all open ports on the local Linux system

! # bin / bash
# Author: liusingbon
# function: observation port from the port list, turn off unused ports corresponding service, reducing the possibility of accidental attack
ss -nutlp | awk '{print $ 1, $ 5}' | awk -F "[:]" '{print " protocol:" $ 1 "port number:" $ NF}' | grep "[0-9]" | uniq

The results show:

# Bash Portcheck.sh
protocol: udp Port number: 323
Protocol: udp Port number: 888
Protocol: udp Port number: 972
Protocol: udp Port number: 34256
Protocol: udp Port number: 2049
Protocol: udp Port number: 20048
Protocol: udp port number: 53303
protocol: udp port number: 5353
protocol: udp port number: 46531
protocol: udp port number: 55351
protocol: udp port number: 53
protocol: udp port number: 67
protocol: udp port number: 68
protocol: udp port No: 111
protocol: UDP port number: 123
protocol: UDP port number: 323
protocol: UDP port number: 972
protocol: UDP port number: 2049
protocol: UDP port number: 51924
protocol: UDP port number: 52756
protocol: UDP port number : 20048
protocol: UDP port number: 45702
protocol: UDP port number: 5353
protocol: UDP port number: 111
protocol: TCP port number: 33756
protocol: TCP port number: 445
protocol: TCP port number: 2049
protocol: TCP port number: 56105
protocol: TCP port number: 139
Protocol: TCP port number: 5900
Protocol: TCP Port number: 111
Protocol: TCP port number: 20048
Protocol: TCP Port Number: 53
Protocol: TCP Port Number: 22
Protocol: TCP Port number: 631
Protocol: TCP Port Number: 25
Protocol : TCP port number: 1017
protocol: TCP port number: 445
protocol: TCP port number: 2049
protocol: TCP port number: 139
protocol: TCP port number: 111
protocol: TCP port number: 80
protocol: TCP port number: 20048
protocol: tcp port number: 57684
protocol: tcp port number: 38261
protocol: tcp port number: 21
protocol: tcp port number: 22
protocol: tcp port number: 631
protocol: tcp port number: 25

Guess you like

Origin www.cnblogs.com/liusingbon/p/11199860.html