Flask based Restful Server to handle requests from rastrea2r
- Python 3.4+
- VirtualEnv
- Sample Rest Client
- Strong Password Hashing (stored in sqlite DB)
- Rate limiting for safety
- JSONified error handling
- Extensive logging to both stdout and log files
Note
It is best practice to install run Python projects in a virtual environment, which can be created and activated as follows using Python 3.6+.
- Make sure you have virtualenv and Python3 installed on your system (pip3 install virtualenv)
- Clone the repo:
`https://github.com/rastrea2r/rastrea2r-server.git`
- Install the virtualenv and activate it
$ cd rastrea2r-server $ make venv $ source ./.venv/rastrea2r_server/bin/activate (rastrea2r_server) $ * You must activate the virtualenv before starting the server * Initialize DB and Add a user(rastrea2r_server) $./manage_server.py --init (rastrea2r_server) $./manage_server.py --add testuser
- Start the server:
(rastrea2r_server) $./start_server.py
- Test the info request with a browser:
http://localhost:5000/ http://localhost:5000/rastrea2r/api/v1.0/info http://localhost:5000/rastrea2r/api/v1.0/echo?message=test http://localhost:5000/rastrea2r/api/v1.0/uptime http://localhost:5000/test
- Or you could use curl
(rastrea2r_server) $curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -H "Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3N3ZA==" -X POST http://localhost:5000/rastrea2r/api/v1.0/results (rastrea2r_server) $curl -H "Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3N3ZA==" http://localhost:5000/rastrea2r/api/v1.0/rule?rulename=example.yara Note: Basic auth uses the base64 encoded string corresponding to username:password (in this case the username:password combo used was testuser:testpasswd)
The API Reference provides API-level documentation.
Report bugs at the issue tracker.
New feautrue requests can be made using the following template in the bug tracker.