我该如何查找使用root账户登录的尝试次数?
以下是我目前在Python中使用的代码:
myFile = open('file','r')
count_rr = 0
for line in myFile.readlines():
list_of_line = line.split(' ')
if 'root' in list_of_line[?]
print 'root'
count_rr = counter_rt + 1
以下是我尝试读取的文件中的两行内容:
Jan 10 09:32:46 j4-be03 sshd[3885]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=218.241.173.35 user=root
Jan 10 09:32:48 j4-be03 sshd[3885]: Failed password for root from 218.241.173.35 port 50212 ssh2