说明

木马可能类似随机发送心跳包的操作,随机sleep。对这类情况写好了一个监听shell脚本,每隔一秒钟就记录下netstat状态。

代码

#!/bin/bash
#功能:用于定时执行lsof 和 netstat 的执行状态并记录到文件

slptime=1	#默认一秒执行一次
filedir=/tmp		#默认存储在/tmp下
lsoffile=lsof.log	#存储lsof的执行结果
netstatfile=netstatfile.log	#存储netstat执行结果



while true

do
	sleep $slptime
	date=$(date '+%Y-%m-%d %H:%M:%S')
	
	echo $date":" >> $filedir/$lsoffile
	echo $date":" >> $filedir/$netstatfile
	lsof -i	  >> $filedir/$lsoffile
	netstat -antlp >> $filedir/$netstatfile

done

相关文章:

  • 2021-11-19
  • 2021-08-13
  • 2022-12-23
  • 2021-11-30
  • 2021-06-03
  • 2022-01-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2021-04-23
  • 2021-05-24
  • 2022-12-23
相关资源
相似解决方案