Skip to content

rancorm/castor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Castor

Castor logo

Image is sourced from pngimg.

mitmproxy add-on that captures JSON schemas.

Start here

Clone this repository.

git clone https://github.com/rancorm/castor.git
cd castor

Make Python virtual environment, install dependencies, and run.

python -m venv .venv
pip install -r requirements.txt

Run mitmproxy terminal UI, mitmdump or mitmweb with the add-on script castor.py.

mitmproxy -s ./castor.py

Run with web server UI.

mitmweb -s ./castor.py

On the Flow > Response tab, change View to json-schema, or set the CASTOR_AUTO_RENDER to 1 to auto render JSON resquest and responses to JSON schemas.

Dump to the console with mitmdump.

mitmdump -s ./castor.py

Output

Example output from mitmdump generated JSON schema.

{
  "type": "object",
  "properties": {
    "Code": {
      "type": "int"
    },
    "CalendarModelEventID": {
      "type": "str",
      "pattern": "uri"
    },
    "Refresh": {
      "type": "int"
    },
    "More": {
      "type": "int"
    }
  }
}

Options

Disable checks of content type, set CASTOR_CHECKS to 0. To disable the auto rendering of JSON to JSON schema, set CASTOR_AUTO_RENDER to 1.

Saving to disk

To save generated schema to disk, set CASTOR_OUTPUT to the path for saving.

export CASTOR_OUTPUT=/mnt/data

This can perticularly be useful with persisent storage volumes inside containers.

About

mitmproxy add-on that captures JSON schemas

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages