Scanning API Receiver with Python
A basic web service to accept Scanning API data from a Meraki network
- Accept a GET request from Meraki and respond with a validator
- Meraki will POST to server, if validated.
- POST will contain a secret, which can be verified by the server.
- JSON data will be in req.body.data.
Python Scripts
cmxreceiver.py
The basic app which will simply display the results to the console.
cmxreceiver-mongodb.py
Extends the basic app by placing data into a local MongoDB database.
Prerequisites
- Flask must be installed http://flask.pocoo.org/docs/0.12/
- Cisco Meraki Network with CMX/Scanning API enabled and configured to point to this server
Installation and Run
$ git clone <<this repo>>
Direct Run with Python3
- Option 1 – Basic Receiver
python3 cmxreceiver.py -v <validator> -s <secret>'
- Option 2 – Receiver with MongoDB
python3 cmxreceiver-mongodb.py -v <validator> -s <secret>'
Via Flask
- Option 1 – Basic Receiver
export FLASK_APP=cmxreceiver.py -v yourValidatorKey -s yourSecret
flask run -h 0.0.0.0
* Running on http://0.0.0.0:5000/
- Option 2 – Receiver with MongoDB
export FLASK_APP=cmxreceiver-mongodb.py -v yourValidatorKey -s yourSecret
flask run -h 0.0.0.0
* Running on http://0.0.0.0:5000/
Defaults
- Port: 5000
- CMX Post URL: http://yourserver:5000/
TIP
- use ngrok to expose port 5000 to the public Internet.
ngrok http 5000
Then use the new url it creates as your base URL. https://2a6eed03.ngrok.io/