Skip to content

Commit fe39d94

Browse files
committed
fixes
1 parent 4d6053c commit fe39d94

24 files changed

+396
-461
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ on: [push, pull_request]
44

55
jobs:
66
test:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v3
10-
- uses: actions-rs/toolchain@v1
11-
with:
12-
toolchain: stable
13-
- run: cargo build --release
14-
- run: cargo test
15-
16-
build-cross:
177
runs-on: ${{ matrix.os }}
188
strategy:
199
matrix:
@@ -24,3 +14,4 @@ jobs:
2414
with:
2515
toolchain: stable
2616
- run: cargo build --release
17+
- run: cargo test

.github/workflows/release.yml

Lines changed: 63 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
7+
8+
permissions:
9+
contents: write
710

811
jobs:
912
build:
@@ -14,68 +17,89 @@ jobs:
1417
include:
1518
- os: ubuntu-latest
1619
target: x86_64-unknown-linux-gnu
17-
artifact_name: polymorph
18-
asset_name: polymorph-linux-x64
20+
artifact: polymorph
21+
asset: polymorph-linux-x64.tar.gz
22+
1923
- os: ubuntu-latest
2024
target: aarch64-unknown-linux-gnu
21-
artifact_name: polymorph
22-
asset_name: polymorph-linux-arm64
25+
artifact: polymorph
26+
asset: polymorph-linux-arm64.tar.gz
27+
use_cross: true
28+
2329
- os: macos-latest
2430
target: x86_64-apple-darwin
25-
artifact_name: polymorph
26-
asset_name: polymorph-macos-x64
31+
artifact: polymorph
32+
asset: polymorph-macos-x64.tar.gz
33+
2734
- os: macos-latest
2835
target: aarch64-apple-darwin
29-
artifact_name: polymorph
30-
asset_name: polymorph-macos-arm64
36+
artifact: polymorph
37+
asset: polymorph-macos-arm64.tar.gz
38+
3139
- os: windows-latest
3240
target: x86_64-pc-windows-msvc
33-
artifact_name: polymorph.exe
34-
asset_name: polymorph-windows-x64.exe
41+
artifact: polymorph.exe
42+
asset: polymorph-windows-x64.zip
3543

3644
steps:
37-
- uses: actions/checkout@v3
38-
39-
- uses: actions-rs/toolchain@v1
45+
- uses: actions/checkout@v4
46+
47+
- uses: dtolnay/rust-toolchain@stable
4048
with:
41-
toolchain: stable
42-
target: ${{ matrix.target }}
43-
override: true
44-
45-
- name: Install cross-compilation tools
46-
if: matrix.target == 'aarch64-unknown-linux-gnu'
47-
run: |
48-
sudo apt-get update
49-
sudo apt-get install -y gcc-aarch64-linux-gnu
50-
51-
- name: Build
49+
targets: ${{ matrix.target }}
50+
51+
- name: Install cross
52+
if: matrix.use_cross == true
53+
run: cargo install cross --git https://github.com/cross-rs/cross
54+
55+
- name: Build (cross)
56+
if: matrix.use_cross == true
57+
run: cross build --release --target ${{ matrix.target }}
58+
59+
- name: Build (native)
60+
if: matrix.use_cross != true
5261
run: cargo build --release --target ${{ matrix.target }}
53-
54-
- name: Strip binary (Linux/macOS)
62+
63+
# Strip ONLY Linux (safe)
64+
- name: Strip Linux binary
65+
if: startsWith(matrix.target, 'x86_64-unknown-linux') || startsWith(matrix.target, 'aarch64-unknown-linux')
66+
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact }}
67+
68+
# Package artifacts
69+
- name: Package (Unix)
5570
if: matrix.os != 'windows-latest'
56-
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
57-
58-
- name: Upload binary
71+
run: |
72+
cd target/${{ matrix.target }}/release
73+
tar czf ../../../${{ matrix.asset }} ${{ matrix.artifact }}
74+
75+
- name: Package (Windows)
76+
if: matrix.os == 'windows-latest'
77+
run: |
78+
mkdir dist
79+
copy target\${{ matrix.target }}\release\${{ matrix.artifact }} dist\
80+
powershell Compress-Archive dist\* ${{ matrix.asset }}
81+
82+
- name: Upload artifact
5983
uses: actions/upload-artifact@v4
6084
with:
61-
name: ${{ matrix.asset_name }}
62-
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
85+
name: ${{ matrix.asset }}
86+
path: ${{ matrix.asset }}
6387

6488
release:
6589
needs: build
6690
runs-on: ubuntu-latest
6791
steps:
68-
- uses: actions/checkout@v3
69-
70-
- name: Download all artifacts
92+
- uses: actions/checkout@v4
93+
94+
- name: Download artifacts
7195
uses: actions/download-artifact@v4
7296
with:
73-
path: artifacts
74-
75-
- name: Create Release
97+
path: dist
98+
99+
- name: Create GitHub Release
76100
uses: softprops/action-gh-release@v1
77101
with:
78-
files: artifacts/**/*
102+
files: dist/**/*
79103
generate_release_notes: true
80104
env:
81105
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Cargo.lock
33
*.swp
44
.DS_Store
55
test_samples/
6+
tag-sync.sh

CHANGELOG.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
# Changelog
22

33
## [1.1.0] - 2026-01-18
4-
5-
### Added
6-
- APE polyglot detection
7-
- Zig malware detection
8-
- WASM cryptominer detection
4+
- APE, Zig, WASM detection
95
- 19 YARA rules
10-
- Cross-platform support
11-
12-
### Features
13-
- Fast scanning (~50ms per 10MB)
14-
- JSON output
15-
- Risk scoring
16-
- Verbose mode
6+
- Fast scanning

CONTRIBUTING.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
# Contributing
22

3-
We welcome contributions!
4-
5-
## Getting Started
6-
73
1. Fork the repo
8-
2. Create a feature branch
9-
3. Make your changes
10-
4. Add tests
11-
5. Submit a pull request
12-
13-
## Code Style
14-
15-
- Run `cargo fmt`
16-
- Run `cargo clippy`
17-
- Add documentation
4+
2. Create feature branch
5+
3. Add tests
6+
4. Submit PR

Cargo.toml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "polymorph"
33
version = "1.1.0"
44
authors = ["xonoxitron <https://github.com/xonoxitron>"]
55
edition = "2021"
6-
rust-version = "1.70"
6+
rust-version = "1.74"
77
description = "Open-source detector for APE, Zig, and WASM polyglot malware"
88
documentation = "https://github.com/xonoxitron/polymorph"
99
readme = "README.md"
@@ -14,19 +14,41 @@ keywords = ["security", "malware", "polyglot", "detection", "wasm"]
1414
categories = ["command-line-utilities", "development-tools"]
1515

1616
[dependencies]
17-
serde = { version = "1.0", features = ["derive"] }
18-
serde_json = "1.0"
17+
serde = { version = "1.0", features = ["derive"], optional = true }
18+
serde_json = { version = "1.0", optional = true }
19+
20+
[features]
21+
default = []
22+
json = ["serde", "serde_json"]
1923

2024
[dev-dependencies]
2125
tempfile = "3.8"
26+
criterion = "0.5"
2227

2328
[profile.release]
2429
opt-level = 3
2530
lto = true
2631
codegen-units = 1
27-
strip = true
2832
panic = "abort"
2933

34+
[profile.bench]
35+
inherits = "release"
36+
debug = true
37+
3038
[[bin]]
3139
name = "polymorph"
3240
path = "src/main.rs"
41+
42+
[[bench]]
43+
name = "benchmark"
44+
harness = false
45+
46+
[[example]]
47+
name = "basic_scan"
48+
path = "examples/basic_scan.rs"
49+
required-features = []
50+
51+
[[example]]
52+
name = "batch_scan"
53+
path = "examples/batch_scan.rs"
54+
required-features = []

0 commit comments

Comments
 (0)