Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Created by Pathogen @ www.hakhub.tk
- import subprocess as sp
- import re
- def RHL():
- num = 0
- cat = sp.Popen("cat /var/log/audit/audit.log",stdout = sp.PIPE,shell=True)
- results = cat.stdout.read()
- contents = re.split("\n",results)
- for line in contents:
- if re.search("USER_LOGIN",line):
- proc = re.split(" ",line)
- header = 0
- for word in proc:
- if re.findall("acct=",word):
- num = num + 1
- print "\nLogin attempt #"+str(num)+"\n___________________"
- print word
- header = 1
- elif re.findall("hostname=",word):
- if header == 0:
- num = num + 1
- print "\nLogin attempt #"+str(num)+"\n___________________"
- print word
- elif header == 1:
- print word
- elif re.findall("addr=",word):
- print word
- elif re.findall("res=",word):
- if re.findall("success",word):
- print word+" <---- User Login Successful! ----"
- else:
- print word
- def ubuntu():
- grep = sp.Popen("grep ssh /var/log/syslog",stdout = sp.PIPE,shell=True)
- output = grep.stdout.read()
- contents = re.split("\n",output)
- for line in contents:
- print line
Advertisement
Add Comment
Please, Sign In to add comment