ClamAv开源杀毒引擎详解

更新时间:2023-07-26 03:02:16 阅读: 评论:0

ClamAv 开源杀毒引擎详解
打一个字的谜语最近公司在弄⽂件交换系统,为了确保⽂件交换安全执⾏,需要添加⽂件扫描杀毒功能。系统要实现调⽤杀毒引擎,对⽂件查杀。和国内外⽐较著名、熟知的杀毒⼚商(360、瑞星、⾦⼭、⼩红伞等)联系,均告知没有提供相应的接⼝供第三⽅调⽤。百度搜索中还发现有⼈使⽤⾦⼭制作杀毒u 盘,具体过程就是使⽤安装后的⾦⼭的dll ⽂件和病毒库,实现病毒查杀,但这都是10年前的知识了,⽽且现在⾦⼭都是云查杀,本地都没有病毒库。各种查找⽆果,就想有没有⼀些开源的杀毒引擎,百度⼀下,没想到还真有—-ClamAv 。
ClamAv ⽀持较多OS ,针对相应的OS ,选择安装程序(本⼈使⽤的是windows 32系统,见下图):
ClamWin is  a Free Antivirus program for  Microsoft Windows 10 / 8 / 7 / Vista / XP / Me / 2000 / 98 and  Windows Server 2012, 2008 and  2003.ClamWin Free Antivirus is  ud by  more than 600,000 urs worldwide on  a daily basis. It comes with  an easy installer and  open source code. You may download Ⅰ.High detection rates for  virus and  spyware;Ⅱ.Scanning Scheduler;Ⅲ.Automatic downloads of  regularly updated Virus Databa.Ⅳ.Standalone virus scanner and  right-click menu integration to  Microsoft Windows Explorer;Ⅳ.Addin to  Microsoft Outlook to  remove virus-infected attachments automatically.The latest version  of  Clamwin Free Antivirus is  0.99.1Plea note that  ClamWin Free Antivirus does  not  include an on -access real -time  scanner. You need to  manually scan a file  in  order to  detect a virus or  spyware.ClamWin Free Antivirus is  bad on  ClamAV engine and  us GNU General Public Licen by  the  Free Software Foundation, and  is  free (as  in  freedom) software. To
1
2
3
4
5
6
7
8
莲子糖水
做贺卡的步骤9
10
加勒比海盗五11
Clamwin安装后界⾯如下:
使⽤clamwin和360杀毒对本⼈E盘分别进⾏杀毒,扫描结果两者有相同的扫描结果,也有不⼀致的,效果各有千秋吧。结果说明clamav引擎可以使⽤,开始研究源码,准备将clamav嵌⼊公司⽂件交换系统中。
2. 源码
抄盘手使⽤vs2010打开源码,项⽬列表如下(涂抹是个⼈后建的项⽬,忽略掉):
整个解决⽅案中,libclamav 是最关键的,libclamav 是⼀个dll ⼯程,其它⼯程均是引⽤该⼯程。clamav ⽤到了openssl 库,计算机需要安装openssl ,否则项⽬⽆法编译成功。我使⽤的是windows7,openssl 安装过程参照了以下两位博主的安装过程:
中华有神功>九下历史书安装过程如果出错,可以多试⼏次,或百度解决(我就遇到了,具体问题不清楚了,不过问题很好解决,百度就有答案)。openssl 我是安装在【C:\openssl 】下,安装完毕后,右击libclamav 项⽬【属性】,选择【配置属性】->【c/c++】->【常规】,在【附件包含⽬录】中添加“C:\openssl\include”⽬录即可。对于其它需要⽤到openssl 库的⼯程,同样执⾏操作。展开libclamav 项⽬,发现项⽬下⾯有libeasy32.lib 和ssleasy32.lib ,说明项⽬需要libeasy32.dll 和ssleasy32.dll 。在安装后的“C:\openssl\out32dll”下,找到libeasy32.dll 、libeasy32.lib 和
ssleasy32.dll 、ssleasy32.lib ⽂件,将其拷贝到libclamav ⼯程中libeasy32.lib 显⽰的路径(在vs 中点击libeasy.lib,在【属性】窗⼝中【项⽬⽂件】查看具体路径)。这样clamav 就可以编译成功!
ClamAv 病毒查杀主要包括两个过程:1.创建病毒扫描引擎;2.⽂件扫描。
①病毒扫描引擎创建
创建病毒扫描引擎代码步骤如下:
野餐垫②⽂件扫描
⽂件扫描⽅法:int  cl_init(unsigned  int  options);//初始化函数,必须执⾏该函数,返回为CL_SUCCESS (值为0)表⽰成功struct  cl_engine *cl_engine_new(void );//创建⼀个新的扫描引擎,需要注意的是,⽂件扫描完成需要使⽤cl_engine_free()这个⽅法释放掉引擎,否则造成内存泄漏
int  cl_load(const  char  *path, struct  cl_engine *engine,unsigned  int  *signo, unsigned  int  options);//加载病毒库(path 为病毒库⽬录),加载成功返回CL_SUCCESS ,本⼈病毒路径使⽤的是clamwin 中的病毒库路径int  cl_engine_compile(struct  cl_engine *engine);//引擎编译,为⽂件扫描准备1
2
3
4
5int  cl_scanfile(const  char  *filename, const  char  **virname,unsigned  long  int  *scanned, const  struct  cl_engine *engine,unsigned  int  options);//传⼊⽂件路径;病毒引1
⽬前病毒引擎已经调⽤成功,具体每个⽅法没有去深⼊理解。

本文发布于:2023-07-26 03:02:16,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1096843.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:引擎   扫描   杀毒   病毒   安装   过程   没有
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图