1.因为我linux的python是2.6.6,所以因为有些模块是2.7的,先进行升级。
2.安装pyclamd
yum install -y clamav clamd clamav-update 安装clamavp的相关程序包
chkconfig --level 235 clamd on
/usr/bin/freshclam
pyClamd-0.3.15.tar.gz安装包安装
3.vim /etc/clamd.conf
把本机的127.0.0.1,修改成0.0.0.0 监控所有IP
/etc/init.d/clamd restart
4.扫描脚本 scan_file.py
# -*- coding: utf-8 -*-
import time
import pyclamd
from threading import Thread
class Scan(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.C