玄机第二章日志分析-apache日志分析
0x01 question
知识
首先我们要知道日志两种
1 | access.log\error.log |
当然有备份.1
也是正常的
在哪里
- /var/log/httpd/
- /var/log/apache/
- /var/log/apache2/
OK那我们就可以开始了
action
首先进来查找发现是有备份文件的
1 | find / -name "*access.log*" 2>/dev/null |
有服务器的小伙伴都知道是类似于这种
1 | 206.168.34.214 - - [30/Oct/2024:14:11:08 +0000] "GET / HTTP/1.1" 403 134 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)" |
IP+时间+请求头
1 | root@ip-10-0-10-1:~# grep '03/Aug/2023' /var/log/apache2/access.log.1 | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 1 |
还有就是看所有IP
1 | root@ip-10-0-10-1:~# awk '{print $1}' /var/log/apache2/access.log.1 | uniq -c | sort -n |
查找黑客IP指纹
1 | grep -Ea "192.168.200.2" /var/log/apache2/access.log.1 |
指纹值为这个
1 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 |
然后查看index.php
被访问了多少次
1 | root@ip-10-0-10-1:~# grep -Ea '/index.php' /var/log/apache2/access.log.1 | wc -l |
wc -l
用来统计有多少行
1 | root@ip-10-0-10-1:~# grep -Ea "^192.168.200.2 - -" /var/log/apache2/access.log.1 | wc -l |
1 | root@ip-10-0-10-1:~# grep '03/Aug/2023:08:' /var/log/apache2/access.log.1 | awk '{print $1}' | sort | uniq | wc -l |
0x02 小结
还是命令的使用,多知道了一点常识
- Title: 玄机第二章日志分析-apache日志分析
- Author: baozongwi
- Created at : 2024-10-31 20:31:28
- Updated at : 2024-10-31 21:00:00
- Link: https://baozongwi.xyz/2024/10/31/玄机第二章日志分析-apache日志分析/
- License: This work is licensed under CC BY-NC-SA 4.0.
Comments