Giter Club home page Giter Club logo

asnfuzzgen's Introduction

asnfuzzgen - ASN.1 Structure-Aware Fuzzing Compiler

asnfuzzgen is an ASN.1 compiler capable of producing structure-aware fuzzing modules for arbitrary ASN.1 specifications. It currently supports Packed Encoding Rules (PER), and it generates a Rust module that can be exported into a linked C-ABI library for cross-compatibility with other languages.

This project is divided into three crates, described below.

  1. asnfuzzgen: This crate provides the actual ASN.1 Compiler. Typically a utility (asnfuzzgen) will generate Rust structures starting with ASN.1 Specifications. Basic working features required to work with the 3GPP specifications is provided by the compiler, this includes Parameterized Types, Information Object Classes and Type Constraints.

  2. asnfuzzgen-codecs: Support for different encodings supported by individual ASN.1 specifications is provided in this crate. As of the current release, APER/UPER Codecs are supported. Every Codec is supported as a trait implementing respective 'encode' and 'decode' functions. Support for different 'encoding rules' will be implemented in this crate and then the derive macros will utilize this code to actually generate the encoding support for Rust Structures generated by the compiler above.

  3. asnfuzzgen-codecs-derive: This crate provides the derive macros for the codecs in asn-codecs. The code generated using asnfuzzgen can be directed to derive appropriate codecs by passing the flags during compilation.

Acknowledgements

This project makes use of source code from the Hampi Rust ASN.1 Toolkit, which is likewise licensed under the MIT License. Special thanks goes to Abhijit Gadgil for authoring the Rust ASN.1 Toolkit that has contributed significantly to this project.

Supported Codecs

  • APER
  • UPER

Getting Started

build.rs Support

Typically the compiler can be invoked also using build.rs mechanism. An example build.rs is provided in the examples/ sub project. And the code generated through this build.rs can be integrated into your project. Examples of that is provided in examples/tests/ directory.

Using CLI tool

A tool asnfuzzgen can be installed using cargo install asnfuzzgen and then following the CLI usage.

cargo install asnfuzzgen
asnfuzzgen --help

Running Test Cases

  1. Test cases can be run through cargo test.

Generating ASN.1 spec files

Currently there are two ways of generating the 'ASN.1' spec files from the '.docx' specifications (This mainly applies to 3GPP specifications).

  1. Using the script inside examples/specs/parse_specs.py. This is recommended way. (note: this requires installation of docx or python-docx in the case of Python3).
  2. Using the rust binary extract-asn-spec. Note: this is not the recommended way and your mileage may vary. Eventual goal is to make this the default way - so as to also have a build.rs integration. But this is for now a work in progress. This is not available by default and is enabled only with a feature flag rs-specs-gen.

License & Attribution

The source code of this project is licensed under the MIT License.

asnfuzzgen's People

Contributors

nathaniel-bennett avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.