NNTPSimpleFilter_Test.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:newsreap 作者: caronc 项目源码 文件源码
def test_blacklist_bad_files(self):
        """
        Blacklist testing of bad files
        """

        sf = NNTPSimpleFilter()
        entry = copy(self.template_entry)

        # hash table always starts empty and is populated on demand
        assert len(sf._regex_hash) == 0

        # Test against bad file extensions:
        for e in [ 'exe', 'pif', 'application', 'gadget', 'msi', 'msp', 'com',
                  'scr', 'hta', 'cpl', 'msc', 'jar', 'bat', 'vb', 'vbs',
                  # Encrypted VBE Script file
                  'vbe',
                  # Javascript (Windows can execute these outside of browsers)
                  # so treat it as bad
                  'js', 'jse',
                  # Windows Script File
                  'ws', 'wsf',
                  # Windows PowerShell Scripts
                  'ps1', 'ps1xml', 'ps2', 'ps2xml', 'psc1', 'psc2',
                  # Monad Scripts (later renamed to Powershell)
                  'msh', 'msh1', 'msh1xml', 'msh2', 'msh2xml',
                  # Windows Explorer Command file
                  'scf',
                  # A link to a program on your computer (usually
                  # populated with some malicious content)
                  'lnk',
                  # A text file used by AutoRun
                  'inf',
                  # A windows registry file
                  'reg',
                 ]:

            entry['subject'] = 'What.A.Great.Show (1/1) ' +\
                    '"what.a.great.show.%s" Yenc (1/1)' % e

            assert sf.blacklist(**entry) == True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号