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
评论列表
文章目录