commit e3e8e3f92743744c2c48fab355b6a13c73a5c49c from: gonzalo date: Wed Nov 14 11:12:50 2018 UTC cosmetic thingi, lost function commit - adb1b8ae4c44734ced281dfa0579159dda4fc080 commit + e3e8e3f92743744c2c48fab355b6a13c73a5c49c blob - 880d614c8595ec9b7d12415c179a019f7ff52e67 blob + 2a7684793712af611a194528fe385e4e434f6d24 --- logs_analize +++ logs_analize @@ -4,113 +4,117 @@ LOGFILE="$1" RESPONSE_CODE="200" filters() { -grep $RESPONSE_CODE \ -| grep -v "" \ -| grep -v "favicon.ico" \ -| grep -v "logfile turned over" + grep $RESPONSE_CODE \ + | grep -v "" \ + | grep -v "favicon.ico" \ + | grep -v "logfile turned over" } filter_response_codes() { -grep -v "" \ -| grep -v "logfile turned over" \ -| awk '{print $10}' + grep -v "" \ + | grep -v "logfile turned over" \ + | awk '{print $10}' } filter_404_response() { -grep "404" + grep "404" } ips() { -awk '{print $2}' + awk '{print $2}' } +pages() { + awk '{print $8}' +} + domain() { -awk '{print $1}' + awk '{print $1}' } methods() { -awk '{print $7}' | cut -d'"' -f2 + awk '{print $7}' | cut -d'"' -f2 } sort_count() { -sort | uniq -c + sort | uniq -c } sort_desc() { -sort -rn + sort -rn } top_ten() { -head -10 + head -10 } sep() { -printf "\n" + printf "\n" } ## # Actions ## action_request_ips() { - sep - echo "[+] Top requests from IPs" - sep - cat $LOGFILE \ - | filters \ - | ips \ - | sort_count \ - | sort_desc \ - | top_ten - sep + sep + echo "[+] Top requests from IPs" + sep + cat $LOGFILE \ + | filters \ + | ips \ + | sort_count \ + | sort_desc \ + | top_ten + sep } action_request_methods() { - sep - echo "[+] Count requests methods" - sep - cat $LOGFILE \ - | filters \ - | methods \ - | sort_count - sep + sep + echo "[+] Count requests methods" + sep + cat $LOGFILE \ + | filters \ + | methods \ + | sort_count + sep } action_pages() { - sep - echo "[+] Top requested pages" - sep - cat $LOGFILE \ - | filters \ - | pages \ - | sort_count \ - | sort_desc \ - | top_ten - sep + sep + echo "[+] Top requested pages" + sep + cat $LOGFILE \ + | filters \ + | pages \ + | sort_count \ + | sort_desc \ + | top_ten + sep } action_404() { - sep - echo "[+] Top requests 404" - sep - cat $LOGFILE \ - | filter_404_response \ - | pages \ - | sort_count \ - | sort_desc \ - | top_ten - sep + sep + echo "[+] Top requests 404" + sep + cat $LOGFILE \ + | filter_404_response \ + | pages \ + | sort_count \ + | sort_desc \ + | top_ten + sep } action_response_codes() { - sep - echo "[+] Response code" - sep - cat $LOGFILE \ - | filter_response_codes \ - | sort_count \ - | sort_desc - sep + sep + echo "[+] Response code" + sep + cat $LOGFILE \ + | filter_response_codes \ + | sort_count \ + | sort_desc + sep } action_request_ips