Skip to main content

APIFuzzer — HTTP API Testing Framework

APIFuzzer reads your API description and step by step fuzzes the fields to validate if you application can cope with the fuzzed parameters. Does not require coding.

APIFuzzer main features

  • Parse API definition from local file or remote URL
  • JSON and YAML file format support
  • All HTTP methods are supported
  • Fuzzing of request body, query string, path parameter and request header are supported
  • Relies on random mutations
  • Support CI integration
    • Generate JUnit XML test report format
    • Send request to alternative URL
    • Support HTTP basic auth from configuration
    • Save report of failed test in JSON format into the pre-configured folder
    • Log to stdout instead of syslog
  • Configurable log level

Supported API definition formats

Planned

Pre-requirements

  1. Python3
  2. sudo apt install libcurl4-openssl-dev libssl-dev libcurl4-nss-dev (on Ubuntu 18.04, required by pycurl)
  3. sudo apt install gcc libcurl4-nss-dev (on Ubuntu 20.04, required by pycurl)

Installation

Latest release version:

pip3 install APIFuzzer

Development version: Fetch the most recent code from GitHub

$ git clone https://github.com/KissPeter/APIFuzzer.git

Install requirements. If you don't have pip installed, then sudo apt-get install python3-pip -y

$ pip3 install -r APIFuzzer/requirements.txt

Quick Start

Check the help (some of them are not implemented yet):


$$ usage: APIFuzzer [-h] [-s SRC_FILE] [--src_url SRC_URL] [-r REPORT_DIR] [--level LEVEL] [-u ALTERNATE_URL] [-t TEST_RESULT_DST]
                 [--log {critical,fatal,error,warn,warning,info,debug,notset}] [--basic_output BASIC_OUTPUT] [--headers HEADERS] [-v ,--version]

APIFuzzer configuration

optional arguments:
  -h, --help            show this help message and exit
  -s SRC_FILE, --src_file SRC_FILE
                        API definition file path. JSON and YAML format is supported
  --src_url SRC_URL     API definition url. JSON and YAML format is supported
  -r REPORT_DIR, --report_dir REPORT_DIR
                        Directory where error reports will be saved. Default is temporally generated directory
  --level LEVEL         Test deepness: [1,2], the higher is the deeper (In progress)
  -u ALTERNATE_URL, --url ALTERNATE_URL
                        Use CLI defined url instead compile the url from the API definition. Useful for testing
  -t TEST_RESULT_DST, --test_report TEST_RESULT_DST
                        JUnit test result xml save path
  --log {critical,fatal,error,warn,warning,info,debug,notset}
                        Use different log level than the default WARNING
  --basic_output BASIC_OUTPUT
                        Use basic output for logging (useful if running in jenkins). Example --basic_output=True
  --headers HEADERS     Http request headers added to all request. Example: '[{"Authorization": "SuperSecret"}, {"Auth2": "asd"}]'

Usage example:

Start the sample application (install the necessary packages listed in test/requirements_for_test.txt):
$ python3 test/test_application.py

Start the fuzzer:
$ APIFuzzer -s test/test_api/openapi_v2.json -u http://127.0.0.1:5000/ -r /tmp/reports/ --log debug 

Check the reports:
$ ls -1 /tmp/reports/

Report example:
$ json_pp < /tmp/reports/79_1573993485.5391517.json
{
   "response" : "Test application exception: invalid literal for int() with base 10: '0\\x00\\x10'",
   "sub_reports" : [],
   "parsed_status_code" : 500,
   "state" : "COMPLETED",
   "test_number" : 79,
   "request_body" : null,
   "reason" : "failed",
   "name" : "target",
   "request_url" : "http://127.0.0.1:5000/exception/0\u0000\u0010",
   "request_method" : "GET",
   "status" : "failed",
   "request_headers" : "{\"User-Agent\": \"APIFuzzer\", \"Accept-Encoding\": \"gzip, deflate\", \"Accept\": \"*/*\", \"Connection\": \"keep-alive\"}"
}

Release files for APIFuzzer 0.9.13

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

Source distribution (sdist)

Source distribution for APIFuzzer 0.9.13
File Size Uploaded
APIFuzzer-0.9.13.tar.gz 32.8 kB Details

Built distribution (wheel)

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

Total release size:71.0 kB

Release files / APIFuzzer-0.9.13.tar.gz

Download URL APIFuzzer-0.9.13.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c58e91efb3ef0ab30f796859514bd2723d3754f0f5f8cc9c60d7d102a41aa54d
BLAKE2b-256 checksum
How to use checksums
eb97f065398c5a53a326665815008d28d7e07174a8bab8a180c2e6eacd504ff7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.26.0 setuptools/58.3.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.9

Release files / APIFuzzer-0.9.13-py3-none-any.whl

Download URL APIFuzzer-0.9.13-py3-none-any.whl
Size 38.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
100268808c163286a11a8c6a79c2e8ac385e034c53a1a3f5f08aa09820a0012a
BLAKE2b-256 checksum
How to use checksums
e8685982f0296b0b807af5960f9ca12e066aa86228c992893bd969d0ad064ef2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.26.0 setuptools/58.3.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.9.13 This release

2 release files

0.9.12

2 release files

0.9.11

2 release files

0.9.10

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.5

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