This commit is contained in:
n1nj4sec 2016-11-17 20:22:24 +01:00
commit 38c2fadbaf
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from pupylib.PupyModule import *
from modules.lib.utils.shell_exec import shell_exec
__class_name__="ClearLogs"
@config(cat="admin", compat=["windows"])
class ClearLogs(PupyModule):
""" clear event logs """
def init_argparse(self):
self.arg_parser = PupyArgumentParser(prog="clear_logs", description=self.__doc__)
def run(self, args):
if self.client.desc['intgty_lvl'] != "High":
self.error('You need admin privileges to clear logs')
return
powershell_cmd = '$events_logs="application","security","setup","system"; ForEach ($event in $events_logs) { [System.Diagnostics.Eventing.Reader.EventLogSession]::GlobalSession.ClearLog("$event")}'
output = shell_exec(self.client, powershell_cmd, shell='powershell.exe')
if not output:
self.success('Logs deleted successfully')
else:
self.error('An error occured: \n%s' % output)