forked from cuzv/mark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetectsrv
More file actions
executable file
·29 lines (27 loc) · 969 Bytes
/
detectsrv
File metadata and controls
executable file
·29 lines (27 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Program:
# Using netstat and grep to detect WWW,SSH,FTP and Mail services.
# History:
# 2005/08/28 VBird First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# 1. 先作一些告知的动作而已~
echo "Now, I will detect your Linux server's services!"
echo -e "The www, ftp, ssh, and mail will be detect! \n"
# 2. 开濮????行一些测试的工作,并且也输出一些资讯罗!
testing=$(netstat -tuln | grep ":80 ") # 侦测看 port 80 在否?
if [ "$testing" != "" ]; then
echo "WWW is running in your system."
fi
testing=$(netstat -tuln | grep ":22 ") # 侦测看 port 22 在否?
if [ "$testing" != "" ]; then
echo "SSH is running in your system."
fi
testing=$(netstat -tuln | grep ":21 ") # 侦测看 port 21 �??否?
if [ "$testing" != "" ]; then
echo "FTP is running in your system."
fi
testing=$(netstat -tuln | grep ":25 ") # 侦娴???? port 25 在否?
if [ "$testing" != "" ]; then
echo "Mail is running in your system."
fi