How to use assertLess method in pytest-benchmark

Best Python code snippet using pytest-benchmark

zziptests.py

Source:zziptests.py Github

copy

Full Screen

...453 exe = self.bins("zzdir")454 run = shell("{exe} {getfile} ".format(**locals()))455 self.assertIn(' README\n', run.output)456 self.assertIn(' defl:N ', run.output)457 self.assertLess(len(run.output), 30)458 def test_20021_zzdir_test1_zip(self):459 """ run zzdir on test1.zip using just 'test1' """460 zipfile = "test1.zip"461 getfile = "test1"462 exe = self.bins("zzdir")463 run = shell("{exe} {getfile} ".format(**locals()))464 self.assertIn(' file.1\n', run.output)465 self.assertIn(' file.2\n', run.output)466 self.assertIn(' file.9\n', run.output)467 self.assertIn(' README\n', run.output)468 self.assertIn(' defl:N ', run.output)469 self.assertIn(' stored ', run.output)470 def test_20022_zzdir_test2_zip(self):471 """ run zzdir on test2.zip using just 'test2' """472 zipfile = "test2.zip"473 getfile = "test2"474 exe = self.bins("zzdir")475 run = shell("{exe} {getfile} ".format(**locals()))476 self.assertIn(' file.01\n', run.output)477 self.assertIn(' file.22\n', run.output)478 self.assertIn(' file.99\n', run.output)479 self.assertIn(' defl:N ', run.output)480 self.assertIn(' stored ', run.output)481 def test_20023_zzdir_test3_zip(self):482 """ run zzdir on test3.zip using just 'test3' """483 zipfile = "test3.zip"484 getfile = "test3"485 exe = self.bins("zzdir")486 run = shell("{exe} {getfile} ".format(**locals()))487 self.assertIn(' file.001\n', run.output)488 self.assertIn(' file.222\n', run.output)489 self.assertIn(' file.999\n', run.output)490 self.assertIn(' defl:N ', run.output)491 self.assertIn(' stored ', run.output)492 def test_20024_zzdir_test4_zip(self):493 """ run zzdir on test4.zip using just 'test4' """494 zipfile = "test4.zip"495 getfile = "test4"496 exe = self.bins("zzdir")497 run = shell("{exe} {getfile} ".format(**locals()))498 self.assertIn(' file0001.txt\n', run.output)499 self.assertIn(' file2222.txt\n', run.output)500 self.assertIn(' file9999.txt\n', run.output)501 self.assertNotIn(' defl:N ', run.output)502 self.assertIn(' stored ', run.output)503 def test_20320_zzxordir_test0_dat(self):504 """ run zzxordir on test0x.dat """505 zipfile = "test0x.dat"506 getfile = "test0x.dat"507 exe = self.bins("zzdir")508 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])509 self.assertEqual(run.returncode, 1)510 self.assertEqual("", run.output)511 self.assertIn("did not open test", run.errors)512 exe = self.bins("zzxordir")513 run = shell("{exe} {getfile} ".format(**locals()))514 self.assertIn(' README\n', run.output)515 self.assertIn(' defl:N ', run.output)516 self.assertLess(len(run.output), 30)517 def test_20321_zzxordir_test1_dat(self):518 """ run zzxordir on test1x.dat using just 'test1x' """519 zipfile = "test1x.dat"520 getfile = "test1x.dat"521 exe = self.bins("zzdir")522 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])523 self.assertEqual(run.returncode, 1)524 self.assertEqual("", run.output)525 self.assertIn("did not open test", run.errors)526 exe = self.bins("zzxordir")527 run = shell("{exe} {getfile} ".format(**locals()))528 self.assertIn(' file.1\n', run.output)529 self.assertIn(' file.2\n', run.output)530 self.assertIn(' file.9\n', run.output)531 self.assertIn(' README\n', run.output)532 self.assertIn(' defl:N ', run.output)533 self.assertIn(' stored ', run.output)534 def test_20322_zzxordir_test2_dat(self):535 """ run zzxordir on test2x.dat using just 'test2x' """536 zipfile = "test2x.dat"537 getfile = "test2x"538 exe = self.bins("zzdir")539 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])540 self.assertEqual(run.returncode, 1)541 self.assertEqual("", run.output)542 self.assertIn("did not open test", run.errors)543 exe = self.bins("zzxordir")544 run = shell("{exe} {getfile} ".format(**locals()))545 self.assertIn(' file.01\n', run.output)546 self.assertIn(' file.22\n', run.output)547 self.assertIn(' file.99\n', run.output)548 self.assertIn(' defl:N ', run.output)549 self.assertIn(' stored ', run.output)550 def test_20323_zzxordir_test3_dat(self):551 """ run zzxordir on test3x.dat using just 'test3x' """552 zipfile = "test3x.dat"553 getfile = "test3x"554 exe = self.bins("zzdir")555 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])556 self.assertEqual(run.returncode, 1)557 self.assertEqual("", run.output)558 self.assertIn("did not open test", run.errors)559 exe = self.bins("zzxordir")560 run = shell("{exe} {getfile} ".format(**locals()))561 self.assertIn(' file.001\n', run.output)562 self.assertIn(' file.222\n', run.output)563 self.assertIn(' file.999\n', run.output)564 self.assertIn(' defl:N ', run.output)565 self.assertIn(' stored ', run.output)566 def test_20324_zzxordir_test4_zip(self):567 """ run zzxordir on test4x.dat using just 'test4x' """568 zipfile = "test4x.dat"569 getfile = "test4x"570 exe = self.bins("zzdir")571 run = shell("{exe} {getfile} ".format(**locals()), returncodes = [0,1])572 self.assertEqual(run.returncode, 1)573 self.assertEqual("", run.output)574 self.assertIn("did not open test", run.errors)575 exe = self.bins("zzxordir")576 run = shell("{exe} {getfile} ".format(**locals()))577 self.assertIn(' file0001.txt\n', run.output)578 self.assertIn(' file2222.txt\n', run.output)579 self.assertIn(' file9999.txt\n', run.output)580 self.assertNotIn(' defl:N ', run.output)581 self.assertIn(' stored ', run.output)582 def test_20340_zzxorcat_test0_zip(self):583 """ run zzxorcat on testx.zip using just testx/README """584 getfile = "test0x/README"585 logfile = "test0x.readme.txt"586 exe = self.bins("zzcat")587 run = shell("{exe} {getfile} ".format(**locals()), lang="C")588 self.assertEqual("", run.output)589 self.assertIn("No such file or directory", run.errors)590 exe = self.bins("zzxorcat")591 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))592 self.assertGreater(os.path.getsize(logfile), 10)593 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))594 def test_20341_zzxorcat_test1_zip(self):595 """ run zzxorcat on testx.zip using just testx/README """596 getfile = "test1x/README"597 logfile = "test1x.readme.txt"598 exe = self.bins("zzcat")599 run = shell("{exe} {getfile} ".format(**locals()), lang="C")600 self.assertEqual("", run.output)601 self.assertIn("No such file or directory", run.errors)602 exe = self.bins("zzxorcat")603 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))604 self.assertGreater(os.path.getsize(logfile), 10)605 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))606 getfile = "test1x/file.1"607 run = shell("{exe} {getfile}".format(**locals()))608 self.assertEqual("file-1\n", run.output)609 def test_20342_zzxorcat_test2_zip(self):610 """ run zzxorcat on testx.zip using just testx/README """611 getfile = "test2x/README"612 logfile = "test2x.readme.txt"613 exe = self.bins("zzcat")614 run = shell("{exe} {getfile} ".format(**locals()), lang="C")615 self.assertEqual("", run.output)616 self.assertIn("No such file or directory", run.errors)617 exe = self.bins("zzxorcat")618 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))619 self.assertGreater(os.path.getsize(logfile), 10)620 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))621 getfile = "test2x/file.22"622 run = shell("{exe} {getfile}".format(**locals()))623 self.assertEqual("file-22\n", run.output)624 def test_20343_zzxorcat_test3_zip(self):625 """ run zzxorcat on testx.zip using just testx/README """626 getfile = "test3x/README"627 logfile = "test3x.readme.txt"628 exe = self.bins("zzcat")629 run = shell("{exe} {getfile} ".format(**locals()), lang="C")630 self.assertEqual("", run.output)631 self.assertIn("No such file or directory", run.errors)632 exe = self.bins("zzxorcat")633 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))634 self.assertGreater(os.path.getsize(logfile), 10)635 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))636 getfile = "test3x/file.999"637 run = shell("{exe} {getfile}".format(**locals()))638 self.assertEqual("file-999\n", run.output)639 def test_20344_zzxorcat_test4_zip(self):640 """ run zzxorcat on testx.zip using just testx/README """641 getfile = "test4x/README"642 logfile = "test4x.readme.txt"643 exe = self.bins("zzxorcat")644 run = shell("{exe} {getfile} | tee {logfile}".format(**locals()))645 self.assertGreater(os.path.getsize(logfile), 10)646 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))647 getfile = "test4x/file9999.txt"648 run = shell("{exe} {getfile}".format(**locals()))649 self.assertEqual("file-9999\n", run.output)650 #####################################################################651 # check unzzip652 #####################################################################653 def test_20400_infozip_cat_test0_zip(self):654 """ run inzo-zip cat test.zip using just archive README """655 zipfile = "test0.zip"656 getfile = "README"657 logfile = "test0.readme.pk.txt"658 exe = self.bins("unzip")659 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))660 self.assertGreater(os.path.getsize(logfile), 10)661 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))662 def test_20401_infozip_cat_test1_zip(self):663 """ run info-zip cat test.zip using just archive README """664 zipfile = "test1.zip"665 getfile = "README"666 logfile = "test1.readme.pk.txt"667 exe = self.bins("unzip")668 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))669 self.assertGreater(os.path.getsize(logfile), 10)670 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))671 getfile = "file.1"672 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))673 self.assertEqual("file-1\n", run.output)674 def test_20402_infozip_cat_test2_zip(self):675 """ run info-zip cat test.zip using just archive README """676 zipfile = "test2.zip"677 getfile = "README"678 logfile = "test2.readme.pk.txt"679 exe = self.bins("unzip")680 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))681 self.assertGreater(os.path.getsize(logfile), 10)682 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))683 getfile = "file.22"684 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))685 self.assertEqual("file-22\n", run.output)686 def test_20405_zzcat_big_test5_zip(self):687 """ run info-zip cat test.zip using archive README """688 zipfile = "test5.zip"689 getfile = "README"690 logfile = "test5.readme.pk.txt"691 exe = self.bins("unzip")692 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))693 self.assertGreater(os.path.getsize(logfile), 10)694 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))695 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"696 compare = self.gentext(1024)697 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))698 self.assertEqual(compare, run.output)699 def test_20410_zzcat_big_test0_zip(self):700 """ run zzcat-big on test.zip using just archive README """701 zipfile = "test0.zip"702 getfile = "README"703 logfile = "test0.readme.big.txt"704 exe = self.bins("unzzip-big")705 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))706 self.assertGreater(os.path.getsize(logfile), 10)707 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))708 def test_20411_zzcat_big_test1_zip(self):709 """ run zzcat-big on test.zip using just archive README """710 zipfile = "test1.zip"711 getfile = "README"712 logfile = "test1.readme.big.txt"713 exe = self.bins("unzzip-big")714 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))715 self.assertGreater(os.path.getsize(logfile), 10)716 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))717 getfile = "file.1"718 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))719 self.assertEqual("file-1\n", run.output)720 def test_20412_zzcat_big_test2_zip(self):721 """ run zzcat-seeke on test.zip using just archive README """722 zipfile = "test2.zip"723 getfile = "README"724 logfile = "test2.readme.big.txt"725 exe = self.bins("unzzip-big")726 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))727 self.assertGreater(os.path.getsize(logfile), 10)728 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))729 getfile = "file.22"730 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))731 self.assertEqual("file-22\n", run.output)732 def test_20415_zzcat_big_test5_zip(self):733 """ run zzcat-big on test.zip using archive README """734 zipfile = "test5.zip"735 getfile = "README"736 logfile = "test5.readme.zap.txt"737 exe = self.bins("unzzip-big")738 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))739 self.assertGreater(os.path.getsize(logfile), 10)740 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))741 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"742 compare = self.gentext(1024)743 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))744 self.assertEqual(compare, run.output)745 def test_20420_zzcat_mem_test0_zip(self):746 """ run zzcat-mem on test.zip using just archive README """747 zipfile = "test0.zip"748 getfile = "README"749 logfile = "test0.readme.mem.txt"750 exe = self.bins("unzzip-mem")751 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))752 self.assertGreater(os.path.getsize(logfile), 10)753 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))754 def test_20421_zzcat_mem_test1_zip(self):755 """ run zzcat-mem on test.zip using archive README """756 zipfile = "test1.zip"757 getfile = "README"758 logfile = "test1.readme.mem.txt"759 exe = self.bins("unzzip-mem")760 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))761 self.assertGreater(os.path.getsize(logfile), 10)762 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))763 getfile = "file.1"764 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))765 self.assertEqual("file-1\n", run.output)766 def test_20422_zzcat_mem_test2_zip(self):767 """ run zzcat-mem on test.zip using archive README """768 zipfile = "test2.zip"769 getfile = "README"770 logfile = "test2.readme.mem.txt"771 exe = self.bins("unzzip-mem")772 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))773 self.assertGreater(os.path.getsize(logfile), 10)774 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))775 getfile = "file.22"776 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))777 self.assertEqual("file-22\n", run.output)778 def test_20423_zzcat_mem_test3_zip(self):779 """ run zzcat-mem on test.zip using archive README """780 zipfile = "test3.zip"781 getfile = "README"782 logfile = "test3.readme.mem.txt"783 exe = self.bins("unzzip-mem")784 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))785 self.assertGreater(os.path.getsize(logfile), 10)786 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))787 getfile = "file.999"788 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))789 self.assertEqual("file-999\n", run.output)790 def test_20424_zzcat_mem_test4_zip(self):791 """ run zzcat-mem on test.zip using archive README """792 zipfile = "test4.zip"793 getfile = "README"794 logfile = "test4.readme.mem.txt"795 exe = self.bins("unzzip-mem")796 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))797 self.assertGreater(os.path.getsize(logfile), 10)798 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))799 getfile = "file9999.txt"800 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))801 self.assertEqual("file-9999\n", run.output)802 def test_20425_zzcat_mem_test5_zip(self):803 """ run zzcat-mem on test.zip using archive README """804 zipfile = "test5.zip"805 getfile = "README"806 logfile = "test5.readme.zap.txt"807 exe = self.bins("unzzip-mem")808 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))809 self.assertGreater(os.path.getsize(logfile), 10)810 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))811 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"812 compare = self.gentext(1024)813 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))814 self.assertEqual(compare, run.output)815 def test_20430_zzcat_mix_test0_zip(self):816 """ run zzcat-mix on test.zip using just archive README """817 zipfile = "test0.zip"818 getfile = "README"819 logfile = "test0.readme.mix.txt"820 exe = self.bins("unzzip-mix")821 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))822 self.assertGreater(os.path.getsize(logfile), 10)823 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))824 def test_20431_zzcat_mix_test1_zip(self):825 """ run zzcat-mix on test.zip using archive README """826 zipfile = "test1.zip"827 getfile = "README"828 logfile = "test1.readme.mix.txt"829 exe = self.bins("unzzip-mix")830 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))831 self.assertGreater(os.path.getsize(logfile), 10)832 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))833 getfile = "file.1"834 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))835 self.assertEqual("file-1\n", run.output)836 def test_20432_zzcat_mix_test2_zip(self):837 """ run zzcat-mix on test.zip using archive README """838 zipfile = "test2.zip"839 getfile = "README"840 logfile = "test2.readme.mix.txt"841 exe = self.bins("unzzip-mix")842 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))843 self.assertGreater(os.path.getsize(logfile), 10)844 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))845 getfile = "file.22"846 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))847 self.assertEqual("file-22\n", run.output)848 def test_20433_zzcat_mix_test3_zip(self):849 """ run zzcat-mix on test.zip using archive README """850 zipfile = "test3.zip"851 getfile = "README"852 logfile = "test3.readme.mix.txt"853 exe = self.bins("unzzip-mix")854 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))855 self.assertGreater(os.path.getsize(logfile), 10)856 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))857 getfile = "file.999"858 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))859 self.assertEqual("file-999\n", run.output)860 def test_20434_zzcat_mix_test4_zip(self):861 """ run zzcat-mix on test.zip using archive README """862 zipfile = "test4.zip"863 getfile = "README"864 logfile = "test4.readme.mix.txt"865 exe = self.bins("unzzip-mix")866 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))867 self.assertGreater(os.path.getsize(logfile), 10)868 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))869 getfile = "file9999.txt"870 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))871 self.assertEqual("file-9999\n", run.output)872 def test_20435_zzcat_mix_test5_zip(self):873 """ run zzcat-mix on test.zip using archive README """874 zipfile = "test5.zip"875 getfile = "README"876 logfile = "test5.readme.zap.txt"877 exe = self.bins("unzzip-mix")878 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))879 self.assertGreater(os.path.getsize(logfile), 10)880 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))881 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"882 compare = self.gentext(1024)883 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))884 self.assertEqual(compare, run.output)885 def test_20440_zzcat_zap_test0_zip(self):886 """ run zzcat-zap on test.zip using just archive README """887 zipfile = "test0.zip"888 getfile = "README"889 logfile = "test0.readme.txt"890 exe = self.bins("unzzip")891 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))892 self.assertGreater(os.path.getsize(logfile), 10)893 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))894 def test_20441_zzcat_zap_test1_zip(self):895 """ run zzcat-zap on test.zip using archive README """896 zipfile = "test1.zip"897 getfile = "README"898 logfile = "test1.readme.zap.txt"899 exe = self.bins("unzzip")900 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))901 self.assertGreater(os.path.getsize(logfile), 10)902 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))903 getfile = "file.1"904 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))905 self.assertEqual("file-1\n", run.output)906 def test_20442_zzcat_zap_test2_zip(self):907 """ run zzcat-zap on test.zip using archive README """908 zipfile = "test2.zip"909 getfile = "README"910 logfile = "test2.readme.zap.txt"911 exe = self.bins("unzzip")912 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))913 self.assertGreater(os.path.getsize(logfile), 10)914 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))915 getfile = "file.22"916 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))917 self.assertEqual("file-22\n", run.output)918 def test_20443_zzcat_zap_test3_zip(self):919 """ run zzcat-zap on test.zip using archive README """920 zipfile = "test3.zip"921 getfile = "README"922 logfile = "test3.readme.zap.txt"923 exe = self.bins("unzzip")924 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))925 self.assertGreater(os.path.getsize(logfile), 10)926 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))927 getfile = "file.999"928 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))929 self.assertEqual("file-999\n", run.output)930 def test_20444_zzcat_zap_test4_zip(self):931 """ run zzcat-zap on test.zip using archive README """932 zipfile = "test4.zip"933 getfile = "README"934 logfile = "test4.readme.zap.txt"935 exe = self.bins("unzzip")936 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))937 self.assertGreater(os.path.getsize(logfile), 10)938 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))939 getfile = "file9999.txt"940 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))941 self.assertEqual("file-9999\n", run.output)942 def test_20445_zzcat_zap_test5_zip(self):943 """ run zzcat-zap on test.zip using archive README """944 zipfile = "test5.zip"945 getfile = "README"946 logfile = "test5.readme.zap.txt"947 exe = self.bins("unzzip")948 run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals()))949 self.assertGreater(os.path.getsize(logfile), 10)950 self.assertEqual(run.output.split("\n"), self.readme().split("\n"))951 getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt"952 compare = self.gentext(1024)953 run = shell("{exe} -p {zipfile} {getfile}".format(**locals()))954 self.assertEqual(compare, run.output)955 def test_20500_infozipdir_test0_zip(self):956 """ run info-zip dir test0.zip """957 zipfile = "test0.zip"958 getfile = "test0.zip"959 exe = self.bins("unzip")960 run = shell("{exe} -l {getfile} ".format(**locals()))961 self.assertIn(' README\n', run.output)962 self.assertLess(len(run.output), 230)963 def test_20501_infozipdir_test1_zip(self):964 """ run info-zip dir test1.zip """965 zipfile = "test1.zip"966 getfile = "test1.zip"967 exe = self.bins("unzip")968 run = shell("{exe} -l {getfile} ".format(**locals()))969 self.assertIn(' file.1\n', run.output)970 self.assertIn(' file.2\n', run.output)971 self.assertIn(' file.9\n', run.output)972 self.assertIn(' README\n', run.output)973 def test_20502_infozipdir_big_test2_zip(self):974 """ run info-zip dir test2.zip """975 zipfile = "test2.zip"976 getfile = "test2.zip"977 exe = self.bins("unzip")978 run = shell("{exe} -l {getfile} ".format(**locals()))979 self.assertIn(' file.01\n', run.output)980 self.assertIn(' file.22\n', run.output)981 self.assertIn(' file.99\n', run.output)982 def test_20503_infozipdir_big_test3_zip(self):983 """ run info-zip dir test3.zip """984 zipfile = "test3.zip"985 getfile = "test3.zip"986 exe = self.bins("unzip")987 run = shell("{exe} -l {getfile} ".format(**locals()))988 self.assertIn(' file.001\n', run.output)989 self.assertIn(' file.222\n', run.output)990 self.assertIn(' file.999\n', run.output)991 def test_20504_infozipdir_big_test4_zip(self):992 """ run info-zip dir test4.zip """993 zipfile = "test4.zip"994 getfile = "test4.zip"995 exe = self.bins("unzip")996 run = shell("{exe} -l {getfile} ".format(**locals()))997 self.assertIn(' file0001.txt\n', run.output)998 self.assertIn(' file2222.txt\n', run.output)999 self.assertIn(' file9999.txt\n', run.output)1000 def test_20505_infozipdir_big_test5_zip(self):1001 """ run info-zip dir on test5.zip """1002 zipfile = "test5.zip"1003 getfile = "test5.zip"1004 exe = self.bins("unzzip-mix")1005 run = shell("{exe} -v {getfile} ".format(**locals()))1006 self.assertIn('/subdir14/file15-128.txt\n', run.output)1007 self.assertIn('/subdir5/subdir6/', run.output)1008 self.assertIn(' defl:N ', run.output)1009 self.assertIn(' stored ', run.output)1010 def test_20510_zzdir_big_test0_zip(self):1011 """ run zzdir-big on test0.zip """1012 zipfile = "test0.zip"1013 getfile = "test0.zip"1014 exe = self.bins("unzzip-big")1015 run = shell("{exe} -l {getfile} ".format(**locals()))1016 self.assertIn(' README\n', run.output)1017 self.assertLess(len(run.output), 30)1018 def test_20511_zzdir_big_test1_zip(self):1019 """ run zzdir-big on test1.zip """1020 zipfile = "test1.zip"1021 getfile = "test1.zip"1022 exe = self.bins("unzzip-big")1023 run = shell("{exe} -l {getfile} ".format(**locals()))1024 self.assertIn(' file.1\n', run.output)1025 self.assertIn(' file.2\n', run.output)1026 self.assertIn(' file.9\n', run.output)1027 self.assertIn(' README\n', run.output)1028 def test_20512_zzdir_big_test2_zip(self):1029 """ run zzdir-big on test2.zip """1030 zipfile = "test2.zip"1031 getfile = "test2.zip"1032 exe = self.bins("unzzip-big")1033 run = shell("{exe} -l {getfile} ".format(**locals()))1034 self.assertIn(' file.01\n', run.output)1035 self.assertIn(' file.22\n', run.output)1036 self.assertIn(' file.99\n', run.output)1037 def test_20513_zzdir_big_test3_zip(self):1038 """ run zzdir-big on test3.zip """1039 zipfile = "test3.zip"1040 getfile = "test3.zip"1041 exe = self.bins("unzzip-big")1042 run = shell("{exe} -l {getfile} ".format(**locals()))1043 self.assertIn(' file.001\n', run.output)1044 self.assertIn(' file.222\n', run.output)1045 self.assertIn(' file.999\n', run.output)1046 def test_20514_zzdir_big_test4_zip(self):1047 """ run zzdir-big on test4.zip """1048 zipfile = "test4.zip"1049 getfile = "test4.zip"1050 exe = self.bins("unzzip-big")1051 run = shell("{exe} -l {getfile} ".format(**locals()))1052 self.assertIn(' file0001.txt\n', run.output)1053 self.assertIn(' file2222.txt\n', run.output)1054 self.assertIn(' file9999.txt\n', run.output)1055 def test_20515_zzdir_big_test5_zip(self):1056 """ run zzdir-big on test5.zip """1057 zipfile = "test5.zip"1058 getfile = "test5.zip"1059 exe = self.bins("unzzip-mix")1060 run = shell("{exe} -v {getfile} ".format(**locals()))1061 self.assertIn('/subdir14/file15-128.txt\n', run.output)1062 self.assertIn('/subdir5/subdir6/', run.output)1063 self.assertIn(' defl:N ', run.output)1064 self.assertIn(' stored ', run.output)1065 def test_20520_zzdir_mem_test0_zip(self):1066 """ run zzdir-mem on test0.zip """1067 zipfile = "test0.zip"1068 getfile = "test0.zip"1069 exe = self.bins("unzzip-mem")1070 run = shell("{exe} -v {getfile} ".format(**locals()))1071 self.assertIn(' README\n', run.output)1072 self.assertIn(' defl:N ', run.output)1073 self.assertLess(len(run.output), 30)1074 def test_20521_zzdir_mem_test1_zip(self):1075 """ run zzdir-mem on test1.zip """1076 zipfile = "test1.zip"1077 getfile = "test1.zip"1078 exe = self.bins("unzzip-mem")1079 run = shell("{exe} -v {getfile} ".format(**locals()))1080 self.assertIn(' file.1\n', run.output)1081 self.assertIn(' file.2\n', run.output)1082 self.assertIn(' file.9\n', run.output)1083 self.assertIn(' README\n', run.output)1084 self.assertIn(' defl:N ', run.output)1085 self.assertIn(' stored ', run.output)1086 def test_20522_zzdir_mem_test2_zip(self):1087 """ run zzdir-mem on test2.zip """1088 zipfile = "test2.zip"1089 getfile = "test2.zip"1090 exe = self.bins("unzzip-mem")1091 run = shell("{exe} -v {getfile} ".format(**locals()))1092 self.assertIn(' file.01\n', run.output)1093 self.assertIn(' file.22\n', run.output)1094 self.assertIn(' file.99\n', run.output)1095 self.assertIn(' defl:N ', run.output)1096 self.assertIn(' stored ', run.output)1097 def test_20523_zzdir_mem_test3_zip(self):1098 """ run zzdir-mem on test3.zip """1099 zipfile = "test3.zip"1100 getfile = "test3.zip"1101 exe = self.bins("unzzip-mem")1102 run = shell("{exe} -v {getfile} ".format(**locals()))1103 self.assertIn(' file.001\n', run.output)1104 self.assertIn(' file.222\n', run.output)1105 self.assertIn(' file.999\n', run.output)1106 self.assertIn(' defl:N ', run.output)1107 self.assertIn(' stored ', run.output)1108 def test_20524_zzdir_mem_test4_zip(self):1109 """ run zzdir-mem on test4.zip """1110 zipfile = "test4.zip"1111 getfile = "test4.zip"1112 exe = self.bins("unzzip-mem")1113 run = shell("{exe} -v {getfile} ".format(**locals()))1114 self.assertIn(' file0001.txt\n', run.output)1115 self.assertIn(' file2222.txt\n', run.output)1116 self.assertIn(' file9999.txt\n', run.output)1117 self.assertNotIn(' defl:N ', run.output)1118 self.assertIn(' stored ', run.output)1119 def test_20525_zzdir_mem_test5_zip(self):1120 """ run zzdir-mem on test5.zip """1121 zipfile = "test5.zip"1122 getfile = "test5.zip"1123 exe = self.bins("unzzip-mix")1124 run = shell("{exe} -v {getfile} ".format(**locals()))1125 self.assertIn('/subdir14/file15-128.txt\n', run.output)1126 self.assertIn('/subdir5/subdir6/', run.output)1127 self.assertIn(' defl:N ', run.output)1128 self.assertIn(' stored ', run.output)1129 def test_20530_zzdir_mix_test0_zip(self):1130 """ run zzdir-mix on test0.zip """1131 # self.skipTest("todo")1132 zipfile = "test0.zip"1133 getfile = "test0.zip"1134 exe = self.bins("unzzip-mix")1135 run = shell("{exe} -v {getfile} ".format(**locals()))1136 self.assertIn(' README\n', run.output)1137 self.assertIn(' defl:N ', run.output)1138 self.assertLess(len(run.output), 30)1139 def test_20531_zzdir_mix_test1_zip(self):1140 """ run zzdir-mix on test1.zip """1141 zipfile = "test1.zip"1142 getfile = "test1.zip"1143 exe = self.bins("unzzip-mix")1144 run = shell("{exe} -v {getfile} ".format(**locals()))1145 self.assertIn(' file.1\n', run.output)1146 self.assertIn(' file.2\n', run.output)1147 self.assertIn(' file.9\n', run.output)1148 self.assertIn(' README\n', run.output)1149 self.assertIn(' defl:N ', run.output)1150 self.assertIn(' stored ', run.output)1151 def test_20532_zzdir_mix_test2_zip(self):1152 """ run zzdir-mix on test2.zip """1153 zipfile = "test2.zip"1154 getfile = "test2.zip"1155 exe = self.bins("unzzip-mix")1156 run = shell("{exe} -v {getfile} ".format(**locals()))1157 self.assertIn(' file.01\n', run.output)1158 self.assertIn(' file.22\n', run.output)1159 self.assertIn(' file.99\n', run.output)1160 self.assertIn(' defl:N ', run.output)1161 self.assertIn(' stored ', run.output)1162 def test_20533_zzdir_mix_test3_zip(self):1163 """ run zzdir-mix on test3.zip """1164 zipfile = "test3.zip"1165 getfile = "test3.zip"1166 exe = self.bins("unzzip-mix")1167 run = shell("{exe} -v {getfile} ".format(**locals()))1168 self.assertIn(' file.001\n', run.output)1169 self.assertIn(' file.222\n', run.output)1170 self.assertIn(' file.999\n', run.output)1171 self.assertIn(' defl:N ', run.output)1172 self.assertIn(' stored ', run.output)1173 def test_20534_zzdir_mix_test4_zip(self):1174 """ run zzdir-mix on test4.zip """1175 zipfile = "test4.zip"1176 getfile = "test4.zip"1177 exe = self.bins("unzzip-mix")1178 run = shell("{exe} -v {getfile} ".format(**locals()))1179 self.assertIn(' file0001.txt\n', run.output)1180 self.assertIn(' file2222.txt\n', run.output)1181 self.assertIn(' file9999.txt\n', run.output)1182 self.assertNotIn(' defl:N ', run.output)1183 self.assertIn(' stored ', run.output)1184 def test_20535_zzdir_mix_test5_zip(self):1185 """ run zzdir-mix on test5.zip """1186 zipfile = "test5.zip"1187 getfile = "test5.zip"1188 exe = self.bins("unzzip-mix")1189 run = shell("{exe} -v {getfile} ".format(**locals()))1190 self.assertIn('/subdir14/file15-128.txt\n', run.output)1191 self.assertIn('/subdir5/subdir6/', run.output)1192 self.assertIn(' defl:N ', run.output)1193 self.assertIn(' stored ', run.output)1194 def test_20540_zzdir_zap_test0_zip(self):1195 """ run zzdir-zap on test0.zip """1196 zipfile = "test0.zip"1197 getfile = "test0.zip"1198 exe = self.bins("unzzip")1199 run = shell("{exe} -v {getfile} ".format(**locals()))1200 self.assertIn(' README\n', run.output)1201 self.assertIn(' defl:N ', run.output)1202 self.assertLess(len(run.output), 30)1203 def test_20541_zzdir_zap_test1_zip(self):1204 """ run zzdir-zap on test1.zip """1205 zipfile = "test1.zip"1206 getfile = "test1.zip"1207 exe = self.bins("unzzip")1208 run = shell("{exe} -v {getfile} ".format(**locals()))1209 self.assertIn(' file.1\n', run.output)1210 self.assertIn(' file.2\n', run.output)1211 self.assertIn(' file.9\n', run.output)1212 self.assertIn(' README\n', run.output)1213 self.assertIn(' defl:N ', run.output)1214 self.assertIn(' stored ', run.output)1215 def test_20542_zzdir_zap_test2_zip(self):1216 """ run zzdir-zap on test2.zip """1217 zipfile = "test2.zip"1218 getfile = "test2.zip"1219 exe = self.bins("unzzip")1220 run = shell("{exe} -v {getfile} ".format(**locals()))1221 self.assertIn(' file.01\n', run.output)1222 self.assertIn(' file.22\n', run.output)1223 self.assertIn(' file.99\n', run.output)1224 self.assertIn(' defl:N ', run.output)1225 self.assertIn(' stored ', run.output)1226 def test_20543_zzdir_zap_test3_zip(self):1227 """ run zzdir-zap on test3.zip """1228 zipfile = "test3.zip"1229 getfile = "test3.zip"1230 exe = self.bins("unzzip")1231 run = shell("{exe} -v {getfile} ".format(**locals()))1232 self.assertIn(' file.001\n', run.output)1233 self.assertIn(' file.222\n', run.output)1234 self.assertIn(' file.999\n', run.output)1235 self.assertIn(' defl:N ', run.output)1236 self.assertIn(' stored ', run.output)1237 def test_20544_zzdir_zap_test4_zip(self):1238 """ run zzdir-zap on test4.zip """1239 zipfile = "test4.zip"1240 getfile = "test4.zip"1241 exe = self.bins("unzzip")1242 run = shell("{exe} -v {getfile} ".format(**locals()))1243 self.assertIn(' file0001.txt\n', run.output)1244 self.assertIn(' file2222.txt\n', run.output)1245 self.assertIn(' file9999.txt\n', run.output)1246 self.assertNotIn(' defl:N ', run.output)1247 self.assertIn(' stored ', run.output)1248 def test_20545_zzdir_zap_test5_zip(self):1249 """ run zzdir-zap on test5.zip """1250 zipfile = "test5.zip"1251 getfile = "test5.zip"1252 exe = self.bins("unzzip")1253 run = shell("{exe} -v {getfile} ".format(**locals()))1254 self.assertIn('/subdir14/file15-128.txt\n', run.output)1255 self.assertIn('/subdir5/subdir6/', run.output)1256 self.assertIn(' defl:N ', run.output)1257 self.assertIn(' stored ', run.output)1258 def test_20595_zzextract_zap_test5_zip(self):1259 """ run zzextract-zap on test5.zip 1260 => coughs up a SEGFAULT in zzip_dir_close() ?!?"""1261 self.rm_testdir()1262 zipfile = "test5.zip"1263 getfile = "test5.zip"1264 tmpdir = self.testdir()1265 exe = self.bins("unzzip")1266 run = shell("cd {tmpdir} && ../{exe} ../{getfile} ".format(**locals()));1267 self.assertTrue(tmpdir+'/subdir1/subdir2/file3-1024.txt')1268 # self.rm_testdir()1269 url_CVE_2017_5977 = "https://github.com/asarubbo/poc/blob/master"1270 zip_CVE_2017_5977 = "00153-zziplib-invalidread-zzip_mem_entry_extra_block"1271 def test_59770_infozipdir_CVE_2017_5977(self):1272 """ run info-zip dir test0.zip """1273 tmpdir = self.testdir()1274 filename = self.zip_CVE_2017_59771275 file_url = self.url_CVE_2017_59771276 download_raw(file_url, filename, tmpdir)1277 exe = self.bins("unzip")1278 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1279 returncodes = [0, 2])1280 self.assertIn(" didn't find end-of-central-dir signature at end of central dir", run.errors)1281 self.assertIn(" 2 extra bytes at beginning or within zipfile", run.errors)1282 self.assertLess(len(run.output), 280)1283 #1284 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),1285 returncodes = [2])1286 self.assertLess(len(run.output), 90)1287 self.assertLess(len(errors(run.errors)), 900)1288 self.assertIn('test: mismatching "local" filename', run.errors)1289 self.assertIn('test: unknown compression method', run.errors)1290 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)1291 self.rm_testdir()1292 def test_59771_zzipdir_big_CVE_2017_5977(self):1293 """ run info-zip -l $(CVE_2017_5977).zip """1294 tmpdir = self.testdir()1295 filename = self.zip_CVE_2017_59771296 file_url = self.url_CVE_2017_59771297 download_raw(file_url, filename, tmpdir)1298 exe = self.bins("unzzip-big")1299 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1300 returncodes = [0])1301 self.assertLess(len(run.output), 30)1302 self.assertLess(len(errors(run.errors)), 1)1303 self.assertIn(" stored test", run.output)1304 #1305 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1306 returncodes = [0])1307 self.assertLess(len(run.output), 30)1308 self.assertLess(len(errors(run.errors)), 1)1309 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)1310 self.rm_testdir()1311 def test_59772_zzipdir_mem_CVE_2017_5977(self):1312 """ run unzzip-mem -l $(CVE_2017_5977).zip """1313 tmpdir = self.testdir()1314 filename = self.zip_CVE_2017_59771315 file_url = self.url_CVE_2017_59771316 download_raw(file_url, filename, tmpdir)1317 exe = self.bins("unzzip-mem")1318 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1319 returncodes = [0])1320 self.assertLess(len(run.output), 30)1321 self.assertLess(len(errors(run.errors)), 1)1322 self.assertIn(" 3 test", run.output)1323 #1324 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1325 returncodes = [2])1326 self.assertLess(len(run.output), 30)1327 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1328 self.rm_testdir()1329 def test_59773_zzipdir_mix_CVE_2017_5977(self):1330 """ run unzzip-mix -l $(CVE_2017_5977).zip """1331 tmpdir = self.testdir()1332 filename = self.zip_CVE_2017_59771333 file_url = self.url_CVE_2017_59771334 download_raw(file_url, filename, tmpdir)1335 exe = self.bins("unzzip-mix")1336 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1337 returncodes = [0])1338 self.assertLess(len(run.output), 30)1339 self.assertLess(len(errors(run.errors)), 1)1340 self.assertIn(" 3 test", run.output)1341 #1342 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1343 returncodes = [0])1344 self.assertLess(len(run.output), 30)1345 self.assertLess(len(errors(run.errors)), 1)1346 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)1347 self.rm_testdir()1348 def test_59774_zzipdir_zap_CVE_2017_5977(self):1349 """ run unzzip -l $(CVE_2017_5977).zip """1350 tmpdir = self.testdir()1351 filename = self.zip_CVE_2017_59771352 file_url = self.url_CVE_2017_59771353 download_raw(file_url, filename, tmpdir)1354 exe = self.bins("unzzip")1355 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1356 returncodes = [0, 255])1357 self.assertLess(len(run.output), 30)1358 self.assertLess(len(errors(run.errors)), 1)1359 self.assertIn(" 3 test", run.output)1360 #1361 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1362 returncodes = [0])1363 self.assertLess(len(run.output), 30)1364 self.assertLess(len(errors(run.errors)), 1)1365 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # TODO1366 self.rm_testdir()1367 def test_59779(self):1368 """ check $(CVE).zip """1369 tmpdir = self.testdir()1370 filename = self.zip_CVE_2017_59771371 file_url = self.url_CVE_2017_59771372 download_raw(file_url, filename, tmpdir)1373 shell("ls -l {tmpdir}/{filename}".format(**locals()))1374 size = os.path.getsize(os.path.join(tmpdir, filename))1375 self.assertEqual(size, 163)1376 url_CVE_2017_5978 = "https://github.com/asarubbo/poc/blob/master"1377 zip_CVE_2017_5978 = "00156-zziplib-oobread-zzip_mem_entry_new"1378 def test_59780_infozipdir_CVE_2017_5978(self):1379 """ run info-zip dir test0.zip """1380 tmpdir = self.testdir()1381 filename = self.zip_CVE_2017_59781382 file_url = self.url_CVE_2017_59781383 download_raw(file_url, filename, tmpdir)1384 exe = self.bins("unzip")1385 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1386 returncodes = [0, 3])1387 self.assertIn(' missing 4608 bytes in zipfile', run.errors)1388 self.assertIn(' attempt to seek before beginning of zipfile', run.errors)1389 self.assertLess(len(run.output), 80)1390 self.assertLess(len(errors(run.errors)), 430)1391 #1392 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),1393 returncodes = [3])1394 self.assertLess(len(run.output), 90)1395 self.assertLess(len(errors(run.errors)), 900)1396 self.assertIn('attempt to seek before beginning of zipfile', run.errors)1397 self.assertFalse(os.path.exists(tmpdir+"/test"))1398 self.rm_testdir()1399 def test_59781_zzipdir_big_CVE_2017_5978(self):1400 """ run info-zip -l $(CVE_2017_5978).zip """1401 tmpdir = self.testdir()1402 filename = self.zip_CVE_2017_59781403 file_url = self.url_CVE_2017_59781404 download_raw(file_url, filename, tmpdir)1405 exe = self.bins("unzzip-big")1406 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1407 returncodes = [0])1408 self.assertLess(len(run.output), 30)1409 self.assertLess(len(errors(run.errors)), 1)1410 self.assertIn(" stored (null)", run.output)1411 #1412 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1413 returncodes = [0,1])1414 self.assertLess(len(run.output), 30)1415 self.assertLess(len(errors(run.errors)), 1)1416 self.assertFalse(os.path.exists(tmpdir+"/test"))1417 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)1418 self.rm_testdir()1419 def test_59782_zzipdir_mem_CVE_2017_5978(self):1420 """ run unzzip-mem -l $(CVE_2017_5978).zip """1421 tmpdir = self.testdir()1422 filename = self.zip_CVE_2017_59781423 file_url = self.url_CVE_2017_59781424 download_raw(file_url, filename, tmpdir)1425 exe = self.bins("unzzip-mem")1426 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1427 returncodes = [0])1428 self.assertLess(len(run.output), 1)1429 self.assertLess(len(errors(run.errors)), 180)1430 self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)1431 self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)1432 #1433 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1434 returncodes = [2])1435 self.assertLess(len(run.output), 30)1436 self.assertLess(len(errors(run.errors)), 300)1437 if grep("DEBUG:", run.errors):1438 self.assertIn("findfirst (nil)", run.errors)1439 self.assertFalse(os.path.exists(tmpdir+"/test"))1440 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)1441 self.rm_testdir()1442 def test_59783_zzipdir_mix_CVE_2017_5978(self):1443 """ run unzzip-mix -l $(CVE_2017_5978).zip """1444 tmpdir = self.testdir()1445 filename = self.zip_CVE_2017_59781446 file_url = self.url_CVE_2017_59781447 download_raw(file_url, filename, tmpdir)1448 exe = self.bins("unzzip-mix")1449 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1450 returncodes = [0,2])1451 self.assertLess(len(run.output), 1)1452 self.assertLess(len(errors(run.errors)), 180)1453 self.assertTrue(greps(run.errors, "Invalid or"))1454 #1455 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1456 returncodes = [0,2])1457 self.assertLess(len(run.output), 30)1458 self.assertLess(len(errors(run.errors)), 300)1459 self.assertTrue(greps(run.errors, "Invalid or"))1460 self.assertFalse(os.path.exists(tmpdir+"/test"))1461 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)1462 self.rm_testdir()1463 def test_59784_zzipdir_zap_CVE_2017_5978(self):1464 """ run unzzip -l $(CVE_2017_5978).zip """1465 tmpdir = self.testdir()1466 filename = self.zip_CVE_2017_59781467 file_url = self.url_CVE_2017_59781468 download_raw(file_url, filename, tmpdir)1469 exe = self.bins("unzzip")1470 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1471 returncodes = [3])1472 self.assertLess(len(run.output), 1)1473 self.assertLess(len(errors(run.errors)), 180)1474 #1475 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1476 returncodes = [0,3])1477 self.assertLess(len(run.output), 30)1478 self.assertLess(len(errors(run.errors)), 300)1479 self.assertTrue(greps(run.errors, "Zipfile corrupted"))1480 self.assertFalse(os.path.exists(tmpdir+"/test"))1481 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0)1482 self.rm_testdir()1483 def test_59789(self):1484 """ check $(CVE).zip """1485 tmpdir = self.testdir()1486 filename = self.zip_CVE_2017_59781487 file_url = self.url_CVE_2017_59781488 download_raw(file_url, filename, tmpdir)1489 shell("ls -l {tmpdir}/{filename}".format(**locals()))1490 size = os.path.getsize(os.path.join(tmpdir, filename))1491 self.assertEqual(size, 161)1492 url_CVE_2017_5979 = "https://github.com/asarubbo/poc/blob/master"1493 zip_CVE_2017_5979 = "00157-zziplib-nullptr-prescan_entry"1494 def test_59790_infozipdir_CVE_2017_5979(self):1495 """ run info-zip dir test0.zip """1496 tmpdir = self.testdir()1497 filename = self.zip_CVE_2017_59791498 file_url = self.url_CVE_2017_59791499 download_raw(file_url, filename, tmpdir)1500 exe = self.bins("unzip")1501 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1502 returncodes = [0])1503 self.assertIn(' 1 file', run.output)1504 self.assertLess(len(run.output), 330)1505 self.assertLess(len(errors(run.errors)), 1)1506 #1507 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),1508 returncodes = [0])1509 self.assertLess(len(run.output), 90)1510 self.assertLess(len(errors(run.errors)), 1)1511 self.assertIn('extracting: a', run.output)1512 self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)1513 self.rm_testdir()1514 def test_59791_zzipdir_big_CVE_2017_5979(self):1515 """ run info-zip -l $(CVE_2017_5979).zip """1516 tmpdir = self.testdir()1517 filename = self.zip_CVE_2017_59791518 file_url = self.url_CVE_2017_59791519 download_raw(file_url, filename, tmpdir)1520 exe = self.bins("unzzip-big")1521 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1522 returncodes = [0])1523 self.assertLess(len(run.output), 30)1524 self.assertLess(len(errors(run.errors)), 1)1525 self.assertIn(" stored a", run.output)1526 #1527 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1528 returncodes = [0])1529 self.assertLess(len(run.output), 30)1530 self.assertLess(len(errors(run.errors)), 1)1531 self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)1532 self.rm_testdir()1533 def test_59792_zzipdir_mem_CVE_2017_5979(self):1534 """ run unzzip-mem -l $(CVE_2017_5979).zip """1535 tmpdir = self.testdir()1536 filename = self.zip_CVE_2017_59791537 file_url = self.url_CVE_2017_59791538 download_raw(file_url, filename, tmpdir)1539 exe = self.bins("unzzip-mem")1540 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1541 returncodes = [0])1542 self.assertLess(len(run.output), 30)1543 self.assertLess(len(errors(run.errors)), 1)1544 self.assertIn(" 3 a", run.output)1545 #1546 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1547 returncodes = [2])1548 self.assertLess(len(run.output), 30)1549 self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)1550 self.rm_testdir()1551 def test_59793_zzipdir_mix_CVE_2017_5979(self):1552 """ run unzzip-mix -l $(CVE_2017_5979).zip """1553 tmpdir = self.testdir()1554 filename = self.zip_CVE_2017_59791555 file_url = self.url_CVE_2017_59791556 download_raw(file_url, filename, tmpdir)1557 exe = self.bins("unzzip-mix")1558 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1559 returncodes = [0])1560 self.assertLess(len(run.output), 30)1561 self.assertLess(len(errors(run.errors)), 1)1562 self.assertIn(" 3 a", run.output)1563 #1564 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1565 returncodes = [0])1566 self.assertLess(len(run.output), 30)1567 self.assertLess(len(errors(run.errors)), 20)1568 self.assertEqual(os.path.getsize(tmpdir+"/a"), 0) # FIXME1569 # self.assertEqual(os.path.getsize(tmpdir+"/a"), 3) # FIXME1570 self.rm_testdir()1571 def test_59794_zzipdir_zap_CVE_2017_5979(self):1572 """ run unzzip -l $(CVE_2017_5979).zip """1573 tmpdir = self.testdir()1574 filename = self.zip_CVE_2017_59791575 file_url = self.url_CVE_2017_59791576 download_raw(file_url, filename, tmpdir)1577 exe = self.bins("unzzip")1578 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1579 returncodes = [0, 255])1580 self.assertLess(len(run.output), 30)1581 self.assertLess(len(errors(run.errors)), 1)1582 self.assertIn(" 3 a", run.output)1583 #1584 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1585 returncodes = [0])1586 self.assertLess(len(run.output), 30)1587 self.assertLess(len(errors(run.errors)), 20)1588 self.assertEqual(os.path.getsize(tmpdir+"/a"), 3)1589 self.rm_testdir()1590 def test_59799(self):1591 """ check $(CVE).zip """1592 tmpdir = self.testdir()1593 filename = self.zip_CVE_2017_59791594 file_url = self.url_CVE_2017_59791595 download_raw(file_url, filename, tmpdir)1596 shell("ls -l {tmpdir}/{filename}".format(**locals()))1597 size = os.path.getsize(os.path.join(tmpdir, filename))1598 self.assertEqual(size, 155)1599 url_CVE_2017_5974 = "https://github.com/asarubbo/poc/blob/master"1600 zip_CVE_2017_5974 = "00150-zziplib-heapoverflow-__zzip_get32"1601 def test_59740_infozipdir_CVE_2017_5974(self):1602 """ run info-zip dir test0.zip """1603 tmpdir = self.testdir()1604 filename = self.zip_CVE_2017_59741605 file_url = self.url_CVE_2017_59741606 download_raw(file_url, filename, tmpdir)1607 exe = self.bins("unzip")1608 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1609 returncodes = [0, 9])1610 self.assertIn(' 1 file', run.output)1611 self.assertLess(len(run.output), 330)1612 self.assertLess(len(errors(run.errors)), 1)1613 #1614 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),1615 returncodes = [0])1616 self.assertLess(len(run.output), 90)1617 self.assertLess(len(errors(run.errors)), 1)1618 self.assertIn(" extracting: test", run.output)1619 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1620 self.rm_testdir()1621 def test_59741_zzipdir_big_CVE_2017_5974(self):1622 """ run unzzip-big -l $(CVE_2017_5974).zip """1623 tmpdir = self.testdir()1624 filename = self.zip_CVE_2017_59741625 file_url = self.url_CVE_2017_59741626 download_raw(file_url, filename, tmpdir)1627 exe = self.bins("unzzip-big")1628 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1629 returncodes = [0])1630 self.assertLess(len(run.output), 30)1631 self.assertLess(len(errors(run.errors)), 1)1632 self.assertIn(" stored test", run.output)1633 #1634 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1635 returncodes = [0])1636 self.assertLess(len(run.output), 30)1637 self.assertLess(len(errors(run.errors)), 1)1638 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1639 self.rm_testdir()1640 def test_59742_zzipdir_mem_CVE_2017_5974(self):1641 """ run unzzip-mem -l $(CVE_2017_5974).zip """1642 tmpdir = self.testdir()1643 filename = self.zip_CVE_2017_59741644 file_url = self.url_CVE_2017_59741645 download_raw(file_url, filename, tmpdir)1646 exe = self.bins("unzzip-mem")1647 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1648 returncodes = [0])1649 self.assertLess(len(run.output), 30)1650 self.assertLess(len(errors(run.errors)), 1)1651 self.assertIn(" 3 test", run.output)1652 #1653 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1654 returncodes = [2])1655 self.assertLess(len(run.output), 30)1656 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1657 self.rm_testdir()1658 def test_59743_zzipdir_mix_CVE_2017_5974(self):1659 """ run unzzip-mix -l $(CVE_2017_5974).zip """1660 tmpdir = self.testdir()1661 filename = self.zip_CVE_2017_59741662 file_url = self.url_CVE_2017_59741663 download_raw(file_url, filename, tmpdir)1664 exe = self.bins("unzzip-mix")1665 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1666 returncodes = [0])1667 self.assertLess(len(run.output), 30)1668 self.assertLess(len(errors(run.errors)), 1)1669 self.assertIn(" 3 test", run.output)1670 #1671 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1672 returncodes = [0])1673 self.assertLess(len(run.output), 30)1674 self.assertLess(len(errors(run.errors)), 1)1675 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # FIXME1676 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # FIXME1677 self.rm_testdir()1678 def test_59744_zzipdir_zap_CVE_2017_5974(self):1679 """ run unzzip -l $(CVE_2017_5974).zip """1680 tmpdir = self.testdir()1681 filename = self.zip_CVE_2017_59741682 file_url = self.url_CVE_2017_59741683 download_raw(file_url, filename, tmpdir)1684 exe = self.bins("unzzip")1685 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1686 returncodes = [0, 255])1687 self.assertLess(len(run.output), 30)1688 self.assertLess(len(errors(run.errors)), 1)1689 self.assertIn(" 3 test", run.output)1690 #1691 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1692 returncodes = [0])1693 self.assertLess(len(run.output), 30)1694 self.assertLess(len(errors(run.errors)), 1)1695 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1696 self.rm_testdir()1697 def test_59749(self):1698 """ check $(CVE).zip """1699 tmpdir = self.testdir()1700 filename = self.zip_CVE_2017_59741701 file_url = self.url_CVE_2017_59741702 download_raw(file_url, filename, tmpdir)1703 shell("ls -l {tmpdir}/{filename}".format(**locals()))1704 size = os.path.getsize(os.path.join(tmpdir, filename))1705 self.assertEqual(size, 161)1706 url_CVE_2017_5975 = "https://github.com/asarubbo/poc/blob/master"1707 zip_CVE_2017_5975 = "00151-zziplib-heapoverflow-__zzip_get64"1708 def test_59750_infozipdir_CVE_2017_5975(self):1709 """ run info-zip dir test0.zip """1710 tmpdir = self.testdir()1711 filename = self.zip_CVE_2017_59751712 file_url = self.url_CVE_2017_59751713 download_raw(file_url, filename, tmpdir)1714 exe = self.bins("unzip")1715 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1716 returncodes = [0, 2])1717 self.assertIn(' missing 10 bytes in zipfile', run.errors)1718 self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors)1719 self.assertIn(' 1 file', run.output)1720 self.assertLess(len(run.output), 330)1721 self.assertLess(len(errors(run.errors)), 430)1722 #1723 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),1724 returncodes = [2])1725 self.assertLess(len(run.output), 90)1726 self.assertLess(len(errors(run.errors)), 900)1727 self.assertIn('file #1: bad zipfile offset (local header sig): 127', run.errors)1728 #self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1729 self.assertFalse(os.path.exists(tmpdir+"/test"))1730 self.rm_testdir()1731 def test_59751_zzipdir_big_CVE_2017_5975(self):1732 """ run info-zip -l $(CVE_2017_5975).zip """1733 tmpdir = self.testdir()1734 filename = self.zip_CVE_2017_59751735 file_url = self.url_CVE_2017_59751736 download_raw(file_url, filename, tmpdir)1737 exe = self.bins("unzzip-big")1738 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1739 returncodes = [0])1740 self.assertLess(len(run.output), 30)1741 self.assertLess(len(errors(run.errors)), 1)1742 self.assertIn(" stored test", run.output)1743 #1744 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1745 returncodes = [0])1746 self.assertLess(len(run.output), 30)1747 self.assertLess(len(errors(run.errors)), 1)1748 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # TODO1749 self.rm_testdir()1750 def test_59752_zzipdir_mem_CVE_2017_5975(self):1751 """ run unzzip-mem -l $(CVE_2017_5975).zip """1752 tmpdir = self.testdir()1753 filename = self.zip_CVE_2017_59751754 file_url = self.url_CVE_2017_59751755 download_raw(file_url, filename, tmpdir)1756 exe = self.bins("unzzip-mem")1757 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1758 returncodes = [0])1759 self.assertLess(len(run.output), 1)1760 self.assertLess(len(errors(run.errors)), 180)1761 self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors)1762 self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors)1763 #1764 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1765 returncodes = [2])1766 self.assertLess(len(run.output), 30)1767 self.assertLess(len(errors(run.errors)), 200)1768 if grep("DEBUG:", run.errors):1769 self.assertIn("findfirst (nil)", run.errors)1770 self.assertFalse(os.path.exists(tmpdir+"/test"))1771 self.rm_testdir()1772 def test_59753_zzipdir_mix_CVE_2017_5975(self):1773 """ run unzzip-mix -l $(CVE_2017_5975).zip """1774 tmpdir = self.testdir()1775 filename = self.zip_CVE_2017_59751776 file_url = self.url_CVE_2017_59751777 download_raw(file_url, filename, tmpdir)1778 exe = self.bins("unzzip-mix")1779 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1780 returncodes = [0,2])1781 self.assertLess(len(run.output), 1)1782 self.assertLess(len(errors(run.errors)), 180)1783 self.assertTrue(greps(run.errors, "Invalid or"))1784 #1785 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1786 returncodes = [0,2])1787 self.assertLess(len(run.output), 30)1788 self.assertLess(len(errors(run.errors)), 200)1789 self.assertTrue(greps(run.errors, "Invalid or"))1790 self.assertFalse(os.path.exists(tmpdir+"/test"))1791 self.rm_testdir()1792 def test_59754_zzipdir_zap_CVE_2017_5975(self):1793 """ run unzzip -l $(CVE_2017_5975).zip """1794 tmpdir = self.testdir()1795 filename = self.zip_CVE_2017_59751796 file_url = self.url_CVE_2017_59751797 download_raw(file_url, filename, tmpdir)1798 exe = self.bins("unzzip")1799 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1800 returncodes = [0,3])1801 self.assertLess(len(run.output), 1)1802 self.assertLess(len(errors(run.errors)), 180)1803 self.assertIn(": Success", run.errors)1804 #1805 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1806 returncodes = [0,3])1807 self.assertLess(len(run.output), 30)1808 self.assertLess(len(errors(run.errors)), 200)1809 self.assertTrue(greps(run.errors, "Zipfile corrupted"))1810 self.assertFalse(os.path.exists(tmpdir+"/test"))1811 self.rm_testdir()1812 def test_59759(self):1813 """ check $(CVE).zip """1814 tmpdir = self.testdir()1815 filename = self.zip_CVE_2017_59751816 file_url = self.url_CVE_2017_59751817 download_raw(file_url, filename, tmpdir)1818 shell("ls -l {tmpdir}/{filename}".format(**locals()))1819 size = os.path.getsize(os.path.join(tmpdir, filename))1820 self.assertEqual(size, 151)1821 url_CVE_2017_5976 = "https://github.com/asarubbo/poc/blob/master"1822 zip_CVE_2017_5976 = "00152-zziplib-heapoverflow-zzip_mem_entry_extra_block"1823 def test_59760_infozipdir_CVE_2017_5976(self):1824 """ run info-zip dir test0.zip """1825 tmpdir = self.testdir()1826 filename = self.zip_CVE_2017_59761827 file_url = self.url_CVE_2017_59761828 download_raw(file_url, filename, tmpdir)1829 exe = self.bins("unzip")1830 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1831 returncodes = [0, 2])1832 self.assertIn(' 27 extra bytes at beginning or within zipfile', run.errors)1833 self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors)1834 self.assertIn(' 1 file', run.output)1835 self.assertLess(len(run.output), 330)1836 self.assertLess(len(errors(run.errors)), 500)1837 #1838 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),1839 returncodes = [2])1840 self.assertLess(len(run.output), 190)1841 self.assertLess(len(errors(run.errors)), 900)1842 self.assertIn("extracting: test", run.output)1843 self.assertIn('-27 bytes too long', run.errors)1844 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1845 # self.assertFalse(os.path.exists(tmpdir+"/test"))1846 self.rm_testdir()1847 def test_59761_zzipdir_big_CVE_2017_5976(self):1848 """ run info-zip -l $(CVE_2017_5976).zip """1849 tmpdir = self.testdir()1850 filename = self.zip_CVE_2017_59761851 file_url = self.url_CVE_2017_59761852 download_raw(file_url, filename, tmpdir)1853 exe = self.bins("unzzip-big")1854 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1855 returncodes = [0])1856 self.assertLess(len(run.output), 30)1857 self.assertLess(len(errors(run.errors)), 1)1858 self.assertIn(" stored test", run.output)1859 #1860 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1861 returncodes = [0])1862 self.assertLess(len(run.output), 30)1863 self.assertLess(len(errors(run.errors)), 1)1864 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1865 self.rm_testdir()1866 def test_59762_zzipdir_mem_CVE_2017_5976(self):1867 """ run unzzip-mem -l $(CVE_2017_5976).zip """1868 tmpdir = self.testdir()1869 filename = self.zip_CVE_2017_59761870 file_url = self.url_CVE_2017_59761871 download_raw(file_url, filename, tmpdir)1872 exe = self.bins("unzzip-mem")1873 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1874 returncodes = [0])1875 self.assertLess(len(run.output), 30)1876 self.assertLess(len(errors(run.errors)), 1)1877 self.assertIn("3 test", run.output)1878 #1879 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1880 returncodes = [2])1881 self.assertLess(len(run.output), 30)1882 self.assertLess(len(errors(run.errors)), 30) # TODO1883 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1884 self.rm_testdir()1885 def test_59763_zzipdir_mix_CVE_2017_5976(self):1886 """ run unzzip-mix -l $(CVE_2017_5976).zip """1887 tmpdir = self.testdir()1888 filename = self.zip_CVE_2017_59761889 file_url = self.url_CVE_2017_59761890 download_raw(file_url, filename, tmpdir)1891 exe = self.bins("unzzip-mix")1892 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1893 returncodes = [0])1894 self.assertLess(len(run.output), 30)1895 self.assertLess(len(errors(run.errors)), 1)1896 self.assertIn("3 test", run.output)1897 #1898 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1899 returncodes = [0])1900 self.assertLess(len(run.output), 30)1901 self.assertLess(len(errors(run.errors)), 30) 1902 self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # FIXME1903 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # FIXME1904 self.rm_testdir()1905 def test_59764_zzipdir_zap_CVE_2017_5976(self):1906 """ run unzzip -l $(CVE_2017_5976).zip """1907 tmpdir = self.testdir()1908 filename = self.zip_CVE_2017_59761909 file_url = self.url_CVE_2017_59761910 download_raw(file_url, filename, tmpdir)1911 exe = self.bins("unzzip")1912 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1913 returncodes = [0, 255])1914 self.assertLess(len(run.output), 30)1915 self.assertLess(len(errors(run.errors)), 1)1916 self.assertIn("3 test", run.output)1917 #1918 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1919 returncodes = [0])1920 self.assertLess(len(run.output), 30)1921 self.assertLess(len(errors(run.errors)), 30)1922 self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1923 self.rm_testdir()1924 def test_59769(self):1925 """ check $(CVE).zip """1926 tmpdir = self.testdir()1927 filename = self.zip_CVE_2017_59761928 file_url = self.url_CVE_2017_59761929 download_raw(file_url, filename, tmpdir)1930 shell("ls -l {tmpdir}/{filename}".format(**locals()))1931 size = os.path.getsize(os.path.join(tmpdir, filename))1932 self.assertEqual(size, 188)1933 url_CVE_2017_5980 = "https://github.com/asarubbo/poc/blob/master"1934 zip_CVE_2017_5980 = "00154-zziplib-nullptr-zzip_mem_entry_new"1935 def test_59800_infozipdir_CVE_2017_5980(self):1936 """ run info-zip dir test0.zip """1937 tmpdir = self.testdir()1938 filename = self.zip_CVE_2017_59801939 file_url = self.url_CVE_2017_59801940 download_raw(file_url, filename, tmpdir)1941 exe = self.bins("unzip")1942 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1943 returncodes = [0, 2])1944 self.assertIn(' missing 6 bytes in zipfile', run.errors)1945 self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors)1946 self.assertIn(' 1 file', run.output)1947 self.assertLess(len(run.output), 330)1948 self.assertLess(len(errors(run.errors)), 500)1949 #1950 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),1951 returncodes = [3])1952 self.assertLess(len(run.output), 90)1953 self.assertLess(len(errors(run.errors)), 900)1954 self.assertIn('file #1: bad zipfile offset (lseek)', run.errors)1955 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1956 self.assertFalse(os.path.exists(tmpdir+"/test"))1957 self.rm_testdir()1958 def test_59801_zzipdir_big_CVE_2017_5980(self):1959 """ run info-zip -l $(CVE_2017_5980).zip """1960 tmpdir = self.testdir()1961 filename = self.zip_CVE_2017_59801962 file_url = self.url_CVE_2017_59801963 download_raw(file_url, filename, tmpdir)1964 exe = self.bins("unzzip-big")1965 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1966 returncodes = [0])1967 self.assertLess(len(run.output), 30)1968 self.assertLess(len(errors(run.errors)), 1)1969 self.assertIn(" stored (null)", run.output)1970 #1971 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1972 returncodes = [0,1])1973 self.assertLess(len(run.output), 30)1974 self.assertLess(len(errors(run.errors)), 1)1975 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1976 self.assertFalse(os.path.exists(tmpdir+"/test"))1977 self.rm_testdir()1978 def test_59802_zzipdir_mem_CVE_2017_5980(self):1979 """ run unzzip-mem -l $(CVE_2017_5980).zip """1980 tmpdir = self.testdir()1981 filename = self.zip_CVE_2017_59801982 file_url = self.url_CVE_2017_59801983 download_raw(file_url, filename, tmpdir)1984 exe = self.bins("unzzip-mem")1985 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),1986 returncodes = [0])1987 self.assertLess(len(run.output), 1)1988 self.assertLess(len(errors(run.errors)), 180)1989 self.assertTrue(greps(run.errors, "unable to load disk"))1990 #1991 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),1992 returncodes = [2])1993 self.assertLess(len(run.output), 30)1994 self.assertLess(len(errors(run.errors)), 200)1995 self.assertFalse(os.path.exists(tmpdir+"/test"))1996 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)1997 self.rm_testdir()1998 def test_59803_zzipdir_mix_CVE_2017_5980(self):1999 """ run unzzip-mix -l $(CVE_2017_5980).zip """2000 tmpdir = self.testdir()2001 filename = self.zip_CVE_2017_59802002 file_url = self.url_CVE_2017_59802003 download_raw(file_url, filename, tmpdir)2004 exe = self.bins("unzzip-mix")2005 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2006 returncodes = [2])2007 self.assertLess(len(run.output), 1)2008 self.assertLess(len(errors(run.errors)), 180)2009 self.assertTrue(greps(run.errors, "Invalid or"))2010 #2011 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2012 returncodes = [2])2013 self.assertLess(len(run.output), 30)2014 self.assertLess(len(errors(run.errors)), 200)2015 self.assertFalse(os.path.exists(tmpdir+"/test"))2016 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2017 self.rm_testdir()2018 def test_59804_zzipdir_zap_CVE_2017_5980(self):2019 """ run unzzip -l $(CVE_2017_5980).zip """2020 tmpdir = self.testdir()2021 filename = self.zip_CVE_2017_59802022 file_url = self.url_CVE_2017_59802023 download_raw(file_url, filename, tmpdir)2024 exe = self.bins("unzzip")2025 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2026 returncodes = [3])2027 self.assertLess(len(run.output), 1)2028 self.assertLess(len(errors(run.errors)), 180)2029 self.assertIn(": Success", run.errors)2030 #2031 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2032 returncodes = [3]) # TODO2033 self.assertLess(len(run.output), 30)2034 self.assertLess(len(errors(run.errors)), 200)2035 self.assertFalse(os.path.exists(tmpdir+"/test"))2036 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2037 self.rm_testdir()2038 def test_59809(self):2039 """ check $(CVE).zip """2040 tmpdir = self.testdir()2041 filename = self.zip_CVE_2017_59802042 file_url = self.url_CVE_2017_59802043 download_raw(file_url, filename, tmpdir)2044 shell("ls -l {tmpdir}/{filename}".format(**locals()))2045 size = os.path.getsize(os.path.join(tmpdir, filename))2046 self.assertEqual(size, 155)2047 url_CVE_2017_5981 = "https://github.com/asarubbo/poc/blob/master"2048 zip_CVE_2017_5981 = "00161-zziplib-assertionfailure-seeko_C"2049 def test_59810_infozipdir_CVE_2017_5981(self):2050 """ run info-zip dir test0.zip """2051 tmpdir = self.testdir()2052 filename = self.zip_CVE_2017_59812053 file_url = self.url_CVE_2017_59812054 download_raw(file_url, filename, tmpdir)2055 exe = self.bins("unzip")2056 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2057 returncodes = [0, 3])2058 self.assertIn(' missing 4 bytes in zipfile', run.errors)2059 self.assertIn("zipfile corrupt", run.errors)2060 self.assertLess(len(run.output), 80)2061 self.assertLess(len(errors(run.errors)), 500)2062 #2063 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),2064 returncodes = [3])2065 self.assertLess(len(run.output), 90)2066 self.assertLess(len(errors(run.errors)), 500)2067 self.assertIn('zipfile corrupt.', run.errors)2068 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2069 self.assertFalse(os.path.exists(tmpdir+"/test"))2070 self.rm_testdir()2071 def test_59811_zzipdir_big_CVE_2017_5981(self):2072 """ run info-zip -l $(CVE_2017_5981).zip """2073 tmpdir = self.testdir()2074 filename = self.zip_CVE_2017_59812075 file_url = self.url_CVE_2017_59812076 download_raw(file_url, filename, tmpdir)2077 exe = self.bins("unzzip-big")2078 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2079 returncodes = [0])2080 self.assertLess(len(run.output), 1)2081 self.assertLess(len(errors(run.errors)), 1)2082 #2083 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2084 returncodes = [0])2085 self.assertLess(len(run.output), 30)2086 self.assertLess(len(errors(run.errors)), 1)2087 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2088 self.assertFalse(os.path.exists(tmpdir+"/test"))2089 self.rm_testdir()2090 def test_59812_zzipdir_mem_CVE_2017_5981(self):2091 """ run unzzip-mem -l $(CVE_2017_5981).zip """2092 tmpdir = self.testdir()2093 filename = self.zip_CVE_2017_59812094 file_url = self.url_CVE_2017_59812095 download_raw(file_url, filename, tmpdir)2096 exe = self.bins("unzzip-mem")2097 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2098 returncodes = [0])2099 self.assertLess(len(run.output), 1)2100 self.assertLess(len(errors(run.errors)), 1)2101 #2102 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2103 returncodes = [2])2104 self.assertLess(len(run.output), 30)2105 self.assertLess(len(errors(run.errors)), 10)2106 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2107 self.assertFalse(os.path.exists(tmpdir+"/test"))2108 self.rm_testdir()2109 def test_59813_zzipdir_mix_CVE_2017_5981(self):2110 """ run unzzip-mix -l $(CVE_2017_5981).zip """2111 tmpdir = self.testdir()2112 filename = self.zip_CVE_2017_59812113 file_url = self.url_CVE_2017_59812114 download_raw(file_url, filename, tmpdir)2115 exe = self.bins("unzzip-mix")2116 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2117 returncodes = [0,2])2118 self.assertLess(len(run.output), 1)2119 self.assertTrue(greps(run.errors, "Invalid or"))2120 #2121 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2122 returncodes = [0,2])2123 self.assertLess(len(run.output), 30)2124 self.assertLess(len(errors(run.errors)), 10)2125 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2126 self.assertFalse(os.path.exists(tmpdir+"/test"))2127 self.rm_testdir()2128 def test_59814_zzipdir_zap_CVE_2017_5981(self):2129 """ run unzzip-zap -l $(CVE_2017_5981).zip """2130 tmpdir = self.testdir()2131 filename = self.zip_CVE_2017_59812132 file_url = self.url_CVE_2017_59812133 download_raw(file_url, filename, tmpdir)2134 exe = self.bins("unzzip")2135 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2136 returncodes = [0,3])2137 self.assertLess(len(run.output), 1)2138 self.assertLess(len(errors(run.errors)), 80)2139 self.assertIn(": Success", run.errors)2140 #2141 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2142 returncodes = [0,3])2143 self.assertLess(len(run.output), 30)2144 self.assertLess(len(errors(run.errors)), 10)2145 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2146 self.assertFalse(os.path.exists(tmpdir+"/test"))2147 self.rm_testdir()2148 def test_59819(self):2149 """ check $(CVE).zip """2150 tmpdir = self.testdir()2151 filename = self.zip_CVE_2017_59812152 file_url = self.url_CVE_2017_59812153 download_raw(file_url, filename, tmpdir)2154 shell("ls -l {tmpdir}/{filename}".format(**locals()))2155 size = os.path.getsize(os.path.join(tmpdir, filename))2156 self.assertEqual(size, 157)2157 url_CVE_2018_10 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"2158 zip_CVE_2018_10 = "zziplib_0-13-67_zzdir_invalid-memory-access_main.zip"2159 def test_63010(self):2160 """ info unzip -l $(CVE).zip """2161 tmpdir = self.testdir()2162 filename = self.zip_CVE_2018_102163 file_url = self.url_CVE_2018_102164 download_raw(file_url, filename, tmpdir)2165 exe = self.bins("unzip")2166 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2167 returncodes = [0, 9])2168 self.assertIn("End-of-central-directory signature not found", run.errors)2169 self.assertLess(len(run.output), 80)2170 self.assertLess(len(errors(run.errors)), 600)2171 #2172 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),2173 returncodes = [9])2174 self.assertLess(len(run.output), 90)2175 self.assertLess(len(errors(run.errors)), 600)2176 self.assertIn('End-of-central-directory signature not found', run.errors)2177 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2178 self.assertFalse(os.path.exists(tmpdir+"/test"))2179 self.rm_testdir()2180 def test_63011(self):2181 """ unzzip-big -l $(CVE).zip """2182 tmpdir = self.testdir()2183 filename = self.zip_CVE_2018_102184 file_url = self.url_CVE_2018_102185 download_raw(file_url, filename, tmpdir)2186 exe = self.bins("unzzip-big")2187 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2188 returncodes = [0])2189 self.assertLess(len(run.output), 1)2190 self.assertLess(len(errors(run.errors)), 1)2191 #2192 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2193 returncodes = [0])2194 self.assertLess(len(run.output), 30)2195 self.assertLess(len(errors(run.errors)), 1)2196 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2197 self.assertFalse(os.path.exists(tmpdir+"/test"))2198 self.rm_testdir()2199 def test_63012(self):2200 """ unzzip-mem -l $(CVE).zip """2201 tmpdir = self.testdir()2202 filename = self.zip_CVE_2018_102203 file_url = self.url_CVE_2018_102204 download_raw(file_url, filename, tmpdir)2205 exe = self.bins("unzzip-mem")2206 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2207 returncodes = [0])2208 self.assertLess(len(run.output), 1)2209 self.assertLess(len(errors(run.errors)), 1)2210 #2211 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2212 returncodes = [2])2213 self.assertLess(len(run.output), 30)2214 self.assertLess(len(errors(run.errors)), 10)2215 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2216 self.assertFalse(os.path.exists(tmpdir+"/test"))2217 self.rm_testdir()2218 def test_63013(self):2219 """ unzzip-mix -l $(CVE).zip """2220 tmpdir = self.testdir()2221 filename = self.zip_CVE_2018_102222 file_url = self.url_CVE_2018_102223 download_raw(file_url, filename, tmpdir)2224 exe = self.bins("unzzip-mix")2225 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2226 returncodes = [0,2])2227 self.assertLess(len(run.output), 1)2228 self.assertTrue(greps(run.errors, "Invalid or"))2229 #2230 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2231 returncodes = [0,2])2232 self.assertLess(len(run.output), 30)2233 self.assertLess(len(errors(run.errors)), 10)2234 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2235 self.assertFalse(os.path.exists(tmpdir+"/test"))2236 self.rm_testdir()2237 def test_63014(self):2238 """ unzzip-zap -l $(CVE).zip """2239 tmpdir = self.testdir()2240 filename = self.zip_CVE_2018_102241 file_url = self.url_CVE_2018_102242 download_raw(file_url, filename, tmpdir)2243 exe = self.bins("unzzip")2244 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2245 returncodes = [0,3])2246 self.assertLess(len(run.output), 1)2247 self.assertLess(len(errors(run.errors)), 80)2248 self.assertIn(": Success", run.errors)2249 #2250 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2251 returncodes = [0,3])2252 self.assertLess(len(run.output), 30)2253 self.assertLess(len(errors(run.errors)), 10)2254 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2255 self.assertFalse(os.path.exists(tmpdir+"/test"))2256 self.rm_testdir()2257 def test_63018(self):2258 """ zzdir on $(CVE).zip """2259 tmpdir = self.testdir()2260 filename = self.zip_CVE_2018_102261 file_url = self.url_CVE_2018_102262 download_raw(file_url, filename, tmpdir)2263 exe = self.bins("zzdir")2264 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2265 returncodes = [1])2266 self.assertLess(len(run.output), 1)2267 self.assertLess(len(errors(run.errors)), 80)2268 self.assertTrue(greps(run.errors, "Invalid or"))2269 def test_63019(self):2270 """ check $(CVE).zip """2271 tmpdir = self.testdir()2272 filename = self.zip_CVE_2018_102273 file_url = self.url_CVE_2018_102274 download_raw(file_url, filename, tmpdir)2275 shell("ls -l {tmpdir}/{filename}".format(**locals()))2276 size = os.path.getsize(os.path.join(tmpdir, filename))2277 self.assertEqual(size, 188)2278 url_CVE_2018_11 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"2279 zip_CVE_2018_11 = "zziplib_0-13-67_unzzip_infinite-loop_unzzip_cat_file.zip"2280 def test_63110(self):2281 """ info unzip -l $(CVE).zip """2282 tmpdir = self.testdir()2283 filename = self.zip_CVE_2018_112284 file_url = self.url_CVE_2018_112285 download_raw(file_url, filename, tmpdir)2286 exe = self.bins("unzip")2287 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2288 returncodes = [0, 9])2289 self.assertIn("End-of-central-directory signature not found", run.errors)2290 self.assertLess(len(run.output), 90)2291 self.assertLess(len(errors(run.errors)), 600)2292 #2293 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),2294 returncodes = [9])2295 self.assertLess(len(run.output), 90)2296 self.assertLess(len(errors(run.errors)), 600)2297 self.assertIn('End-of-central-directory signature not found', run.errors)2298 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2299 self.assertFalse(os.path.exists(tmpdir+"/test"))2300 self.rm_testdir()2301 def test_63111(self):2302 """ unzzip-big -l $(CVE).zip """2303 tmpdir = self.testdir()2304 filename = self.zip_CVE_2018_112305 file_url = self.url_CVE_2018_112306 download_raw(file_url, filename, tmpdir)2307 exe = self.bins("unzzip-big")2308 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2309 returncodes = [0])2310 self.assertLess(len(run.output), 1)2311 self.assertLess(len(errors(run.errors)), 1)2312 #2313 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2314 returncodes = [0])2315 self.assertLess(len(run.output), 30)2316 self.assertLess(len(errors(run.errors)), 1)2317 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2318 self.assertFalse(os.path.exists(tmpdir+"/test"))2319 self.rm_testdir()2320 def test_63112(self):2321 """ unzzip-mem -l $(CVE).zip """2322 tmpdir = self.testdir()2323 filename = self.zip_CVE_2018_112324 file_url = self.url_CVE_2018_112325 download_raw(file_url, filename, tmpdir)2326 exe = self.bins("unzzip-mem")2327 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2328 returncodes = [0])2329 self.assertLess(len(run.output), 1)2330 self.assertLess(len(errors(run.errors)), 1)2331 #2332 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2333 returncodes = [2])2334 self.assertLess(len(run.output), 30)2335 self.assertLess(len(errors(run.errors)), 10)2336 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2337 self.assertFalse(os.path.exists(tmpdir+"/test"))2338 self.rm_testdir()2339 def test_63113(self):2340 """ unzzip-mix -l $(CVE).zip """2341 tmpdir = self.testdir()2342 filename = self.zip_CVE_2018_112343 file_url = self.url_CVE_2018_112344 download_raw(file_url, filename, tmpdir)2345 exe = self.bins("unzzip-mix")2346 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2347 returncodes = [0,2])2348 self.assertLess(len(run.output), 1)2349 self.assertTrue(greps(run.errors, "Invalid or"))2350 #2351 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2352 returncodes = [0,2])2353 self.assertLess(len(run.output), 30)2354 self.assertLess(len(errors(run.errors)), 10)2355 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2356 self.assertFalse(os.path.exists(tmpdir+"/test"))2357 self.rm_testdir()2358 def test_63114(self):2359 """ unzzip-zap -l $(CVE).zip """2360 tmpdir = self.testdir()2361 filename = self.zip_CVE_2018_112362 file_url = self.url_CVE_2018_112363 download_raw(file_url, filename, tmpdir)2364 exe = self.bins("unzzip")2365 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2366 returncodes = [0,3])2367 self.assertLess(len(run.output), 1)2368 self.assertLess(len(errors(run.errors)), 90)2369 self.assertIn(": Success", run.errors)2370 #2371 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2372 returncodes = [0,3])2373 self.assertLess(len(run.output), 30)2374 self.assertLess(len(errors(run.errors)), 10)2375 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2376 self.assertFalse(os.path.exists(tmpdir+"/test"))2377 #2378 run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()),2379 returncodes = [0,3])2380 self.rm_testdir()2381 def test_63119(self):2382 """ check $(CVE).zip """2383 tmpdir = self.testdir()2384 filename = self.zip_CVE_2018_112385 file_url = self.url_CVE_2018_112386 download_raw(file_url, filename, tmpdir)2387 shell("ls -l {tmpdir}/{filename}".format(**locals()))2388 size = os.path.getsize(os.path.join(tmpdir, filename))2389 self.assertEqual(size, 280)2390 url_CVE_2018_12 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"2391 zip_CVE_2018_12 = "zziplib_0-13-67_unzip-mem_buffer-access-with-incorrect-length-value_zzip_disk_fread.zip"2392 def test_63810(self):2393 """ info unzip -l $(CVE).zip """2394 tmpdir = self.testdir()2395 filename = self.zip_CVE_2018_122396 file_url = self.url_CVE_2018_122397 download_raw(file_url, filename, tmpdir)2398 exe = self.bins("unzip")2399 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2400 returncodes = [2])2401 self.assertIn('reported length of central directory', run.errors)2402 self.assertLess(len(run.output), 300)2403 self.assertLess(len(errors(run.errors)), 800)2404 #2405 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),2406 returncodes = [2])2407 self.assertLess(len(run.output), 300)2408 self.assertLess(len(errors(run.errors)), 800)2409 self.assertIn('reported length of central directory', run.errors)2410 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2411 self.assertFalse(os.path.exists(tmpdir+"/test"))2412 self.rm_testdir()2413 def test_63811(self):2414 """ unzzip-big -l $(CVE).zip """2415 tmpdir = self.testdir()2416 filename = self.zip_CVE_2018_122417 file_url = self.url_CVE_2018_122418 download_raw(file_url, filename, tmpdir)2419 exe = self.bins("unzzip-big")2420 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2421 returncodes = [0])2422 self.assertLess(len(run.output), 20)2423 self.assertLess(len(errors(run.errors)), 1)2424 #2425 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2426 returncodes = [0])2427 self.assertLess(len(run.output), 30)2428 self.assertLess(len(errors(run.errors)), 1)2429 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2430 self.assertFalse(os.path.exists(tmpdir+"/test"))2431 self.rm_testdir()2432 def test_63812(self):2433 """ unzzip-mem -l $(CVE).zip """2434 tmpdir = self.testdir()2435 filename = self.zip_CVE_2018_122436 file_url = self.url_CVE_2018_122437 download_raw(file_url, filename, tmpdir)2438 exe = self.bins("unzzip-mem")2439 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2440 returncodes = [0])2441 self.assertLess(len(run.output), 1)2442 self.assertLess(len(errors(run.errors)), 1)2443 #2444 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2445 returncodes = [2])2446 self.assertLess(len(run.output), 30)2447 self.assertLess(len(errors(run.errors)), 10)2448 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2449 self.assertFalse(os.path.exists(tmpdir+"/test"))2450 self.rm_testdir()2451 def test_63813(self):2452 """ unzzip-mix -l $(CVE).zip """2453 tmpdir = self.testdir()2454 filename = self.zip_CVE_2018_122455 file_url = self.url_CVE_2018_122456 download_raw(file_url, filename, tmpdir)2457 exe = self.bins("unzzip-mix")2458 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2459 returncodes = [0,2])2460 self.assertLess(len(run.output), 1)2461 self.assertTrue(grep(run.errors, "central directory not found"))2462 #2463 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2464 returncodes = [0,2])2465 self.assertLess(len(run.output), 30)2466 self.assertLess(len(errors(run.errors)), 10)2467 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2468 self.assertFalse(os.path.exists(tmpdir+"/test"))2469 self.rm_testdir()2470 def test_63814(self):2471 """ unzzip-zap -l $(CVE).zip """2472 tmpdir = self.testdir()2473 filename = self.zip_CVE_2018_122474 file_url = self.url_CVE_2018_122475 download_raw(file_url, filename, tmpdir)2476 exe = self.bins("unzzip")2477 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2478 returncodes = [0,3])2479 self.assertLess(len(run.output), 1)2480 self.assertLess(len(errors(run.errors)), 200)2481 self.assertIn(": Success", run.errors)2482 #2483 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2484 returncodes = [0,3])2485 self.assertLess(len(run.output), 30)2486 self.assertLess(len(errors(run.errors)), 10)2487 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2488 self.assertFalse(os.path.exists(tmpdir+"/test"))2489 self.rm_testdir()2490 def test_63819(self):2491 """ check $(CVE).zip """2492 tmpdir = self.testdir()2493 filename = self.zip_CVE_2018_122494 file_url = self.url_CVE_2018_122495 download_raw(file_url, filename, tmpdir)2496 shell("ls -l {tmpdir}/{filename}".format(**locals()))2497 size = os.path.getsize(os.path.join(tmpdir, filename))2498 self.assertEqual(size, 152)2499 url_CVE_2018_14 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"2500 zip_CVE_2018_14 = "zziplib_0-13-67_zzdir_memory-alignment-errors___zzip_fetch_disk_trailer.zip"2501 def test_64840(self):2502 """ info unzip -l $(CVE).zip """2503 tmpdir = self.testdir()2504 filename = self.zip_CVE_2018_142505 file_url = self.url_CVE_2018_142506 download_raw(file_url, filename, tmpdir)2507 exe = self.bins("unzip")2508 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2509 returncodes = [3])2510 self.assertIn("attempt to seek before beginning of zipfile", run.errors)2511 self.assertLess(len(run.output), 200)2512 self.assertLess(len(errors(run.errors)), 800)2513 #2514 exe = self.bins("unzip")2515 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),2516 returncodes = [3])2517 self.assertLess(len(run.output), 200)2518 self.assertLess(len(errors(run.errors)), 800)2519 self.assertIn('attempt to seek before beginning of zipfile', run.errors)2520 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2521 self.assertFalse(os.path.exists(tmpdir+"/test"))2522 self.rm_testdir()2523 def test_64841(self):2524 """ unzzip-big -l $(CVE).zip """2525 tmpdir = self.testdir()2526 filename = self.zip_CVE_2018_142527 file_url = self.url_CVE_2018_142528 download_raw(file_url, filename, tmpdir)2529 exe = self.bins("unzzip-big")2530 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2531 returncodes = [0])2532 self.assertLess(len(run.output), 1)2533 self.assertLess(len(errors(run.errors)), 1)2534 #2535 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2536 returncodes = [0])2537 self.assertLess(len(run.output), 30)2538 self.assertLess(len(errors(run.errors)), 1)2539 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2540 self.assertFalse(os.path.exists(tmpdir+"/test"))2541 self.rm_testdir()2542 def test_64842(self):2543 """ unzzip-mem -l $(CVE).zip """2544 tmpdir = self.testdir()2545 filename = self.zip_CVE_2018_142546 file_url = self.url_CVE_2018_142547 download_raw(file_url, filename, tmpdir)2548 exe = self.bins("unzzip-mem")2549 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2550 returncodes = [0])2551 self.assertLess(len(run.output), 1)2552 #2553 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2554 returncodes = [2])2555 self.assertLess(len(run.output), 30)2556 self.assertLess(len(errors(run.errors)), 10)2557 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2558 self.assertFalse(os.path.exists(tmpdir+"/test"))2559 self.rm_testdir()2560 def test_64843(self):2561 """ unzzip-mix -l $(CVE).zip """2562 tmpdir = self.testdir()2563 filename = self.zip_CVE_2018_142564 file_url = self.url_CVE_2018_142565 download_raw(file_url, filename, tmpdir)2566 exe = self.bins("unzzip-mix")2567 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2568 returncodes = [0, 2])2569 self.assertLess(len(run.output), 1)2570 self.assertTrue(greps(run.errors, "Invalid or"))2571 #2572 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2573 returncodes = [0,2])2574 self.assertLess(len(run.output), 30)2575 self.assertLess(len(errors(run.errors)), 10)2576 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2577 self.assertFalse(os.path.exists(tmpdir+"/test"))2578 self.rm_testdir()2579 def test_64844(self):2580 """ unzzip-zap -l $(CVE).zip """2581 tmpdir = self.testdir()2582 filename = self.zip_CVE_2018_142583 file_url = self.url_CVE_2018_142584 download_raw(file_url, filename, tmpdir)2585 exe = self.bins("unzzip")2586 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2587 returncodes = [0, 3])2588 self.assertLess(len(run.output), 1)2589 self.assertLess(len(errors(run.errors)), 200)2590 self.assertIn(": Success", run.errors)2591 #2592 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2593 returncodes = [0,3])2594 self.assertLess(len(run.output), 30)2595 self.assertLess(len(errors(run.errors)), 10)2596 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2597 self.assertFalse(os.path.exists(tmpdir+"/test"))2598 self.rm_testdir()2599 def test_64848(self):2600 """ zzdir $(CVE).zip """2601 tmpdir = self.testdir()2602 filename = self.zip_CVE_2018_142603 file_url = self.url_CVE_2018_142604 download_raw(file_url, filename, tmpdir)2605 exe = self.bins("zzdir")2606 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2607 returncodes = [1])2608 self.assertLess(len(run.output), 1)2609 self.assertLess(len(errors(run.errors)), 200)2610 self.assertTrue(greps(run.errors, "Invalid or"))2611 self.rm_testdir()2612 def test_64849(self):2613 """ check $(CVE).zip """2614 tmpdir = self.testdir()2615 filename = self.zip_CVE_2018_142616 file_url = self.url_CVE_2018_142617 download_raw(file_url, filename, tmpdir)2618 shell("ls -l {tmpdir}/{filename}".format(**locals()))2619 size = os.path.getsize(os.path.join(tmpdir, filename))2620 self.assertEqual(size, 56)2621 url_CVE_2018_15 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"2622 zip_CVE_2018_15 = "zziplib_0-13-67_unzip-mem_memory-alignment-errors_zzip_disk_findfirst.zip"2623 def test_65400(self):2624 """ info unzip -l $(CVE).zip """2625 tmpdir = self.testdir()2626 filename = self.zip_CVE_2018_152627 file_url = self.url_CVE_2018_152628 download_raw(file_url, filename, tmpdir)2629 exe = self.bins("unzip")2630 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2631 returncodes = [2])2632 self.assertIn("reported length of central directory", run.errors)2633 self.assertLess(len(run.output), 300)2634 self.assertLess(len(errors(run.errors)), 800)2635 #2636 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),2637 returncodes = [2])2638 self.assertLess(len(run.output), 300)2639 self.assertLess(len(errors(run.errors)), 800)2640 self.assertIn('reported length of central directory', run.errors)2641 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2642 self.assertFalse(os.path.exists(tmpdir+"/test"))2643 self.rm_testdir()2644 def test_65401(self):2645 """ unzzip-big -l $(CVE).zip """2646 tmpdir = self.testdir()2647 filename = self.zip_CVE_2018_152648 file_url = self.url_CVE_2018_152649 download_raw(file_url, filename, tmpdir)2650 exe = self.bins("unzzip-big")2651 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2652 returncodes = [0])2653 self.assertLess(len(run.output), 15)2654 self.assertLess(len(errors(run.errors)), 1)2655 #2656 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2657 returncodes = [0])2658 self.assertLess(len(run.output), 30)2659 self.assertLess(len(errors(run.errors)), 1)2660 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2661 self.assertFalse(os.path.exists(tmpdir+"/test"))2662 self.rm_testdir()2663 def test_65402(self):2664 """ unzzip-mem -l $(CVE).zip """2665 tmpdir = self.testdir()2666 filename = self.zip_CVE_2018_152667 file_url = self.url_CVE_2018_152668 download_raw(file_url, filename, tmpdir)2669 exe = self.bins("unzzip-mem")2670 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2671 returncodes = [0])2672 self.assertLess(len(run.output), 30)2673 self.assertLess(len(errors(run.errors)), 1)2674 #2675 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2676 returncodes = [2])2677 self.assertLess(len(run.output), 30)2678 self.assertLess(len(errors(run.errors)), 10)2679 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2680 self.assertFalse(os.path.exists(tmpdir+"/test"))2681 self.rm_testdir()2682 def test_65403(self):2683 """ unzzip-mix -l $(CVE).zip """2684 tmpdir = self.testdir()2685 filename = self.zip_CVE_2018_152686 file_url = self.url_CVE_2018_152687 download_raw(file_url, filename, tmpdir)2688 exe = self.bins("unzzip-mix")2689 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2690 returncodes = [0,2])2691 self.assertLess(len(run.output), 1)2692 self.assertTrue(greps(run.errors, "Invalid or"))2693 #2694 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2695 returncodes = [0,2])2696 self.assertLess(len(run.output), 30)2697 self.assertLess(len(errors(run.errors)), 10)2698 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2699 self.assertFalse(os.path.exists(tmpdir+"/test"))2700 self.rm_testdir()2701 def test_65404(self):2702 """ unzzip-zap -l $(CVE).zip """2703 tmpdir = self.testdir()2704 filename = self.zip_CVE_2018_152705 file_url = self.url_CVE_2018_152706 download_raw(file_url, filename, tmpdir)2707 exe = self.bins("unzzip")2708 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2709 returncodes = [0, 3])2710 self.assertLess(len(run.output), 1)2711 self.assertLess(len(errors(run.errors)), 200)2712 self.assertIn(": Success", run.errors)2713 #2714 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2715 returncodes = [0,3])2716 self.assertLess(len(run.output), 30)2717 self.assertLess(len(errors(run.errors)), 10)2718 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2719 self.assertFalse(os.path.exists(tmpdir+"/test"))2720 self.rm_testdir()2721 def test_65409(self):2722 """ check $(CVE).zip """2723 tmpdir = self.testdir()2724 filename = self.zip_CVE_2018_152725 file_url = self.url_CVE_2018_152726 download_raw(file_url, filename, tmpdir)2727 shell("ls -l {tmpdir}/{filename}".format(**locals()))2728 size = os.path.getsize(os.path.join(tmpdir, filename))2729 self.assertEqual(size, 141)2730 url_CVE_2018_16 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"2731 zip_CVE_2018_16 = "zziplib_0-13-67_unzzip_memory-aligment-errors___zzip_fetch_disk_trailer.zip"2732 def test_65410(self):2733 """ info unzip -l $(CVE).zip """2734 tmpdir = self.testdir()2735 filename = self.zip_CVE_2018_162736 file_url = self.url_CVE_2018_162737 download_raw(file_url, filename, tmpdir)2738 exe = self.bins("unzip")2739 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2740 returncodes = [0, 9])2741 self.assertIn("End-of-central-directory signature not found", run.errors)2742 self.assertLess(len(run.output), 200)2743 self.assertLess(len(errors(run.errors)), 800)2744 #2745 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),2746 returncodes = [9])2747 self.assertLess(len(run.output), 200)2748 self.assertLess(len(errors(run.errors)), 800)2749 self.assertIn('End-of-central-directory signature not found', run.errors)2750 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2751 self.assertFalse(os.path.exists(tmpdir+"/test"))2752 self.rm_testdir()2753 def test_65411(self):2754 """ unzzip-big -l $(CVE).zip """2755 tmpdir = self.testdir()2756 filename = self.zip_CVE_2018_162757 file_url = self.url_CVE_2018_162758 download_raw(file_url, filename, tmpdir)2759 exe = self.bins("unzzip-big")2760 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2761 returncodes = [0])2762 self.assertLess(len(run.output), 1)2763 self.assertLess(len(errors(run.errors)), 1)2764 #2765 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2766 returncodes = [0])2767 self.assertLess(len(run.output), 30)2768 self.assertLess(len(errors(run.errors)), 1)2769 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2770 self.assertFalse(os.path.exists(tmpdir+"/test"))2771 self.rm_testdir()2772 def test_65412(self):2773 """ unzzip-mem -l $(CVE).zip """2774 tmpdir = self.testdir()2775 filename = self.zip_CVE_2018_162776 file_url = self.url_CVE_2018_162777 download_raw(file_url, filename, tmpdir)2778 exe = self.bins("unzzip-mem")2779 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2780 returncodes = [0])2781 self.assertLess(len(run.output), 1)2782 self.assertLess(len(errors(run.errors)), 1)2783 #2784 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2785 returncodes = [2])2786 self.assertLess(len(run.output), 30)2787 self.assertLess(len(errors(run.errors)), 10)2788 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2789 self.assertFalse(os.path.exists(tmpdir+"/test"))2790 self.rm_testdir()2791 def test_65413(self):2792 """ unzzip-mix -l $(CVE).zip """2793 tmpdir = self.testdir()2794 filename = self.zip_CVE_2018_162795 file_url = self.url_CVE_2018_162796 download_raw(file_url, filename, tmpdir)2797 exe = self.bins("unzzip-mix")2798 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2799 returncodes = [0,2])2800 self.assertLess(len(run.output), 1)2801 self.assertTrue(greps(run.errors, "Invalid or"))2802 #2803 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2804 returncodes = [0,2])2805 self.assertLess(len(run.output), 30)2806 self.assertLess(len(errors(run.errors)), 10)2807 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2808 self.assertFalse(os.path.exists(tmpdir+"/test"))2809 self.rm_testdir()2810 def test_65414(self):2811 """ unzzip-zap -l $(CVE).zip """2812 tmpdir = self.testdir()2813 filename = self.zip_CVE_2018_162814 file_url = self.url_CVE_2018_162815 download_raw(file_url, filename, tmpdir)2816 exe = self.bins("unzzip")2817 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2818 returncodes = [0, 3])2819 self.assertLess(len(run.output), 1)2820 self.assertLess(len(errors(run.errors)), 200)2821 self.assertIn(": Success", run.errors)2822 #2823 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2824 returncodes = [0,3])2825 self.assertLess(len(run.output), 30)2826 self.assertLess(len(errors(run.errors)), 10)2827 self.assertTrue(greps(run.errors, "Zipfile corrupted"))2828 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2829 self.assertFalse(os.path.exists(tmpdir+"/test"))2830 #2831 run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()),2832 returncodes = [0,3])2833 self.assertTrue(greps(run.errors, "Zipfile corrupted"))2834 self.rm_testdir()2835 def test_65419(self):2836 """ check $(CVE).zip """2837 tmpdir = self.testdir()2838 filename = self.zip_CVE_2018_162839 file_url = self.url_CVE_2018_162840 download_raw(file_url, filename, tmpdir)2841 shell("ls -l {tmpdir}/{filename}".format(**locals()))2842 size = os.path.getsize(os.path.join(tmpdir, filename))2843 self.assertEqual(size, 124)2844 url_CVE_2018_17 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib"2845 zip_CVE_2018_17 = "zziplib_0-13-67_unzip-mem_memory-alignment-errors_zzip_disk_findfirst_64.zip"2846 def test_65420(self):2847 """ info unzip -l $(CVE).zip """2848 tmpdir = self.testdir()2849 filename = self.zip_CVE_2018_172850 file_url = self.url_CVE_2018_172851 download_raw(file_url, filename, tmpdir)2852 exe = self.bins("unzip")2853 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2854 returncodes = [0, 9])2855 self.assertIn("End-of-central-directory signature not found", run.errors)2856 self.assertLess(len(run.output), 200)2857 self.assertLess(len(errors(run.errors)), 800)2858 #2859 run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()),2860 returncodes = [9])2861 self.assertLess(len(run.output), 200)2862 self.assertLess(len(errors(run.errors)), 800)2863 self.assertIn('End-of-central-directory signature not found', run.errors)2864 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2865 self.assertFalse(os.path.exists(tmpdir+"/test"))2866 self.rm_testdir()2867 def test_65421(self):2868 """ unzzip-big -l $(CVE).zip """2869 tmpdir = self.testdir()2870 filename = self.zip_CVE_2018_172871 file_url = self.url_CVE_2018_172872 download_raw(file_url, filename, tmpdir)2873 exe = self.bins("unzzip-big")2874 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2875 returncodes = [0])2876 self.assertLess(len(run.output), 1)2877 #2878 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2879 returncodes = [0])2880 self.assertLess(len(run.output), 30)2881 self.assertLess(len(errors(run.errors)), 1)2882 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2883 self.assertFalse(os.path.exists(tmpdir+"/test"))2884 self.rm_testdir()2885 def test_65422(self):2886 """ unzzip-mem -l $(CVE).zip """2887 tmpdir = self.testdir()2888 filename = self.zip_CVE_2018_172889 file_url = self.url_CVE_2018_172890 download_raw(file_url, filename, tmpdir)2891 exe = self.bins("unzzip-mem")2892 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2893 returncodes = [0])2894 self.assertLess(len(run.output), 50)2895 self.assertLess(len(errors(run.errors)), 1)2896 #2897 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2898 returncodes = [2])2899 self.assertLess(len(run.output), 30)2900 self.assertLess(len(errors(run.errors)), 10)2901 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2902 self.assertFalse(os.path.exists(tmpdir+"/test"))2903 #2904 run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()),2905 returncodes = [2])2906 # self.rm_testdir()2907 def test_65423(self):2908 """ unzzip-mix -l $(CVE).zip """2909 tmpdir = self.testdir()2910 filename = self.zip_CVE_2018_172911 file_url = self.url_CVE_2018_172912 download_raw(file_url, filename, tmpdir)2913 exe = self.bins("unzzip-mix")2914 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2915 returncodes = [0,2])2916 self.assertLess(len(run.output), 1)2917 self.assertTrue(greps(run.errors, "Invalid or"))2918 #2919 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2920 returncodes = [0,2])2921 self.assertLess(len(run.output), 30)2922 self.assertTrue(greps(run.errors, "Invalid or"))2923 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2924 self.assertFalse(os.path.exists(tmpdir+"/test"))2925 self.rm_testdir()2926 def test_65424(self):2927 """ unzzip-zap -l $(CVE).zip """2928 tmpdir = self.testdir()2929 filename = self.zip_CVE_2018_172930 file_url = self.url_CVE_2018_172931 download_raw(file_url, filename, tmpdir)2932 exe = self.bins("unzzip")2933 run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()),2934 returncodes = [0, 3])2935 self.assertLess(len(run.output), 1)2936 self.assertLess(len(errors(run.errors)), 200)2937 self.assertIn(": Success", run.errors)2938 #2939 run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()),2940 returncodes = [0,3])2941 self.assertLess(len(run.output), 30)2942 self.assertTrue(greps(run.errors, "Zipfile corrupted"))2943 # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3)2944 self.assertFalse(os.path.exists(tmpdir+"/test"))2945 self.rm_testdir()2946 def test_65429(self):2947 """ check $(CVE).zip """2948 tmpdir = self.testdir()2949 filename = self.zip_CVE_2018_172950 file_url = self.url_CVE_2018_172951 download_raw(file_url, filename, tmpdir)2952 shell("ls -l {tmpdir}/{filename}".format(**locals()))2953 size = os.path.getsize(os.path.join(tmpdir, filename))2954 self.assertEqual(size, 360)2955 def test_91000_zzshowme_check_sfx(self):...

