Linux-Shell checks which hosts have enabled anonymous FPT service.
Experimental requirements:
Check which hosts enable anonymous FPT service
The scanning object is all IP addresses in the / etc/ethers file, and the scanning port number is 21.
Environment description:
Assume that the 192.168.10.2 host is an anonymous FTP and 192.168.10.3 is a non-anonymous FTP.
Create a scan file / etc/ethers with the following contents:
The wget download tool is used here (you need to install it first): wget ftp://IP/
Write a script:
1. Create a script called scanhost.sh with vi
The screenshot is as follows:
The contents are as follows:
#! / bin/bash
TARGET=$ (awk'{print $IP}'/ etc/ethers)
Echo "follow is anonymous FTP server:"
For IP in $TARGET
Do
Wget-T 3murt 3 ftp://$IP/ & > / dev/null
If [$?-eq 0]
Then
Echo $IP
Fi
Done
[parameter hint:-T connection timeout;-t connection retries]
2. Add x permissions to the script scanhost.sh
3. Execute the script to view the scanned information
4. Use the wget download tool to access the FTP root directory to verify whether anonymous FTP is really enabled.
Note: a non-zero value is returned when wget is executed, indicating that the anonymous FTP service is not enabled
Welcome to the official account of Wechat: Xiao Wen study Society.