Python 练习之 监控目录下是否创建、修改文件,并用pyclamd扫描
#Time: 2020/03/26
#Author: Xiaohong
#运行环境: OS: Raspberry Pi 4
# Python: 3.7
功能: 1.用WatchDog 检测目录 2. 用 pyclamd 扫描变动
效果如下:
源文件如下:
from watchdog.observers import Observer
from watchdog.events import *
import time
import pyclamd
from threading import Thread
import os
a = r"/home/pi/ClamLogs"
#a = r"F:\360Downloads"
class Scan2(Thread): # 继承多线程Thread类
def __init__(self, IP, scan_type, file):
"""构造方法"""
Thread.__init__(self)
self.IP = IP
self.scan_type = scan_type
self.file = file
self.connstr = ""
self.scanresult = ""
def run(self):
"""多进程run方法"""
try:
cd = pyclamd.ClamdNe