Skip to content

Commit

Permalink
Merge pull request #1 from CERT-Polska/update/meta
Browse files Browse the repository at this point in the history
Update meta
  • Loading branch information
nazywam authored Dec 22, 2020
2 parents db54c5e + 5144738 commit fcc0665
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 30 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test the code
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.6
- run: pip install isort==5.6.4 black==20.8b1 flake8==3.8.4 mypy==0.790
- run: pip install -r requirements.txt
- run: isort --check karton/
- run: black --check karton/
- run: flake8 karton/
- run: mypy --namespace-packages karton/
42 changes: 25 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
MIT License
BSD 3-Clause License

Copyright (c) 2020 CERT Polska
Copyright (c) 2020, CERT Polska
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Uploads samples and static configs to malwaredb

Author: CERT.pl

Maintainers: psrok1, nazywam

**Consumes:**
Expand Down
17 changes: 6 additions & 11 deletions karton/mwdb_reporter/mwdb_reporter.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import hashlib
from typing import Any, Dict, Optional

from karton.core import Config, Karton, RemoteResource # type: ignore

from mwdblib import ( # type: ignore
MWDB,
MWDBBlob,
MWDBConfig,
MWDBFile,
MWDBObject,
)
from karton.core import Karton, RemoteResource # type: ignore
from mwdblib import MWDB, MWDBBlob, MWDBConfig, MWDBFile, MWDBObject # type: ignore
from mwdblib.api import API_URL # type: ignore
from mwdblib.exc import ObjectNotFoundError # type: ignore

Expand Down Expand Up @@ -92,7 +84,10 @@ def _tag_children_blobs(self, config: MWDBConfig) -> None:
item.add_tag(tag)

def _upload_file(
self, mwdb: MWDB, resource: RemoteResource, parent: Optional[MWDBObject] = None,
self,
mwdb: MWDB,
resource: RemoteResource,
parent: Optional[MWDBObject] = None,
) -> MWDBFile:
"""
Upload file to MWDB or get from repository if already exists
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 88
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
mwdblib==3.3.1
karton-core==4.0.0-dev3

karton-core==4.0.4
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203, W503

0 comments on commit fcc0665

Please sign in to comment.