Awk Scan for wp-login
Luke Hebert
- 2 minutes read - 223 wordsIf you manage a WordPress site and want to know which IPs are hammering your login page, a single awk pipeline over your access log does the job in seconds. The command below counts wp-login.php hits per IP and prints only those that exceed a threshold of five requests.
The Command
tail -500 theultimateguidetowpnet.internet-marketing-muscle.com \
| awk '$7 ~ /\/wp-login.php/ {print}' \
| awk '{print $1}' \
| uniq -c \
| while read ct ip; do
if [[ $ct -gt 5 ]]; then
echo "$ip"
fi
doneHow It Works
tail -500grabs the last 500 lines of the named access log file.- First
awkfilters for lines where the request URI (field 7) contains/wp-login.php. - Second
awkextracts the client IP (field 1). uniq -ccounts consecutive identical IPs.- The
whileloop prints only IPs whose count is greater than 5.
Tips
- Swap
tail -500forcator a date-range filter if you need a wider window. - Adjust the
-gt 5threshold to match your normal traffic baseline. - Pipe the output into
whoisor a threat-intel lookup to identify the source. - If your log format differs (e.g., combined vs. common), verify that field 7 is still the URI before running the filter.
This is a fast, dependency-free way to surface suspicious login-page activity without pulling in a full log-analysis tool.