费尔防火墙源代码阅读

费尔防火墙使用了重载系统提供的winsock.dll动态链接库的方法,实现网络数据包的检查;winsock.dll在系统启动时自动加载,ie等网络程序利用了其中提供的WSPSend、WSPRecv等函数实现数据包的收发过程;通过重载这个dll文件,费尔防火墙程序实现了自己的一个动态链接库xfilter.dll(好像是),其中导出了WSPStartup函数和XfIoControl函数,第一个函数将指向winsock.dll的lpWSPSocket、lpWSPCloseSocket、lpWSPConnect、lpWSPAccept、lpWSPSend、lpWSPSendTo、lpWSPRecv、lpWSPRecvFrom函数的指针指向自己实现的函数,名称就是去掉了lp前缀,这样就可以在数据包收发之前进行包检查,从而实现防火墙的功能,达到包过滤目的;这些替换函数称作钩子函数hook function。

ACL(maybe Access Control Link,访问控制链),用来过滤所有进出网络的包的规则库;费尔将规则存在这个链中,对每一个防火墙截获的包,利用规则进行相应的匹配,从而完成转发、丢弃等功能;这里用了一个类:CAclFile;规则类与包检查类的interface是CCheckAcl::GetAccessFromAcl函数。

来看看CAclFile类的内部结构吧!

费尔维护了一个名为xacl.cfg的文件,文件内容就是关于包过滤规则的;这样CAclFile类里就有一个CFile类成员mAclFile;文件内容就是CAclFile类的成员mAclHeader、mAclIntranetIP、mAclTime、mpAclDistrustIP、mpAclTrustIP、mpAclCustomIP、mpAcl这7个&#x

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
Xfilter 源代码完整的文件列表 ------------------------------------------------------ .\Common .\Lib .\Property .\Release .\TcpIpDog .\Xfilter.dsw .\readme.txt .\filelist.txt .\Common\XLogFile.h .\Common\XLogFile.cpp .\Common\XInstall.cpp .\Common\XFile.h .\Common\XInstall.h .\Common\XFile.cpp .\Common\Debug.h .\Common\XFileRes.h .\Lib\htmlhelp.h .\Lib\htmlhelp.lib .\Property\Property.opt .\Property\Property.aps .\Property\Property.dsp .\Property\Property.rc .\Property\Property.clw .\Property\ReadMe.txt .\Property\resource.h .\Property\NetIPAria.h .\Property\GuiRes.h .\Property\AclSet.cpp .\Property\SetTime.h .\Property\Acl.cpp .\Property\SetNet.h .\Property\MainSheet.h .\Property\AclSet.h .\Property\Register.h .\Property\SystemSet.cpp .\Property\Splash.h .\Property\Property.dsw .\Property\Acl.h .\Property\Property.ncb .\Property\Splash.cpp .\Property\Property.h .\Property\LogQuery.h .\Property\SetTime.cpp .\Property\MainSheet.cpp .\Property\SetNet.cpp .\Property\NetIPAria.cpp .\Property\About.cpp .\Property\StdAfx.h .\Property\StdAfx.cpp .\Property\SystemSet.h .\Property\Register.cpp .\Property\About.h .\Property\LogQuery.cpp .\Property\Property.cpp .\Property\NetTimeSheet.h .\Property\PacketMonitor.h .\Property\Property.plg .\Property\NetTimeSheet.cpp .\Property\PacketMonitor.cpp .\Property\Internet .\Property\MainFrame .\Property\SystemTray .\Property\res .\Property\HyperLink .\Property\Internet\Internet.cpp .\Property\Internet\Internet.h .\Property\MainFrame\MainFrame.cpp .\Property\MainFrame\mainframe.h .\Property\SystemTray\SystemTray.cpp .\Property\SystemTray\SystemTray.h .\Property\res\Property.rc2 .\Property\res\NULL.ico .\Property\res\Property.ico .\Property\res\about.bmp .\Property\res\Alert.ico .\Property\res\DenyEx1.ico .\Property\res\PassEx1.ico .\Property\res\QueryEx1.ico .\Property\res\splash.bmp .\Property\res\MEMO.ICO .\Property\res\ALERTSET.ICO .\Property\res\APPSET.ICO .\Property\res\BASESET.ICO .\Property\res\COMMONSET.ICO .\Property\res\Monitor.ico .\Property\res\NETSET.ICO .\Property\res\SUPERSET.ICO .\Property\res\TIMESET.ICO .\Property\res\Xfilter.ico .\Property\res\IPSET.ICO .\Property\res\Email.ico .\Property\res\QueryResult.ico .\Property\res\QuerySet.ICO .\Property\res\UserInfo.ico .\Property\res\ACLSET.ICO .\Property\res\Message.ico .\Property\HyperLink\HyperLink.cpp .\Property\HyperLink\HyperLink.h .\Release\xacl.cfg .\Release\Xfilter.chm .\Release\Xfilter.exe .\Release\Xfilter.dll .\Release\xlog.dat .\TcpIpDog\StdAfx.cpp .\TcpIpDog\TcpIpDog.dsp .\TcpIpDog\LspServ.def .\TcpIpDog\ReadMe.txt .\TcpIpDog\CheckAcl.cpp .\TcpIpDog\TcpIpdog.cpp .\TcpIpDog\Codes.h .\TcpIpDog\TcpIpDog.h .\TcpIpDog\ProtocolInfo.h .\TcpIpDog\CheckAcl.h .\TcpIpDog\StdAfx.h .\TcpIpDog\ProtocolInfo.cpp .\TcpIpDog\TcpIpDog.plg

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值