Full Screen

Full Screen

test_whfast_testparticles.py

Source:test_whfast_testparticles.py Github

copy

Full Screen

...22 sim2.integrate(1)23 # some combinations can't do a simple keplerian orbit exactly (sad but true)24 eps = 1e-1425 for i in range(sim.N):26 self.assertLess(abs(sim.particles[i].x-sim2.particles[i].x),eps)27 self.assertLess(abs(sim.particles[i].vx-sim2.particles[i].vx),eps)28 self.assertLess(abs(sim.particles[i].y-sim2.particles[i].y),eps)29 self.assertLess(abs(sim.particles[i].vy-sim2.particles[i].vy),eps)30 31 # all should be able to do this exactly32 sim.integrate(1)33 eps = 1e-1634 for i in range(sim.N):35 self.assertLess(abs(sim.particles[i].x-sim2.particles[i].x),eps)36 self.assertLess(abs(sim.particles[i].vx-sim2.particles[i].vx),eps)37 self.assertLess(abs(sim.particles[i].y-sim2.particles[i].y),eps)38 self.assertLess(abs(sim.particles[i].vy-sim2.particles[i].vy),eps)39 return do_test40def create_whfast_testparticle_withplanet(coordinates, N, N_active):41 def do_test(self):42 eps = 1e-1343 sim = rebound.Simulation()44 sim.integrator = "whfast"45 sim.ri_whfast.coordinates = coordinates46 sim.dt=1e-347 sim.add(m=1)48 sim.add(m=1e-3,P=0.4)49 sim.add(m=1e-3,P=0.7)50 for i in range(N):51 sim.add(m=0,P=1,e=0.1,f=i)52 53 sim2 = sim.copy()54 if N_active>0:55 sim2.N_active = N_active56 57 sim2.integrate(1)58 sim.integrate(1)59 for i in range(sim.N):60 self.assertLess(abs(sim.particles[i].x-sim2.particles[i].x),eps)61 self.assertLess(abs(sim.particles[i].vx-sim2.particles[i].vx),eps)62 self.assertLess(abs(sim.particles[i].y-sim2.particles[i].y),eps)63 self.assertLess(abs(sim.particles[i].vy-sim2.particles[i].vy),eps)64 return do_test65def create_whfast_testparticletype1(coordinates, N_active):66 def do_test(self):67 eps = 1e-1668 sim = rebound.Simulation()69 sim.ri_whfast.coordinates = coordinates70 sim.testparticle_type = 171 sim.integrator = "whfast"72 sim.dt=1e-373 sim.add(m=1)74 sim.add(m=1e-3,P=1,e=0.1)75 76 sim2 = sim.copy()77 if N_active>0:78 sim2.N_active = N_active79 sim2.integrate(1)80 sim.integrate(1)81 for i in range(sim.N):82 self.assertLess(abs(sim.particles[i].x-sim2.particles[i].x),eps)83 self.assertLess(abs(sim.particles[i].vx-sim2.particles[i].vx),eps)84 self.assertLess(abs(sim.particles[i].y-sim2.particles[i].y),eps)85 self.assertLess(abs(sim.particles[i].vy-sim2.particles[i].vy),eps)86 return do_test87def create_whfast_testparticletype1_withplanet(coordinates, N_active):88 def do_test(self):89 eps = 1e-1690 sim = rebound.Simulation()91 sim.integrator = "whfast"92 sim.ri_whfast.coordinates = coordinates93 sim.testparticle_type = 194 sim.dt=1e-395 sim.add(m=1)96 sim.add(m=1e-3,P=0.4)97 sim.add(m=1e-3,P=0.7,e=0.1)98 sim.add(m=1e-3,P=1.0)99 100 sim2 = sim.copy()101 if N_active>0:102 sim2.N_active = N_active103 104 sim2.integrate(1)105 sim.integrate(1)106 for i in range(sim.N):107 self.assertLess(abs(sim.particles[i].x-sim2.particles[i].x),eps)108 self.assertLess(abs(sim.particles[i].vx-sim2.particles[i].vx),eps)109 self.assertLess(abs(sim.particles[i].y-sim2.particles[i].y),eps)110 self.assertLess(abs(sim.particles[i].vy-sim2.particles[i].vy),eps)111 return do_test112## Testparticles with mass currently lead to unexpexted behaviour:113def create_whfast_massivetestparticle(coordinates, N):114 def do_test(self):115 eps = 2e-13116 sim = rebound.Simulation()117 sim.ri_whfast.coordinates = coordinates118 sim.integrator = "whfast"119 sim.dt=1e-3120 sim.add(m=1)121 sim.add(m=1e-3,P=0.4)122 for i in range(N):123 sim.add(m=0,P=1,e=0.1,f=i)124 125 sim2 = sim.copy()126 for i in range(N):127 sim2.particles[i+2].m = 1 # particles have zero mass for sim, but finite for sim2128 sim2.N_active = 2129 sim.integrate(1)130 with warnings.catch_warnings(record=True) as w:131 warnings.simplefilter("always")132 sim2.integrate(1)133 self.assertEqual(1,len(w))134 for i in range(sim.N):135 self.assertLess(abs(sim.particles[i].x-sim2.particles[i].x),eps)136 self.assertLess(abs(sim.particles[i].vx-sim2.particles[i].vx),eps)137 self.assertLess(abs(sim.particles[i].y-sim2.particles[i].y),eps)138 self.assertLess(abs(sim.particles[i].vy-sim2.particles[i].vy),eps)139 return do_test140for N in [1,2]: 141 for coordinates in coordinatelist:142 for N_active in [-1]+list(range(1,N+2)):143 test_method = create_whfast_testparticle(coordinates,N, N_active)144 test_method.__name__ = "test_whfast_testparticle_N%d_Nactive%d_"%(N,N_active)+coordinates145 setattr(TestIntegratorWHFastTestParticle, test_method.__name__, test_method)146 147 for N_active in [-1]+list(range(3,N+4)):148 test_method = create_whfast_testparticle_withplanet(coordinates,N, N_active)149 test_method.__name__ = "test_whfast_testparticle_withplanet_N%d_Nactive%d_"%(N,N_active)+coordinates150 setattr(TestIntegratorWHFastTestParticle, test_method.__name__, test_method)151 test_method = create_whfast_massivetestparticle(coordinates,N)152 test_method.__name__ = "test_whfast_massivetestparticle_N%d_"%(N)+coordinates...

Full Screen

Full Screen

tests.py

Source:tests.py Github

copy

Full Screen

...38 ordered_sigs = [sig for sig,value in ordered]39 self.assertIn('s1', ordered_sigs)40 self.assertIn('s2', ordered_sigs)41 self.assertIn('s3', ordered_sigs)42 self.assertLess(ordered_sigs.index('s3'), ordered_sigs.index('s1'))43 self.assertLess(ordered_sigs.index('s3'), ordered_sigs.index('s2'))44 def test_chained_dependencies(self):45 raw = [46 ('s1', ('s1_db', ['alpha'])),47 ('s2', ('s2_db', ['bravo'])),48 ('s3', ('s3_db', ['charlie'])),49 ]50 dependencies = {51 'alpha': ['bravo'],52 'bravo': ['charlie'],53 }54 ordered = simple.dependency_ordered(raw, dependencies=dependencies)55 ordered_sigs = [sig for sig,value in ordered]56 self.assertIn('s1', ordered_sigs)57 self.assertIn('s2', ordered_sigs)58 self.assertIn('s3', ordered_sigs)59 # Explicit dependencies60 self.assertLess(ordered_sigs.index('s2'), ordered_sigs.index('s1'))61 self.assertLess(ordered_sigs.index('s3'), ordered_sigs.index('s2'))62 # Implied dependencies63 self.assertLess(ordered_sigs.index('s3'), ordered_sigs.index('s1'))64 def test_multiple_dependencies(self):65 raw = [66 ('s1', ('s1_db', ['alpha'])),67 ('s2', ('s2_db', ['bravo'])),68 ('s3', ('s3_db', ['charlie'])),69 ('s4', ('s4_db', ['delta'])),70 ]71 dependencies = {72 'alpha': ['bravo','delta'],73 'bravo': ['charlie'],74 'delta': ['charlie'],75 }76 ordered = simple.dependency_ordered(raw, dependencies=dependencies)77 ordered_sigs = [sig for sig,aliases in ordered]78 self.assertIn('s1', ordered_sigs)79 self.assertIn('s2', ordered_sigs)80 self.assertIn('s3', ordered_sigs)81 self.assertIn('s4', ordered_sigs)82 # Explicit dependencies83 self.assertLess(ordered_sigs.index('s2'), ordered_sigs.index('s1'))84 self.assertLess(ordered_sigs.index('s4'), ordered_sigs.index('s1'))85 self.assertLess(ordered_sigs.index('s3'), ordered_sigs.index('s2'))86 self.assertLess(ordered_sigs.index('s3'), ordered_sigs.index('s4'))87 # Implicit dependencies88 self.assertLess(ordered_sigs.index('s3'), ordered_sigs.index('s1'))89 def test_circular_dependencies(self):90 raw = [91 ('s1', ('s1_db', ['alpha'])),92 ('s2', ('s2_db', ['bravo'])),93 ]94 dependencies = {95 'bravo': ['alpha'],96 'alpha': ['bravo'],97 }...

