-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_swf.py
22 lines (17 loc) · 1014 Bytes
/
test_swf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from unittest import TestCase
from polydet import PolyglotLevel
from polydet.plugins import swf
class TestSWFDetector(TestCase):
def test_regular(self):
self.assertEqual(PolyglotLevel(), swf.check('tests/samples/swf/regular.fws9'))
self.assertEqual(PolyglotLevel(), swf.check('tests/samples/swf/regular.cws9'))
self.assertEqual(PolyglotLevel(), swf.check('tests/samples/swf/regular.zws13'))
def test_not_swf(self):
self.assertIsNone(swf.check('tests/samples/zip/regular.zip'))
def test_garbage_at_end(self):
self.assertEqual(PolyglotLevel(suspicious_chunks=[(0x1EC, 0xB5)]),
swf.check('tests/samples/swf/garbage-at-end.fws9'))
self.assertEqual(PolyglotLevel(suspicious_chunks=[(0x16B, 0xB5)]),
swf.check('tests/samples/swf/garbage-at-end.cws9'))
self.assertEqual(PolyglotLevel(suspicious_chunks=[(0x2A9, 0xB5)]),
swf.check('tests/samples/swf/garbage-at-end.zws13'))