Skip to main content

Weggli ruleset scanner for source code and binaries

Project description

parascope

crates.io license crates.io downloads

Weggli ruleset scanner for binaries and source code. Organise your weggli rules and scan source code and binaries in parallel!

parascope demo

Build/installation

To build and install parascope requires IDA Pro v9.2 and access to the latest SDK.

Install via crates.io:

export IDADIR=/path/to/ida # optional
cargo install parascope

Build/install from source:

export IDADIR=/path/to/ida # optional
cargo install --path .

Examples and usage

Scan a single binary and output the rule matches to stdout:

parascope --display -r rules /path/of/binary

Scan all binaries in the given directory and stream rule matches to results.jsonl:

parascope -o results.jsonl -r rules /directory/of/binaries

Scan the C source code in the given directory and stream rule matches to results.jsonl:

parascope -m c -o results.jsonl -r rules /directory/of/source-code

Complete set of capabilities:

Weggli ruleset scanner for source code and binaries

Usage: parascope [OPTIONS] --rules <rules> <INPUT>

Arguments:
  <INPUT>
          File or directory to scan

Options:
  -m, --mode <mode>
          Analysis mode

          [default: binary]

          Possible values:
          - binary: Binary analysis mode (using IDA)
          - c:      Source code analysis mode (C)
          - cxx:    Source code analysis mode (C++)

      --path-filter [<path-filter>...]
          Restrict analysis to files matching the given regular expression.
          For C/C++ analysis if no path filters are given analysis is restricted
          to a set of default file extensions:

          C: c, h
          C++: C, cc, cxx, cpp, H, hh, hxx, hpp, h

          For binary analysis, all files will be analysed. If an existing IDB is
          available, e.g., we have both file and file.i64, only the IDB will be
          used for analysis irrespective of the path filter.

      --display
          Render matches to stdout

      --display-context <display-context>
          Number of lines before/after match to render

          [default: 5]

      --summary
          Render tabular summary to stdout

  -r, --rules <rules>
          File or directory containing wegglir rules

  -o, --output <OUTPUT>
          File to write output results (JSONL)

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Rules

We use weggli-ruleset to help manage weggli patterns. It provides a yaml-based rule format that allows different (related) patterns to be grouped along with metadata useful for categorising and triaging matches. For example, we can encode the patterns from here, as follows:

id: call-to-unbounded-copy-functions
description: call to unbounded copy functions
severity: medium
tags:
- CWE-120
- CWE-242
- CWE-676
check-patterns:
- name: gets
  regex: func=^gets$
  pattern: |
    { $func(); }
- name: st(r|p)(cpy|cat)
  regex: func=st(r|p)(cpy|cat)$
  pattern: |
    { $func(); }
- name: wc(r|p)(cpy|cat)
  regex: func=wc(r|p)(cpy|cat)$
  pattern: |
    { $func(); }
- name: sprintf
  regex: func=sprintf$
  pattern: |
    { $func(); }
- name: scanf
  regex: func=scanf$
  pattern: |
    { $func(); }

Rulesets & Resources

Below is a list of resources containing weggli patterns/rules that can easily be ported to parascope rules:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parascope-0.3.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

parascope-0.3.0-py3-none-manylinux_2_28_x86_64.whl (2.5 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

parascope-0.3.0-py3-none-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file parascope-0.3.0.tar.gz.

File metadata

  • Download URL: parascope-0.3.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for parascope-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a6cfd97246c2656f846772bf342dc56183449d6f522d657877d8a246951166de
MD5 3a86e470f6a38b77d2402e162250a411
BLAKE2b-256 bd9fc555d6d1e82ecaf0b9b90d6e494921a0d8976ff9d17533e463d216918650

See more details on using hashes here.

File details

Details for the file parascope-0.3.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for parascope-0.3.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b2aaa9eaaea4c237035a3829852a3206a4a8f28d970ceb4e8791989f7282433b
MD5 a02ba4e8e8079ca95ec4f8f0a33fd5bb
BLAKE2b-256 8c60ec2cc1e64805e2a10f81e2bd8ae9044442880cbe97fd21a6bf491fe4cb73

See more details on using hashes here.

File details

Details for the file parascope-0.3.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for parascope-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12dc4020b2cc4fbab7e979498d0f9f1b47af35902cf30013574fb47dd8e90262
MD5 aad6e6d668c54c922561b816a862bc53
BLAKE2b-256 470bc9ebbb9d083cc2287e80759e218f5745436dae679f5b531cc657360a12f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page