Skip to content

Instantly share code, notes, and snippets.

@angelikatyborska
Created April 27, 2018 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelikatyborska/566a34ad21be13ff33bb17fc82bceed2 to your computer and use it in GitHub Desktop.
Save angelikatyborska/566a34ad21be13ff33bb17fc82bceed2 to your computer and use it in GitHub Desktop.
List the number of open HTTP connections per IP in Linux

List the number of open HTTP connections per IP in Linux

This was useful when fighting a DDoS attack on one of our web servers.

Credit for it goes to our server provider, Memset, who helped us to stop the attack.

#!/bin/bash
netstat -an | grep :80 | grep -v FIN_WAIT | awk {'print $5'} | cut -d: -f 1 | sort | uniq -c | sort -nk 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment