Home

Awesome

PyDradis

<h3> Dradis API Python Wrapper <br> Copyright &copy; 2016 Novacoast </h3>

License

Pydradis is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Pydradis is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with Pydradis. If not, see http://www.gnu.org/licenses/.

Usage Example

This is a wrapper for the Dradis Pro API

Install by either pulling from this repo or using:

pip install pydradis

Setup:

from pydradis import Pydradis

debug = True #Do you want to see debug info?
verify = True #Force ssl certificate verification?
pd = Pydradis("<DRADIS API KEY>","<DRADIS SERVER URL>",debug,verify)

All endpoints have 6 functions that work roughly the same:

<h4>Client Endpoint</h4>
>>> pd.get_clientlist()
[[u'NASA', 2], [u'ACME Inc.', 5]]
>>> pd.get_client(2)
{u'client_since': u'2016-08-29', u'name': u'NASA', u'created_at': u'2016-08-29T05:43:47.000Z', u'updated_at': u'2016-08-29T05:44:30.000Z', u'id': 3, u'projects': [{u'id': 6, u'name': u'Internal Pentest #1'}]}
>>> pd.create_client("Wayne Industries")
42
>>> pd.update_client("Wayne Corp.")
42
>>> pd.find_client("Wayne Corp.")
42
>>> pd.delete_client(42)
True
<h4>Project Endpoint</h4>
>>> pd.get_projectlist()
[[u'Project X', 10],[u'WikiTesting', 7], [u'Project B-25', 1], [u'Internal Pentest', 2]]
>>> pd.get_project(10)
{u'owners': [{u'email': u'pedro@example.com'}], u'name': u'Project X', u'created_at': u'2016-04-20T23:49:40.000Z', u'updated_at': u'2016-06-29T16:10:06.000Z', u'authors': [{u'email': u'pedro@example.com'}], u'id': 10}
>>> pd.create_project("Project T",2)
26
>>> pd.update_project(26,"Project T1",42)
26
>>> pd.find_project("Project T1")
26
>>> pd.delete_project(10)
True
<h4>Node Endpoint</h4>
>>> pd.get_nodelist(1)
[[u'Dradis Professional Edition', 1], [u'Welcome', 2], [u'Getting Help', 3], [u"What's next?", 4]]
>>> pd.get_node(1,1)
{u'type_id': 0, u'created_at': u'2012-06-09T10:25:57.000Z', u'updated_at': u'2014-03-12T14:19:37.000Z', u'label': u'Dradis Professional Edition', u'parent_id': None, u'notes': [{u'fields': {u'Title': u'Test Note #1'}, u'category_id': 6, u'text': u'#[Title]#\nTest Note #1', u'id': 1, u'title': u'Test Note #1'}], u'position': 0, u'evidence': [], u'id': 1}
>>> pd.create_node(1,"Testing #2",0,None,1)
590
>>> pd.update_node(1,590,"Testing #2 - Mod",0,1,0)
590
>>> pd.find_node(1,"Dradis Professional Edition/Testing #2 - Mod")
590
>>> pd.delete_node(1,590)
True
<h4>Issues Endpoint</h4>
>>> pd.get_issuelist(1)
[[u'Firewall Issue', 414], [u'Problem #1', 413]]
>>> pd.get_issue(1,414)
{u'title': u'Firewall Issue', u'fields': {u'Description': u'The firewall is turned off', u'Title': u'Firewall Issue'}, u'created_at': u'2016-06-30T16:07:10.000Z', u'updated_at': u'2016-06-30T16:07:10.000Z', u'text': u'#[Title]#\r\nFirewall Issue\r\n\r\n#[Description]#\r\nThe firewall is turned off\r\n\r\n', u'id': 414}
>>> pd.create_issue(1,"Main router issue", "Main router uses default admin & password", ["Internal","Networking"])
415
>>> pd.update_issue(1,415,"Main router credentials", "Admin=root and password=abc123 ", ["Internal","Networking","Tag A"])
415
#Use with single keyword
>>> pd.find_issue(1,"router")
[[u'Main router credentials', 415]]
#Use with keyword list
>>> pd.find_issue(1,["issue","problem"])
[[u'Firewall Issue', 414], [u'Problem #1', 413]]
>>> pd.delete_issue(414)
True
<h4>Evidence Endpoint</h4>
>>> pd.get_evidencelist(1,1)
[{u'content': u'#[Title]#\r\nFingerprints\r\n\r\n#[Description]#\r\nFoo Foo\r\n\r\n#[Tag B]#\r\n', u'fields': {u'Tag B': u'', u'Label': u'Dradis Professional Edition', u'Description': u'Foo Foo', u'Title': u'Fingerprints'}, u'issue': {u'url': u'https://dradis.waynecorp.at/pro/api/issues/415', u'id': 415, u'title': u'Main router credentials'}, u'id': 47}]
>>> pd.get_evidence(1,1,47)
{u'content': u'#[Title]#\r\nFingerprints\r\n\r\n#[Description]#\r\nFoo Foo\r\n\r\n#[Tag B]#\r\n', u'fields': {u'Tag B': u'', u'Label': u'Dradis Professional Edition', u'Description': u'Foo Foo', u'Title': u'Fingerprints'}, u'issue': {u'url': u'https://dradis.waynecorp.at/pro/api/issues/415', u'id': 415, u'title': u'Main router credentials'}, u'id': 47}
>>> pd.create_evidence(1,1,415,"Some Evidence", "More Info",["Tag A"])
48
>>> pd.update_evidence(1,1,415,46,"Some Evidence #2", "More Info",["Internal"])
46
>>> pd.find_evidence(1,1,["evidence #2"])
[{u'content': u'#[Title]#\r\nSome Evidence #2\r\n\r\n#[Description]#\r\nMore Info\r\n\r\n#[Internal]#\r\n', u'fields': {u'Internal': u'', u'Label': u'Dradis Professional Edition', u'Description': u'More Info', u'Title': u'Some Evidence #2'}, u'issue': {u'url': u'https://dradis.waynecorp.at/pro/api/issues/415', u'id': 415, u'title': u'Main router credentials'}, u'id': 46}]
>>> pd.delete_evidence(1,1,46)
True
<h4>Note Endpoint</h4>
>>> pd.get_notelist(1,1)
[[u'Use the tree on the left to browse through the items in this project.', 1], [u'Ready to try the new interface?', 2]]
pd.get_note(1,1,1)
{u'fields': {u'Title': u'Use the tree on the left to browse through the items in this project.'}, u'category_id': 6, u'text': u'#[Title]#\nUse the tree on the left to browse through the items in this project.', u'id': 1, u'title': u'Use the tree on the left to browse through the items in this project.'}
>>>pd.create_note(1,1,"Possible Hosts", "foo.com, foo.org and foo.net",["External","OSINT"],0)
416
>>> pd.update_note(1,1,416," Possible Vulnerable Hosts", "foo.com, foo.org, foo.net, and foo.io",["External","OSINT"],1)
416
>>> pd.find_note(1,1,["foo.org","foo.net"])
[[u'Vulnerable Host', 416]
>>> pd.delete_note(1,1,416)
True
<h4>Attachment Endpoint</h4>
>>> pd.get_attachmentlist(1,358)
[[u'screenshot.png', u'/pro/nodes/358/attachments/screenshot.png'], [u'test.py', u'/pro/nodes/358/attachments/test.py']]
>>> pd.get_attachment(1,358,"screenshot.png","downloads/screenshot01.png")
True #This means it succesfully downloaded file to downloads/screenshot01.png
>>> pd.post_attachment(1,358,"important.txt")
[u'important.txt', u'/pro/nodes/358/attachments/important.txt']
>>> pd.rename_attachment(1,358,"important.txt","super_important.txt")
[u'super_important.txt', u'/pro/nodes/358/attachments/super_important.txt']
>>> pd.delete_attachment(1,358,"important.txt")
True