Skip to main content

Maltorch: Pentesting Suite for AI-based Windows Malware Detectors

PyPI GitHub code size in bytes GitHub issues PyPI - Python Version PyPI - Downloads

Testing the security of AI-based Windows malware detectors has never been easier! You can deploy maltorch, boot up models already trained with PyTorch, and deploy an arsenal of testing techniques before placing an AV in production.

Installation

You can install maltorch through pip, but you also need a custom version of EMBER due to numpy portability issues.

pip install maltorch
pip install git+https://github.com/zangobot/ember.git

Included manipulations

Maltorch contains most of the practical manipulations of this field:

  • DOS header extension and editing (PartialDOS, FullDOS, Extend)
  • Content shifting
  • Section injection with optimized or goodware content (GAMMA)
  • Padding

Most of the manipulations can be used either with gradient-based and gradient-free optimization.

Loading AI-based Models

The library already provides tons of pre-trained models, you can instantiate one by just:

from maltorch.zoo.malconv import MalConv
model = MalConv.create_model()

and it also accepts device parameter to load the model in GPU.

Evasion Attacks

Straight-forward way to compute attacks! You just neet to load the model, instantiate the attack, and then pass the model to the freshly-created technique:

from torch.utils.data import TensorDataset, DataLoader
from maltorch.adv.evasion.partialdos import PartialDOS
from maltorch.data.loader import load_from_folder, create_labels
from maltorch.zoo.malconv import MalConv

model = MalConv.create_model()

# Load data as a Pytorch DataLoader
folder_with_exe = ...
X = load_from_folder(folder_with_exe, "exe",device=device)
y = create_labels(X, 1, device=device)
dl = DataLoader(TensorDataset(X, y), batch_size=3)

# Store adversarial EXEmples into a new DataLoader
attack = PartialDOS(query_budget=3)
adversarial_loader = attack(model, torch_data_loader)

Metadata

Release files for maltorch 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maltorch 0.3.6
File Size Uploaded
maltorch-0.3.6.tar.gz 59.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maltorch 0.3.6
File Interpreter ABI Platform
maltorch-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 158.8 kB

Release files / maltorch-0.3.6.tar.gz

Download URL maltorch-0.3.6.tar.gz
Size 59.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6c5f2069d09c3016c15ba6aedc227f081e294cb3b9cc2c47d37b83436888046b
BLAKE2b-256 checksum
How to use checksums
d77acb42f6874fabecc4c44bc32f604269baafd574ff1dba8356c3e28c451902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / maltorch-0.3.6-py3-none-any.whl

Download URL maltorch-0.3.6-py3-none-any.whl
Size 99.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a03221a2b3dc72217b113a866c5a2df03156183d450d811912b542a4e7fec3c
BLAKE2b-256 checksum
How to use checksums
296c399e1622db07976ea965699c55d046195aa04daf140caff6a87d066367b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.3.6 This release

2 release files

0.3.5

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3

2 release files

0.2.7

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page