diff --git a/.travis.yml b/.travis.yml index a8e0e4d..813e710 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ python: - nightly sudo: required -# do we need sudo? should double check +# https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments dist: trusty @@ -45,7 +45,7 @@ install: - pushd theZoo/malwares/Binaries - python unpackall.py - popd - - mv theZoo/malwares/Binaries/out tests/dangerous/ + - mv theZoo/malwares/Binaries/out tests/uncategorized/ # Path traversal attacks - git clone https://github.com/jwilk/path-traversal-samples - pushd path-traversal-samples @@ -56,21 +56,23 @@ install: - make - popd - popd - - mv path-traversal-samples/zip/*.zip tests/dangerous/ - - mv path-traversal-samples/rar/*.rar tests/dangerous/ + - mv path-traversal-samples/zip/*.zip tests/uncategorized/ + - mv path-traversal-samples/rar/*.rar tests/uncategorized/ # Office docs - git clone https://github.com/eea/odfpy.git - - mv odfpy/tests/examples/* tests/dangerous/ - - pushd tests/dangerous/ + - mv odfpy/tests/examples/* tests/uncategorized/ + - pushd tests/uncategorized/ - wget https://bitbucket.org/decalage/olefileio_pl/raw/3073963b640935134ed0da34906fea8e506460be/Tests/images/test-ole-file.doc - wget --no-check-certificate https://www.officedissector.com/corpus/fraunhoferlibrary.zip - unzip -o fraunhoferlibrary.zip - rm fraunhoferlibrary.zip + - popd + - pushd tests/dangerous/ - 7z x -p42 42.zip - popd script: - - travis_wait 30 py.test --cov=kittengroomer --cov=bin tests/ + - travis_wait py.test --cov=kittengroomer --cov=bin tests/ notifications: email: diff --git a/tests/file_catalog.yaml b/tests/file_catalog.yaml index ecabe14..b8a651a 100644 --- a/tests/file_catalog.yaml +++ b/tests/file_catalog.yaml @@ -12,6 +12,7 @@ normal: Example.ogg: # Added: 27-06-2017, source: https://en.wikipedia.org/wiki/File:Example.ogg description: Ogg vorbis sound file mimetype: audio/ogg + xfail: True Example.png: # Added: 27-06-2017, source: https://en.wikipedia.org/wiki/File:Example.png mimetype: image/png Example.svg: # Added: 27-06-2017, source: https://en.wikipedia.org/wiki/File:Example.svg diff --git a/tests/test_filecheck.py b/tests/test_filecheck.py index 26b8318..1282a0e 100644 --- a/tests/test_filecheck.py +++ b/tests/test_filecheck.py @@ -22,6 +22,7 @@ parametrize = pytest.mark.parametrize NORMAL_FILES_PATH = 'tests/normal/' DANGEROUS_FILES_PATH = 'tests/dangerous/' +UNCATEGORIZED_FILES_PATH = 'tests/uncategorized' CATALOG_PATH = 'tests/file_catalog.yaml' @@ -121,3 +122,10 @@ def test_sample_files(mock_logger, sample_file, groomer, dest_dir_path): file = File(sample_file.path, file_dest_path, mock_logger) groomer.process_file(file) assert file.is_dangerous == sample_file.exp_dangerous + + +def test_uncategorized(tmpdir): + src_path = os.path.abspath(UNCATEGORIZED_FILES_PATH) + dst_path = tmpdir.strpath + groomer = KittenGroomerFileCheck(src_path, dst_path, debug=True) + groomer.run()