Skip to content
Permalink
Browse files

Added Swagger auto-documentation support to Recon-API.

  • Loading branch information...
lanmaster53 committed Oct 26, 2019
1 parent e0b227d commit 7396c2cfbdbcff2fe0dc14894c059918c8cac3e3
Showing with 431 additions and 11 deletions.
  1. +1 −0 REQUIREMENTS
  2. +1 −0 recon/core/constants.py
  3. +13 −0 recon/core/web/__init__.py
  4. +137 −0 recon/core/web/definitions.yaml
  5. +279 −11 recon/core/web/views.py
@@ -7,6 +7,7 @@ requests
# web
flask
flask-restful
flasgger
dicttoxml
XlsxWriter
unicodecsv
@@ -31,5 +31,6 @@
*************************************************************************
* Welcome to Recon-web, the analytics and reporting engine for Recon-ng!
* This is a web-based user interface. Open the URL below in your browser to begin.
* Recon-web includes the Recon-API, which can be accessed via the `/api/` URL.
*************************************************************************\
'''
@@ -1,4 +1,5 @@
from flask import Flask, request, abort, cli
from flasgger import Swagger
from recon.core import base
from recon.core.constants import BANNER_WEB
from recon.core.web.db import Tasks
@@ -21,6 +22,16 @@
SECRET_KEY = 'we keep no secrets here.'
JSON_SORT_KEYS = False
REDIS_URL = 'redis://'
SWAGGER = {
'title': 'Swagger',
'info': {
'title': 'Recon-API',
'description': 'A RESTful API for Recon-ng',
'version': '0.0.1',
},
'uiversion': 3,
'specs_route': '/api/',
}
WORKSPACE = recon.workspace.split('/')[-1]
print((f" * Workspace initialized: {WORKSPACE}"))

@@ -30,6 +41,8 @@ def create_app():
app = Flask(__name__, static_url_path='')
app.config.from_object(__name__)

Swagger(app, template_file='definitions.yaml')

app.redis = Redis.from_url(app.config['REDIS_URL'])
app.task_queue = rq.Queue('recon-tasks', connection=app.redis)

@@ -0,0 +1,137 @@
---
definitions:
Error:
properties:
type:
type: string
message:
type: string
traceback:
type: string
required:
- type
- message
- traceback
Result:
properties:
error:
$ref: '#/definitions/Error'
summary:
type: object
required:
- summary
Task:
properties:
id:
type: string
status:
type: string
result:
$ref: '#/definitions/Result'
required:
- id
- status
- result
Option:
properties:
name:
type: string
value:
type: string
required:
type: boolean
description:
type: string
required:
- name
- value
- required
- description
Module:
properties:
name:
type: string
author:
type: string
version:
type: string
description:
type: string
required_keys:
type: array
items:
type: string
dependencies:
type: array
items:
type: string
comments:
type: array
items:
type: string
query:
type: string
options:
type: array
items:
$ref: '#/definitions/Option'
files:
type: array
items:
type: string
required:
- name
- author
- version
- description
Workspace:
properties:
name:
type: string
status:
type: string
options:
type: array
items:
$ref: '#/definitions/Option'
Dashboard:
properties:
workspace:
type: string
records:
type: array
items:
type: object
properties:
name:
type: string
count:
type: integer
activity:
type: array
items:
type: object
properties:
module:
type: string
runs:
type: integer
Table:
properties:
workspace:
type: string
table:
type: string
columns:
type: array
items:
type: string
rows:
type: array
items:
type: object
required:
- workspace
- table
- columns
- rows

0 comments on commit 7396c2c

Please sign in to comment.
You can’t perform that action at this time.