玄机-日志分析-ssh日志分析
玄机-日志分析-ssh日志分析
简介:
SSH 连接端口222 账号 root 密码 toor
1.可以登录的SSH的账号是多少
查看可以登录的账号需要去ssh配置文件sshd_config中
cat /etc/ssh/sshd_config

看到只有SSHD_USER组可以连接
查看用户组
cat etc/group

flag{2}
2、SSH日志中登录成功的日志条数是多少(去除自己登陆产生的两次)
前往日志目录
构造命令
cat auth.log | grep -a "Accepted" | wc -l
cat auth.log.1 | grep -a "Accepted" | wc -l
gunzip -c auth.log.2.gz > auth.log.2
cat auth.log.2 | grep -a "Accepted" | wc -l

查出来是110条
但是答案是103
flag{103}
答案不正确的原因可能是命令构造的不够精准
3、SSH日志中登录成功次数最多的用户的用户名是什么
继续查看日志,构造命令
cat auth.log.2 | grep "Accepted" | awk '{print $9}'| sort | uniq -c
cat auth.log.1 | grep "Accepted" | awk '{print $9}'| sort | uniq -c

标准日志格式:
Apr 15 04:30:16 debian sshd[739]: Accepted password for root from 192.168.11.1 port 59169 ssh2
4、SSH日志中登录失败次数最多的用户以及登录使用的ip是什么(flag:flag{用户名,ip})
构造命令
at auth.log.2 | grep "Failed password for" | awk '{print $9}'| sort | uniq -c
at auth.log.1 | grep "Failed password for" | awk '{print $9}'| sort | uniq -c

在找到后对root所用到的ip进行查找
cat auth.log.1 | grep "Failed password for root" | awk '{print $11}'| sort | uniq -c
cat auth.log.2 | grep "Failed password for root" | awk '{print $11}'| sort | uniq -c

浙公网安备 33010602011771号