Skip to content

How to use the seebug api

Vex Woo edited this page Jul 14, 2016 · 1 revision

If you are a seebug api newbie, please try it first with seebug_api_test, and input a valid Seebug Token.

>>> from pocsuite.api.seebug import seebug_api_test
>>> seebug_api_test()
[*] Seebug API Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Where is my seebug api token ? Please access Account Settings page, and copy the Token string.

Seebug API Token Authentication

When the seebug api is used to search / download / list poc(s), you need seebug api token authentication at first.

>>> from pocsuite.api.seebug import Seebug
>>> seebug = Seebug()
>>> seebug.token = "Your Seebug API Token"

How to search poc(s) with keywords

poc_search can search poc(s) with a keyword at a time. If you want more, please search some times.

>>> poc_code = seebug.poc_search(keyword="redis")

How to list all available poc(s)

Get available poc(s) related to the seebug api. Every seebug api owns a unique poc(s) list.

>>> poc_code = seebug.poc_list()

How to get a poc details

Please get a poc details by ssvid. The details include code and name.

>>> poc_code = seebug.poc_detail(89715)

How to download a poc

Get the poc code by ssvid

>>> poc_code = seebug.poc_code(89715)

How to download all pocs

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pocsuite.api.seebug import Seebug
import codecs


def save_poc(filename, data):
    if not data:
        return

    with codecs.open(filename, "w", encoding="utf-8") as f:
        f.write(data)


def download_all_pocs(path='.'):
    sb = Seebug()
    sb.token = raw_input("[*] Seebug API Token: ")
    pocs = sb.poc_list()
    for poc in pocs:
        ssvid = poc.get('id')
        name = poc.get('name')

        if ssvid and str(ssvid).isdigit():
            filename = "{}/{}.py".format(path, ssvid)
            code = sb.poc_code(ssvid)

            save_poc(filename, code)

            print('[+] poc-[{}] ---->> {}'.format(ssvid, filename))


if __name__ == "__main__":
    download_all_pocs('/tmp')
$ python download_all_pocs.py
[*] Seebug API Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[+] poc-[89715] ---->> /tmp/89715.py
[+] poc-[90021] ---->> /tmp/90021.py
......
......