Full Screen

Full Screen

test_h2py_runtime.py

Source:test_h2py_runtime.py Github

copy

Full Screen

...31 def test_false(self):32 self.assertEqual(P(False), False)33class TestH2PyRuntimeHcompare(unittest.TestCase):34 def test_typeorder(self):35 self.assertLess(hcompare(H(False), H(42)), 0)36 self.assertLess(hcompare(H(False), H("abc")), 0)37 self.assertLess(hcompare(H(False), H({})), 0)38 self.assertLess(hcompare(H(False), HAddr(("x",))), 0)39 self.assertLess(hcompare(H(42), H("abc")), 0)40 self.assertLess(hcompare(H(42), H({})), 0)41 self.assertLess(hcompare(H(42), HAddr(("x",))), 0)42 self.assertLess(hcompare(H("abc"), H({})), 0)43 self.assertLess(hcompare(H("abc"), HAddr(("x",))), 0)44 self.assertLess(hcompare(H({}), HAddr(("x",))), 0)45 def test_int(self):46 self.assertLess(hcompare(H(42), H(43)), 0)47 self.assertEqual(hcompare(H(42), H(42)), 0)48 self.assertGreater(hcompare(H(43), H(42)), 0)49 def test_bool(self):50 self.assertEqual(hcompare(H(False), H(False)), 0)51 self.assertLess(hcompare(H(False), H(True)), 0)52 self.assertGreater(hcompare(H(True), H(False)), 0)53 self.assertEqual(hcompare(H(True), H(True)), 0)54 def test_atom(self):55 self.assertLess(hcompare(H("abc"), H("abcd")), 0)56 self.assertLess(hcompare(H("abc"), H("abd")), 0)57 self.assertEqual(hcompare(H("abc"), H("abc")), 0)58 self.assertGreater(hcompare(H("abcd"), H("abc")), 0)59 self.assertGreater(hcompare(H("abd"), H("abc")), 0)60 def test_dict(self):61 self.assertLess(hcompare(H({}), H({0: 1})), 0)62 self.assertEqual(hcompare(H({0: 1}), H({0: 1})), 0)63 self.assertGreater(hcompare(H({0: 1, 2: 3}), H({0: 1})), 0)64 def test_addr(self):65 self.assertLess(hcompare(H(None), HAddr(("x",))), 0)66 self.assertEqual(hcompare(HAddr(("x",)), HAddr(("x",))), 0)67 self.assertGreater(hcompare(HAddr(("x", "y")), HAddr(("x",))), 0)68if __name__ == '__main__':...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pytest-benchmark automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful