Esempio n. 1
0
 def test_rar5_unexpected_eof(self):
     self.assertEqual(PolyglotLevel(is_valid=False),
                      rar.check('tests/samples/rar/unexpected_eof.rar5'))
Esempio n. 2
0
 def test_rar3_regular(self):
     self.assertEqual(PolyglotLevel(),
                      rar.check('tests/samples/rar/regular.rar'))
Esempio n. 3
0
 def test_rar5_garbage_at_end(self):
     self.assertEqual(PolyglotLevel(suspicious_chunks=[(0x56, 0x343)]),
                      rar.check('tests/samples/rar/garbage-at-end.rar5'))
Esempio n. 4
0
 def test_rar5_no_endarc(self):
     self.assertEqual(PolyglotLevel(),
                      rar.check('tests/samples/rar/no-endarc.rar5'))
Esempio n. 5
0
 def test_rar5_garbage_at_beginning(self):
     self.assertEqual(
         PolyglotLevel(suspicious_chunks=[(0, 0x1F8)]),
         rar.check('tests/samples/rar/garbage-at-beginning.rar5'))
Esempio n. 6
0
 def test_rar5_garbage_at_end_no_endarc(self):
     # FIXME Should be (0x4E, 0xC1), but the current reader can't discard all the invalid blocks
     # when there is no ENDARC
     self.assertEqual(
         PolyglotLevel(is_valid=False, suspicious_chunks=[(0x62, 0xAD)]),
         rar.check('tests/samples/rar/garbage_at_end-no_endarc.rar5'))
Esempio n. 7
0
 def test_rar3_garbage_at_end_no_endarc_size_0(self):
     self.assertEqual(
         PolyglotLevel(is_valid=False, suspicious_chunks=[(0x52, 0xC1)]),
         rar.check('tests/samples/rar/garbage_at_end-no_endarc.rar'))
Esempio n. 8
0
 def test_rar3_garbage_everywhere(self):
     self.assertEqual(
         PolyglotLevel(suspicious_chunks=[(0, 0x2060), (0x20B9, 0x343)]),
         rar.check('tests/samples/rar/garbage-at-beginning-end.rar'))
Esempio n. 9
0
 def test_not_rar(self):
     self.assertIsNone(rar.check('tests/samples/zip/regular.zip'))