Intruder reporting tool (for ssh remote login)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Intruder reporting tool (for ssh remote login)相关的知识,希望对你有一定的参考价值。

#!/bin/bash

#Filename:intruder_detect.sh

#Description: Intruder reporting tool withauth.log or secure input(ssh登录的日志/var/log/auth.log 如果没有这个文件系统登录日志则放在 /var/log/secure)

AUTHLOG=/var/log/auth.log

 

if [[ -n $1 ]];

then

  AUTHLOG=$1

  echo Using Log file : $AUTHLOG

fi

 

LOG=/tmp/valid.$$.log

grep -v "invalid"$AUTHLOG > $LOG

users=$(grep "Failedpassword" $LOG | awk ‘{ print $(NF-5) }‘ | sort | uniq)

 

printf"%-5s|%-10s|%-10s|%-13s|%-33s|%s\\n" "Sr#" "User""Attempts" "IP address" "Host_Mapping" "Timerange"

 

ucount=0;

 

ip_list="$(egrep -o"[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" $LOG | sort | uniq)"

 

for ip in $ip_list;

do

  grep $ip $LOG > /tmp/temp.$$.log

 

for user in $users;

do

  grep $user /tmp/temp.$$.log> /tmp/$$.log

  cut -c-16 /tmp/$$.log > $$.time

  tstart=$(head -1 $$.time);

  start=$(date -d "$tstart""+%s");

 

  tend=$(tail -1 $$.time);

  end=$(date -d "$tend""+%s")

 

  limit=$(( $end - $start ))

 

  if [ $limit -gt 120 ];

  then

    let ucount++;

 

    IP=$(egrep -o"[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" /tmp/$$.log | head -1 );

 

  TIME_RANGE="$tstart-->$tend"

 

  ATTEMPTS=$(cat /tmp/$$.log|wc -l);

 

  HOST=$(host $IP | awk ‘{ print $NF }‘ )

 

 printf"%-5s|%-10s|%-10s|%-10s|%-33s|%-s\\n" "$ucount""$user" "$ATTEMPTS" "$IP" "$HOST""$TIME_RANGE";

 fi

 

done

 

done

 

rm /tmp/valid.$$.log/tmp/$$.log $$.time /tmp/temp.$$.log 2> /dev/null


以上是关于Intruder reporting tool (for ssh remote login)的主要内容,如果未能解决你的问题,请参考以下文章

因为Google Chrome中Software Reporter Tool占CPU用过高,我选择转战Microsoft Edge浏览器,电脑至于不卡了

因为Google Chrome中Software Reporter Tool占CPU用过高,我选择转战Microsoft Edge浏览器,电脑至于不卡了

Unity3D插件Build Report Tool插件,Build报告,优化包体,查看资源占用

[工具] BurpSuite--Intruder功能

BurpSuite之Intruder

Burp-Intruder模块详解