Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
- egrep (together with fgrep) has been deprecated since release 2.5.3 (2007), and will be soon obsoleted. Replaced with grep -E.
  • Loading branch information
ElfQrin authored Aug 12, 2023
1 parent 6be42a3 commit 59c3b09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ipcheck.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# IPcheck
xver='r2022-07-31 fr2020-09-12';
xver='r2023-08-12 fr2020-09-12';
# by Valerio Capello - http://labs.geody.com/ - License: GPL v3.0


Expand Down Expand Up @@ -521,7 +521,7 @@ echo; echo "Top IPs accessing the system now:"
conntot=$( netstat -an | wc -l )
if [ $conntot -gt 0 ]; then
connest=$( netstat -an | grep 'ESTABLISHED' | wc -l )
netstat -an | grep 'ESTABLISHED' | awk '{print $5}' | grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" | egrep -v "(`for i in \`ip addr | grep inet | grep eth0 | cut -d/ -f1 | awk '{print $2}'\`;do echo -n "$i|"| sed 's/\./\\\./g;';done`127\.|0\.0\.0)" | sort -n | uniq -c | sort -rn | head --lines=$nrestop # | nl -n rn -s '. '
netstat -an | grep 'ESTABLISHED' | awk '{print $5}' | grep -o "[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" | grep -E -v "(`for i in \`ip addr | grep inet | grep eth0 | cut -d/ -f1 | awk '{print $2}'\`;do echo -n "$i|"| sed 's/\./\\\./g;';done`127\.|0\.0\.0)" | sort -n | uniq -c | sort -rn | head --lines=$nrestop # | nl -n rn -s '. '
if [ $connest -gt 1 ]; then echo "$connest established connections."; else echo "$connest established connection."; fi
if [ $conntot -gt 1 ]; then echo "$conntot total connections."; else echo "$conntot total connection."; fi
else
Expand Down

0 comments on commit 59c3b09

Please sign in to comment.