1Python SDK to access the `vulnerability database <https://github.com/vulndb/data>`_ 2 3.. image:: https://circleci.com/gh/vulndb/python-sdk/tree/master.svg?style=svg 4 :alt: Build Status 5 :align: right 6 :target: https://circleci.com/gh/vulndb/python-sdk/tree/master 7 8Installation 9============ 10It's possible to install `the latest stable release from pypi <https://pypi.python.org/pypi/vulndb>`_: 11 12:: 13 14 pip install vulndb 15 16 17Or if you're interested in the latest version from our repository: 18 19:: 20 21 git clone https://github.com/vulndb/python-sdk.git 22 python setup.py install 23 24Usage 25===== 26 27:: 28 29 >>> from vulndb import DBVuln 30 >>> dbv = DBVuln.from_id(42) 31 >>> dbv.title 32 'SQL Injection' 33 >>> dbv.description 34 'A long and actionable description for SQL injection ...' 35 >>> dbv.fix_guidance 36 'Explains the developer how to fix SQL injections, usually a couple of <p> long ...' 37 >>> dbv.severity 38 'high' 39 >>> r = dbv.references[0] 40 >>> r.url 41 'http://example.com/sqli-description.html' 42 >>> r.title 43 'SQL injection cheat-sheet' 44 45 46More attributes, methods and helpers are well documented and available in the 47`source code <https://github.com/vulndb/python-sdk/blob/master/vulndb/db_vuln.py>`_. 48 49Contributing 50============ 51Send your `pull requests <https://help.github.com/articles/using-pull-requests/>`_ 52with improvements and bug fixes, making sure that all tests ``PASS``: 53 54:: 55 56 $ cd python-sdk 57 $ virtualenv venv 58 $ . venv/bin/activate 59 $ pip install -r vulndb/requirements-dev.txt 60 $ nosetests vulndb/ 61 .......... 62 ---------------------------------------------------------------------- 63 Ran 10 tests in 0.355s 64 65 OK 66 67 68Updating the database 69===================== 70This package embeds the `vulnerability database <https://github.com/vulndb/data>`_ 71in the ``vulndb/db/`` directory. To update the database with new information 72follow these steps: 73 74:: 75 76 # Update the database 77 tools/update-db.sh 78 79After updating the database it's a good idea to publish the latest at ``pypi`` using: 80 81:: 82 83 python setup.py sdist upload 84 85 86