Skip to content

Commit

Permalink
Mypy CI setup and last fixes before release (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
psrok1 authored Jul 10, 2020
1 parent 3983cda commit caedc99
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8==3.8.3 pytest==5.4.1 black==19.10b0
pip install flake8==3.8.3 pytest==5.4.1 black==19.10b0 mypy==0.782 mypy-extensions==0.4.3
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 malduck --count --max-line-length=88 --show-source --statistics
- name: Check black format
run: |
black malduck --target-version py36 --check --diff
- name: Check types
run: |
mypy malduck
- name: Install
run: |
python setup.py install
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Improvements
* Searching for wildcarded byte sequences
* Support for x64 disassembly
* Fixed-precision integer types
* Supported both Python 2.x and 3.x
* Many improvements in ProcessMemory

Usage
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'CERT Polska'

# The full version, including alpha/beta/rc tags
release = '3.2.0'
release = '4.0.0'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion malduck/procmem/procmempe.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _reload_as_image(self) -> None:
# Reset regions
if self.mapped_memory:
self.close()
self.memory = pe.data
self.memory = bytearray(pe.data)
self.imgbase = pe.optional_header.ImageBase

self.regions = [Region(self.imgbase, pe.headers_size, 0, 0, 0, 0)]
Expand Down
8 changes: 6 additions & 2 deletions malduck/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import ctypes

from typing import List, Tuple, Type

from .ints import (
IntTypeBase,
MultipliedIntTypeBase,
Expand Down Expand Up @@ -33,7 +35,7 @@

class Structure(object):
_pack_ = 0
_fields_ = []
_fields_: List[Tuple[str, Type]] = []

def __init__(self):
self.subfields, fields = {}, []
Expand Down Expand Up @@ -93,4 +95,6 @@ def from_buffer_copy(cls, buf):
obj._values_ = obj.Klass.from_buffer_copy(buf)
return obj

parse = from_buffer_copy
@classmethod
def parse(cls, buf):
return cls.from_buffer_copy(buf)
21 changes: 21 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,24 @@
ignore = E501,W503,E203
max-line-length = 88
exclude = tests/*

[mypy]
python_version = 3.6

[mypy-capstone.*]
ignore_missing_imports = True

[mypy-pefile.*]
ignore_missing_imports = True

[mypy-elftools.*]
ignore_missing_imports = True

[mypy-idautils.*]
ignore_missing_imports = True

[mypy-idc.*]
ignore_missing_imports = True

[mypy-ida_bytes.*]
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="malduck",
version="3.2.0",
version="4.0.0",
description="Malduck is your ducky companion in malware analysis journeys",
author="CERT Polska",
author_email="[email protected]",
Expand Down

0 comments on commit caedc99

Please sign in to comment.