syntax-symphony


Namesyntax-symphony JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryEfficient grammar-based fuzzer.
upload_time2024-06-29 14:27:08
maintainerNone
docs_urlNone
authorStanimir Iglev
requires_python>=3.10
license MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords fuzzer fuzzing testing grammar grammars
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Syntax Symphony

## Overview

Syntax Symphony is a powerful fuzzer designed to automatically generate test inputs for various applications based on user-defined grammars.
The fuzzer leverages the grammar rules to create meaningful and diverse input data, facilitating robust testing of applications.
In order to achieve high diversity and coverage of grammar rules, it uses k-coverage, as discussed by [Havrikov et al.](https://ieeexplore.ieee.org/abstract/document/8952419). This work has been greatly influenced by the concepts and ideas outlined in the [Fuzzing Book](https://www.fuzzingbook.org/).

With Syntax Symphony, you can enhance the quality and reliability of your software by generating a comprehensive set of test cases effortlessly. Start fuzzing today and make your software more robust against unexpected inputs!


## Getting Started

### Prerequisites
- Python 3.10 or higher

### Installation

#### From PyPI
```bash
pip install syntax-symphony
```
#### From Source
1. Clone the repository:
```bash
git clone
cd syntax_symphony
```

2. We recommend creating a virtual environment to install the dependencies:
```bash
python -m venv venv
source venv/bin/activate
python -m pip install -r requirements.txt
```

3. Install locally (add flag -e to install in editable mode):
```bash
pip install .
```

4. To build the package:
```bash
python -m pip install build
python -m build
```
This should create the package in the `dist/` directory.

## CLI
Syntax Symphony provides a command-line interface (CLI) to interact with the fuzzer. The CLI allows you to specify the grammar file, the number of test cases to generate, and the output directory to save the generated test cases among others.

### Example usage:
```bash
# Generate 100 test cases using the grammar file examples/expr_grammar.json
ssfuzz -g examples/expr_grammar.json -c 100

# Save the output in the directory out/
ssfuzz -g examples/expr_grammar.json -c 100 -d out

# Set the start symbol
ssfuzz -g examples/expr_grammar.json -c 100 --start begin

# Set the file extension
ssfuzz -g examples/expr_grammar.json -c 100 -e json
```

### Full syntax:
```
ssfuzz [-h] -g FILE [-s SYMBOL] -c NUMBER [-d DIR] [-e EXT] [--max-depth NUMBER] [--min-depth NUMBER] [-k NUMBER]

Syntax Symphony Fuzzer

options:
  -h, --help            show this help message and exit
  -g FILE, --grammar FILE
                        Path to the grammar file
  -s SYMBOL, --start SYMBOL
                        Start symbol of the grammar (without <...>). Default: start
  -c NUMBER, --count NUMBER
                        Number of strings to generate
  -d DIR, --dir DIR     Output directory for the generated strings. Default: output
  -e EXT, --file-extension EXT
                        The file extension to be used for the produced documents. Default: txt
  --max-depth NUMBER    Maximum depth for the derivation trees. Default: 10
  --min-depth NUMBER    Minimum depth for the derivation trees. Default: 1
  -k NUMBER, --kcov NUMBER
                        Number of strings to generate for k-cov. Default: 1
```

## API
Syntax Symphony can also be used as a library in your Python projects. The API provides a simple interface to generate test inputs using the fuzzer.

### Example usage:
```python
from syntax_symphony.fuzzer import SyntaxSymphony
from syntax_symphony.grammar import Grammar

# Define the grammar
grammar = Grammar({
    "<start>": ["<expr>"],
    "<expr>": ["<term> + <expr>", "<term> - <expr>", "<term>"],
    "<term>": ["<factor> * <term>", "<factor> / <term>", "<factor>"],
    "<factor>": ["<number>", "(<expr>)"],
    "<number>": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
})

# Create the fuzzer
fuzzer = SyntaxSymphony(grammar)

# Generate 10 test cases
for i in range(10):
    test_case = fuzzer.fuzz()
    print(test_case)
```

## Contributing
We welcome contributions from the community. If you have ideas for improvements, new features, or bug fixes, please submit a pull request or open an issue on our GitHub repository.

## License
This project is licensed under the MIT License. See [LICENSE](LICENSE) for more details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "syntax-symphony",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Stanimir Iglev <iglev.stanimir@gmail.com>",
    "keywords": "fuzzer, fuzzing, testing, grammar, grammars",
    "author": "Stanimir Iglev",
    "author_email": "Stanimir Iglev <iglev.stanimir@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/99/55/bdaf0fc2a07827c62c504dfa67de932ddf6a6f1a24100f838d7c6297e5d4/syntax_symphony-0.0.2.tar.gz",
    "platform": null,
    "description": "# Syntax Symphony\n\n## Overview\n\nSyntax Symphony is a powerful fuzzer designed to automatically generate test inputs for various applications based on user-defined grammars.\nThe fuzzer leverages the grammar rules to create meaningful and diverse input data, facilitating robust testing of applications.\nIn order to achieve high diversity and coverage of grammar rules, it uses k-coverage, as discussed by [Havrikov et al.](https://ieeexplore.ieee.org/abstract/document/8952419). This work has been greatly influenced by the concepts and ideas outlined in the [Fuzzing Book](https://www.fuzzingbook.org/).\n\nWith Syntax Symphony, you can enhance the quality and reliability of your software by generating a comprehensive set of test cases effortlessly. Start fuzzing today and make your software more robust against unexpected inputs!\n\n\n## Getting Started\n\n### Prerequisites\n- Python 3.10 or higher\n\n### Installation\n\n#### From PyPI\n```bash\npip install syntax-symphony\n```\n#### From Source\n1. Clone the repository:\n```bash\ngit clone\ncd syntax_symphony\n```\n\n2. We recommend creating a virtual environment to install the dependencies:\n```bash\npython -m venv venv\nsource venv/bin/activate\npython -m pip install -r requirements.txt\n```\n\n3. Install locally (add flag -e to install in editable mode):\n```bash\npip install .\n```\n\n4. To build the package:\n```bash\npython -m pip install build\npython -m build\n```\nThis should create the package in the `dist/` directory.\n\n## CLI\nSyntax Symphony provides a command-line interface (CLI) to interact with the fuzzer. The CLI allows you to specify the grammar file, the number of test cases to generate, and the output directory to save the generated test cases among others.\n\n### Example usage:\n```bash\n# Generate 100 test cases using the grammar file examples/expr_grammar.json\nssfuzz -g examples/expr_grammar.json -c 100\n\n# Save the output in the directory out/\nssfuzz -g examples/expr_grammar.json -c 100 -d out\n\n# Set the start symbol\nssfuzz -g examples/expr_grammar.json -c 100 --start begin\n\n# Set the file extension\nssfuzz -g examples/expr_grammar.json -c 100 -e json\n```\n\n### Full syntax:\n```\nssfuzz [-h] -g FILE [-s SYMBOL] -c NUMBER [-d DIR] [-e EXT] [--max-depth NUMBER] [--min-depth NUMBER] [-k NUMBER]\n\nSyntax Symphony Fuzzer\n\noptions:\n  -h, --help            show this help message and exit\n  -g FILE, --grammar FILE\n                        Path to the grammar file\n  -s SYMBOL, --start SYMBOL\n                        Start symbol of the grammar (without <...>). Default: start\n  -c NUMBER, --count NUMBER\n                        Number of strings to generate\n  -d DIR, --dir DIR     Output directory for the generated strings. Default: output\n  -e EXT, --file-extension EXT\n                        The file extension to be used for the produced documents. Default: txt\n  --max-depth NUMBER    Maximum depth for the derivation trees. Default: 10\n  --min-depth NUMBER    Minimum depth for the derivation trees. Default: 1\n  -k NUMBER, --kcov NUMBER\n                        Number of strings to generate for k-cov. Default: 1\n```\n\n## API\nSyntax Symphony can also be used as a library in your Python projects. The API provides a simple interface to generate test inputs using the fuzzer.\n\n### Example usage:\n```python\nfrom syntax_symphony.fuzzer import SyntaxSymphony\nfrom syntax_symphony.grammar import Grammar\n\n# Define the grammar\ngrammar = Grammar({\n    \"<start>\": [\"<expr>\"],\n    \"<expr>\": [\"<term> + <expr>\", \"<term> - <expr>\", \"<term>\"],\n    \"<term>\": [\"<factor> * <term>\", \"<factor> / <term>\", \"<factor>\"],\n    \"<factor>\": [\"<number>\", \"(<expr>)\"],\n    \"<number>\": [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n})\n\n# Create the fuzzer\nfuzzer = SyntaxSymphony(grammar)\n\n# Generate 10 test cases\nfor i in range(10):\n    test_case = fuzzer.fuzz()\n    print(test_case)\n```\n\n## Contributing\nWe welcome contributions from the community. If you have ideas for improvements, new features, or bug fixes, please submit a pull request or open an issue on our GitHub repository.\n\n## License\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for more details.\n",
    "bugtrack_url": null,
    "license": " MIT License  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Efficient grammar-based fuzzer.",
    "version": "0.0.2",
    "project_urls": {
        "Changelog": "https://github.com/StanimirIglev/syntax-symphony/blob/master/CHANGELOG.md",
        "Documentation": "https://github.com/StanimirIglev/syntax-symphony/blob/master/README.md",
        "Homepage": "https://github.com/StanimirIglev/syntax-symphony",
        "Repository": "https://github.com/StanimirIglev/syntax-symphony"
    },
    "split_keywords": [
        "fuzzer",
        " fuzzing",
        " testing",
        " grammar",
        " grammars"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d2ac08ec456ccc0778d173e8ab8429f8dddc6a91ffca8cbd95253a458393cc8",
                "md5": "d780653880b77b74b451429167210669",
                "sha256": "7a92dc4ea915a2b78aa32eeaa6c175ded26d83dfe3f41b49db62e79a90d573ca"
            },
            "downloads": -1,
            "filename": "syntax_symphony-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d780653880b77b74b451429167210669",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 12976,
            "upload_time": "2024-06-29T14:27:06",
            "upload_time_iso_8601": "2024-06-29T14:27:06.960976Z",
            "url": "https://files.pythonhosted.org/packages/1d/2a/c08ec456ccc0778d173e8ab8429f8dddc6a91ffca8cbd95253a458393cc8/syntax_symphony-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9955bdaf0fc2a07827c62c504dfa67de932ddf6a6f1a24100f838d7c6297e5d4",
                "md5": "70da16fb583eddd9e30573f83e829efe",
                "sha256": "a56515dd02024a399be85112d80a68d3180bf9b45da49239d88bf2b5b4a7e91c"
            },
            "downloads": -1,
            "filename": "syntax_symphony-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "70da16fb583eddd9e30573f83e829efe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 14726,
            "upload_time": "2024-06-29T14:27:08",
            "upload_time_iso_8601": "2024-06-29T14:27:08.370451Z",
            "url": "https://files.pythonhosted.org/packages/99/55/bdaf0fc2a07827c62c504dfa67de932ddf6a6f1a24100f838d7c6297e5d4/syntax_symphony-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-29 14:27:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "StanimirIglev",
    "github_project": "syntax-symphony",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "syntax-symphony"
}
        
Elapsed time: 0.30313s