# -*- coding: utf-8 -*-
"""MSF RPC API definition

.. module:: security.msf_api
   :platform: Unix
   :synopsis: MSF RPC API definition
.. moduleauthor:: Petr Rašek <bowman@hydratk.org>

"""

api = {
    'auth' : {
              'login_noauth' : {'desc': 'Handles client authentication. The authentication token will expire 5 minutes after the last request was made.',
                                'params' : [{'name': 'user', 'direction': 'in', 'type': 'string', 'desc': 'The username.'},
                                            {'name': 'pass', 'direction': 'in', 'type': 'string', 'desc': 'The password.'},
                                            {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'},
                                            {'name': 'token', 'direction': 'out', 'type': 'string', 'desc': 'A token for the authentication.'}]},
              'logout' : {'desc': 'Handles client deauthentication.',
                          'params' : [{'name': 'token', 'direction': 'in', 'type': 'string', 'desc': 'The user token to log off.'},
                                      {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
              'token_add' : {'desc': 'Adds a new token to the database.',
                             'params' : [{'name': 'token', 'direction': 'in', 'type': 'string', 'desc': 'A unique token.'},
                                         {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
              'token_generate' : {'desc': 'Generates a random 32-byte authentication token. The token is added to the database as a side-effect.',
                                  'params' : [{'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'},
                                              {'name': 'token', 'direction': 'out', 'type': 'string', 'desc': 'A new token.'}]},
              'token_list' : {'desc': 'Returns a list of authentication tokens, including the ones that are temporary, permanent, or stored in the backend.',
                              'params' : [{'name': 'tokens', 'direction': 'out', 'type': 'List<string>', 'desc': 'An array of tokens'}]},
              'token_remove' : {'desc': 'Removes a token from the database. Similar to what #rpc_logout does internally, except this can remove tokens stored in the database backend (Mdm).',
                                'params' : [{'name': 'token', 'direction': 'in', 'type': 'string', 'desc': 'The token to delete.'},
                                            {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]}
    },
    'console' : {
                 'create' : {'desc': 'Creates a new framework console instance.',
                             'params' : [{'name': 'id', 'direction': 'out', 'type': 'integer', 'desc': 'The console ID.'},
                                         {'name': 'prompt', 'direction': 'out', 'type': 'string', 'desc': 'The framework prompt (example: msf > )'},
                                         {'name': 'busy', 'direction': 'out', 'type': 'class', 'desc': 'The console busy state.'}]},
                 'destroy' : {'desc': 'Deletes a framework console instance.',
                              'params' : [{'name': 'cid', 'direction': 'in', 'type': 'integer', 'desc': 'Framework console ID.'},
                                          {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'list' : {'desc': 'Returns a list of framework consoles.',
                           'params' : [{'name': 'consoles', 'direction': 'out', 'type': 'List<dict>', 'desc': 'An array of consoles (id, prompt, busy)'}]},
                 'read' : {'desc': 'Returns the framework console output in raw form.',
                           'params' : [{'name': 'cid', 'direction': 'in', 'type': 'integer', 'desc': 'Framework console ID.'},
                                       {'name': 'data', 'direction': 'out', 'type': 'string', 'desc': 'The output the framework console produces (example: the banner)'},
                                       {'name': 'prompt', 'direction': 'out', 'type': 'string', 'desc': 'The framework prompt (example: msf > )'},
                                       {'name': 'busy', 'direction': 'out', 'type': 'class', 'desc': 'The console busy state.'}]},
                 'session_detach' : {'desc': 'Detaches a framework session. This serves the same purpose as [CTRL]+ to background an interactive session.',
                                     'params' : [{'name': 'cid', 'direction': 'in', 'type': 'integer', 'desc': 'Framework console ID.'},
                                                 {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'session_kill' : {'desc': 'Kills a framework session. This serves the same purpose as [CTRL]+ to abort an interactive session. You might also want to considering using the session API calls instead of this.',
                                   'params' : [{'name': 'cid', 'direction': 'in', 'type': 'integer', 'desc': 'Framework console ID.'},
                                               {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'tabs' : {'desc': 'Returns the tab-completed version of your input (such as a module path).',
                           'params' : [{'name': 'cid', 'direction': 'in', 'type': 'integer', 'desc': 'Framework console ID.'},
                                       {'name': 'line', 'direction': 'in', 'type': 'string', 'desc': 'Command.'},
                                       {'tabs': 'cid', 'direction': 'out', 'type': 'string', 'desc': 'The tab-completed version of the command.'}]},
                 'write' : {'desc': 'Sends an input (such as a command) to the framework console.',
                            'params' : [{'name': 'cid', 'direction': 'in', 'type': 'integer', 'desc': 'Framework console ID.'},
                                        {'name': 'data', 'direction': 'in', 'type': 'string', 'desc': 'User input.'},
                                        {'name': 'wrote', 'direction': 'out', 'type': 'integer', 'desc': 'Number of bytes sent.'}]}
    },
    'core' : {
              'add_module_path' : {'desc': 'Adds a new local file system path (local to the server) as a module path. The module must be accessible to the user running the Metasploit service, and contain a top-level directory for each module type such as: exploits, nop, encoder, payloads, auxiliary, post. Also note that this will not unload modules that were deleted from the file system that were previously loaded.',
                                   'params' : [{'name': 'path', 'direction': 'in', 'type': 'string', 'desc': 'The new path to load.'},
                                               {'name': 'exploits', 'direction': 'out', 'type': 'integer', 'desc': 'The number of exploits loaded.'},
                                               {'name': 'auxiliary', 'direction': 'out', 'type': 'integer', 'desc': 'The number of auxiliary modules loaded.'},
                                               {'name': 'post', 'direction': 'out', 'type': 'integer', 'desc': 'The number of post modules loaded.'},
                                               {'name': 'encoders', 'direction': 'out', 'type': 'integer', 'desc': 'The number of encoders loaded.'},
                                               {'name': 'nops', 'direction': 'out', 'type': 'integer', 'desc': 'The number of NOP modules loaded.'},
                                               {'name': 'payloads', 'direction': 'out', 'type': 'integer', 'desc': 'The number of payloads loaded.'}]},
              'getg' : {'desc': 'Returns a global datastore option.',
                        'params' : [{'name': 'var', 'direction': 'in', 'type': 'string', 'desc': 'The name of the global datastore.'},
                                    {'name': 'hash', 'direction': 'out', 'type': 'obj', 'desc': 'The global datastore option. If the option is not set, then the value is empty.'}]},
              'module_stats' : {'desc': 'Returns the module stats.',
                                'params' : [{'name': 'exploits', 'direction': 'out', 'type': 'integer', 'desc': 'The number of exploits.'},
                                            {'name': 'auxiliary', 'direction': 'out', 'type': 'integer', 'desc': 'The number of auxiliary modules.'},
                                            {'name': 'post', 'direction': 'out', 'type': 'integer', 'desc': 'The number of post modules.'},
                                            {'name': 'encoders', 'direction': 'out', 'type': 'integer', 'desc': 'The number of encoders.'},
                                            {'name': 'nops', 'direction': 'out', 'type': 'integer', 'desc': 'The number of NOP modules.'},
                                            {'name': 'payloads', 'direction': 'out', 'type': 'integer', 'desc': 'The number of payloads.'}]},
              'reload_modules' : {'desc': 'Reloads framework modules. This will take some time to complete.',
                                  'params' : [{'name': 'exploits', 'direction': 'out', 'type': 'integer', 'desc': 'The number of exploits reloaded.'},
                                              {'name': 'auxiliary', 'direction': 'out', 'type': 'integer', 'desc': 'The number of auxiliary modules reloaded.'},
                                              {'name': 'post', 'direction': 'out', 'type': 'integer', 'desc': 'The number of post modules reloaded.'},
                                              {'name': 'encoders', 'direction': 'out', 'type': 'integer', 'desc': 'The number of encoders reloaded.'},
                                              {'name': 'nops', 'direction': 'out', 'type': 'integer', 'desc': 'The number of NOP modules reloaded.'},
                                              {'name': 'payloads', 'direction': 'out', 'type': 'integer', 'desc': 'The number of payloads reloaded.'}]},
              'save' : {'desc': 'Saves current framework settings.',
                        'params' : [{'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
              'setg' : {'desc': 'Sets a global datastore option.',
                        'params' : [{'name': 'var', 'direction': 'in', 'type': 'string', 'desc': 'The hash key of the global datastore option.'},
                                    {'name': 'val', 'direction': 'in', 'type': 'string', 'desc': 'The value of the global datastore option.'},
                                    {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
              'stop' : {'desc': 'Stops the RPC service.',
                        'params' : []},
              'thread_kill' : {'desc': 'Kills a framework thread.',
                               'params' : [{'name': 'tid', 'direction': 'in', 'type': 'integer', 'desc': 'The thread ID to kill.'},
                                           {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
              'thread_list' : {'desc': 'Returns a list of framework threads.',
                               'params' : [{'name': 'hash', 'direction': 'out', 'type': 'dict', 'desc': 'A collection of threads. Each key is the thread ID, and the value is another hash that contains the following: status, critical, name, started'}]},
              'unsetg' : {'desc': 'Unsets a global datastore option.',
                          'params' : [{'name': 'var', 'direction': 'in', 'type': 'string', 'desc': 'The global datastore option.'},
                                      {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
              'version' : {'desc': 'Returns the RPC service versions.',
                           'params' : [{'name': 'version', 'direction': 'out', 'type': 'string', 'desc': 'Framework version'},
                                       {'name': 'ruby', 'direction': 'out', 'type': 'string', 'desc': 'Ruby version'},
                                       {'name': 'api', 'direction': 'out', 'type': 'string', 'desc': 'API version'}]}
    },
    'db' : {
            'add_workspace' : {'desc': 'Adds a new workspace.',
                               'params' : [{'name': 'wspace', 'direction': 'in', 'type': 'string', 'desc': 'Workspace name.'},
                                           {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'clients' : {'desc': 'Returns browser clients information.',
                         'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters that narrow down the search.'},
                                     {'name': 'clients', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash in the array that contains the following: host, ua_string, ua_name, ua_ver, created_at, updated_at'}]},
            'connect' : {'desc': 'Connects to the database.',
                         'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                     {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'create_cracked_credential' : {'desc': 'Creates a cracked credential.',
                                           'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Credential options. (See #create_credential Documentation)'}]},
            'create_credential' : {'desc': 'Creates a credential.',
                                   'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Credential options. (See #create_credential Documentation)'},
                                               {'name': 'username', 'direction': 'out', 'type': 'string', 'desc': 'Username saved.'},
                                               {'name': 'private', 'direction': 'out', 'type': 'string', 'desc': 'Password saved.'},
                                               {'name': 'private_type', 'direction': 'out', 'type': 'string', 'desc': 'Password type.'},
                                               {'name': 'realm_type', 'direction': 'out', 'type': 'string', 'desc': 'Realm.'},
                                               {'name': 'realm_key', 'direction': 'out', 'type': 'string', 'desc': 'Realm key.'},
                                               {'name': 'host', 'direction': 'out', 'type': 'string', 'desc': 'Host (Only avilable if there is a :last_attempted_at and :status)'},
                                               {'name': 'sname', 'direction': 'out', 'type': 'string', 'desc': 'Service name (only available if there is a :last_attempted_at and :status)'},
                                               {'name': 'status', 'direction': 'out', 'type': 'string', 'desc': 'Login status (only available if there is a :last_attempted_at and :status)'}]},
            'creds' : {'desc': 'Returns login credentials from a specific workspace.',
                       'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                   {'name': 'creds', 'direction': 'out', 'type': 'list of dict', 'desc': 'An array of credentials. Each hash in the array will have the following: user, pass, updated_at, type, host, port, proto, sname'}]},
            'current_workspace' : {'desc': 'Returns the current workspace.',
                                   'params' : [{'name': 'workspace', 'direction': 'out', 'type': 'string', 'desc': 'Workspace name.'},
                                               {'name': 'workspace_id', 'direction': 'out', 'type': 'string', 'desc': 'Workspace ID.'}]},
            'del_client' : {'desc': 'Deletes browser information from a client.',
                            'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters that narrow down what to delete.'},
                                        {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'},
                                        {'name': 'deleted', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash in the array contains the following: address, ua_string'}]},
            'del_host' : {'desc': 'Deletes hosts.',
                          'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters that narrow down what to delete.'},
                                      {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'},
                                      {'name': 'deleted', 'direction': 'out', 'type': 'list of string', 'desc': 'All the deleted hosts.'}]},
            'del_note' : {'desc': 'Deletes notes.',
                          'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters that narrow down what to delete.'},
                                      {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'},
                                      {'name': 'deleted', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash in the array contains the following: address, port, proto, ntype'}]},
            'del_service' : {'desc': 'Deletes services.',
                             'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters that narrow down what to delete.'},
                                         {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'},
                                         {'name': 'deleted', 'direction': 'out', 'type': 'list of dict', 'desc': 'If result says success, then you will get this key. Each hash in the array contains: address, port, proto'}]},
            'del_vuln' : {'desc': 'Deletes vulnerabilities.',
                          'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters that narrow down which vulnerabilities to delete.'},
                                      {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'},
                                      {'name': 'deleted', 'direction': 'out', 'type': 'list of dict', 'desc': 'If result says success, then you will get this key. Each hash in the array contains: address, port, proto, name'}]},
            'del_workspace' : {'desc': 'Deletes a workspace.',
                               'params' : [{'name': 'wspace', 'direction': 'in', 'type': 'string', 'desc': 'Workspace name.'},
                                           {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'disconnect' : {'desc': 'Disconnects the database.',
                            'params' : [{'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'driver' : {'desc': 'Sets the driver for the database or returns the current one.',
                        'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                    {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'},
                                    {'name': 'driver', 'direction': 'out', 'type': 'string', 'desc': 'If the :driver option isnt set, then this returns the current one.'}]},
            'events' : {'desc': 'Returns framework events.',
                        'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                    {'name': 'events', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash in the array contains the following: host, created_at, updated_at, name, critical, username, info'}]},
            'get_client' : {'desc': 'Returns information about a client connection.',
                            'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                        {'name': 'client', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: host, created_at, updated_at, ua_string, ua_name, ua_ver'}]},
            'get_host' : {'desc': 'Returns information about a host.',
                          'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                      {'name': 'host', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: created_at, address, mac, name, state, os_name, os_flavor, os_sp, os_lang, updated_at, purpose, info'}]},
            'get_note' : {'desc': 'Returns a note.',
                          'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                      {'name': 'note', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: host, port, proto, created_at, updated_at, ntype, data, critical, seen'}]},
            'get_ref' : {'desc': 'Returns an external vulnerability reference.',
                         'params' : [{'name': 'name', 'direction': 'in', 'type': 'string', 'desc': 'Reference name.'},
                                     {'name': 'reference', 'direction': 'out', 'type': 'string', 'desc': 'Reference.'}]},
            'get_service' : {'desc': 'Returns information about a service.',
                             'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters for the search'},
                                         {'name': 'service', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: host, created_at, port, proto, state, name, info'}]},
            'get_vuln' : {'desc': 'Returns vulnerabilities from services or from a host.',
                          'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters to narrow down which vulnerabilities to find.'},
                                      {'name': 'vuln', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: host, port, proto, created_at, updated_at, name, info, refs'}]},
            'get_workspace' : {'desc': 'Returns the current workspace.',
                               'params' : [{'name': 'wspace', 'direction': 'in', 'type': 'string', 'desc': 'Workspace name.'},
                                           {'name': 'vuln', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: name, id, created_at, updated_at'}]},
            'hosts' : {'desc': 'Returns information about hosts.',
                       'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                   {'name': 'hosts', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: created_at, address, mac, name, state, os_name, os_flavor, os_sp, os_lang, updated_at, purpose, info'}]},
            'import_data' : {'desc': 'Imports file to the database.',
                             'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                         {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'invalidate_login' : {'desc': 'Sets the status of a login credential to a failure.',
                                  'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Credential data (See #invalidate_login Documentation)'}]},
            'loots' : {'desc': 'Returns all the looted items.',
                       'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters to search.'},
                                   {'name': 'loots', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: host, service, ltype, ctype, data, created_at, updated_at, name, info'}]},
            'notes' : {'desc': 'Returns notes from the database.',
                       'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Filters to search.'},
                                   {'name': 'loots', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: time, host, service, type, data'}]},
            'report_client' : {'desc': 'Reports a client connection.',
                               'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Information about the client.'},
                                           {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'report_event' : {'desc': 'Reports a framework event.',
                              'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Information about the event.'},
                                          {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'report_host' : {'desc': 'Reports a new host to the database.',
                             'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Information to report about the host.'},
                                         {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'report_loot' : {'desc': 'Reports a looted item.',
                             'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Information about the looted item.'},
                                         {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'report_note' : {'desc': 'Reports a note.',
                             'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Information to report about the service.'},
                                         {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'report_service' : {'desc': 'Reports a service to the database.',
                                'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Information about the vulnerability.'},
                                            {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'report_vuln' : {'desc': 'Reports a vulnerability.',
                             'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Information about the client.'}]},
            'services' : {'desc': 'Returns information about services.',
                          'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                      {'name': 'services', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: host, created_at, updated_at, port, proto, state, name, info'}]},
            'set_workspace' : {'desc': 'Sets a workspace.',
                               'params' : [{'name': 'wspace', 'direction': 'in', 'type': 'string', 'desc': 'Workspace name.'},
                                           {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
            'status' : {'desc': 'Returns the database status.',
                        'params' : [{'name': 'result', 'driver': 'out', 'type': 'string', 'desc': 'Name of the database driver.'},
                                    {'name': 'result', 'db': 'out', 'type': 'string', 'desc': 'Name of the database.'}]},
            'vulns' : {'desc': 'Returns information about reported vulnerabilities.',
                       'params' : [{'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options.'},
                                   {'name': 'vulns', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: port, proto, time, host, name, refs'}]},
            'workspaces' : {'desc': 'Returns information about workspaces.',
                            'params' : [{'name': 'workspaces', 'direction': 'out', 'type': 'list of dict', 'desc': 'Each hash of the array contains the following: id, name, created_at, updated_at'}]}
    },
    'job' : {
             'info' : {'desc': 'Returns information about a job.',
                       'params' : [{'name': 'jid', 'direction': 'in', 'type': 'integer', 'desc': 'Job ID.'},
                                   {'name': 'jid', 'direction': 'out', 'type': 'integer', 'desc': 'The Job ID.'},
                                   {'name': 'name', 'direction': 'out', 'type': 'string', 'desc': 'The name of the job.'},
                                   {'name': 'start_time', 'direction': 'out', 'type': 'integer', 'desc': 'The start time.'},
                                   {'name': 'datastore', 'direction': 'out', 'type': 'dict', 'desc': 'Datastore options for the module.'}]},
             'list' : {'desc': 'Returns a list of jobs.',
                       'params' : [{'name': 'jobs', 'direction': 'out', 'type': 'dict', 'desc': 'A list of jobs (IDs and names). Each key is the job ID, and each value is the job name.'}]},
             'stop' : {'desc': 'Stops a job.',
                       'params' : [{'name': 'jid', 'direction': 'in', 'type': 'integer', 'desc': 'Job ID.'},
                                   {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]}
    },
    'module' : {
                'auxiliary' : {'desc': 'Returns a list of auxiliary module names. The auxiliary/ prefix will not be included.',
                               'params' : [{'name': 'modules', 'direction': 'out', 'type': 'list of string', 'desc': 'Auxiliary module names.'}]},
                'compatible_payloads' : {'desc': 'Returns the compatible payloads for a specific exploit.',
                                         'params' : [{'name': 'mname', 'direction': 'in', 'type': 'string', 'desc': 'Exploit module name.'},
                                                     {'name': 'payloads', 'direction': 'out', 'type': 'list of string', 'desc': 'A list of payloads.'}]},
                'compatible_sessions' : {'desc': 'Returns the compatible sessions for a specific post module.',
                                         'params' : [{'name': 'mname', 'direction': 'in', 'type': 'string', 'desc': 'Post module name.'},
                                                     {'name': 'sessions', 'direction': 'out', 'type': 'list of string', 'desc': 'A list of session IDs.'}]},
                'encode' : {'desc': 'Encodes data with an encoder.',
                            'params' : [{'name': 'data', 'direction': 'in', 'type': 'string', 'desc': 'Data to encode.'},
                                        {'name': 'encoder', 'direction': 'in', 'type': 'string', 'desc': 'Encoder module name.'},
                                        {'name': 'options', 'direction': 'in', 'type': 'dict', 'desc': 'Encoding options.'},
                                        {'name': 'encoded', 'direction': 'out', 'type': 'string', 'desc': 'The encoded data in the format you specify.'}]},
                'encode_formats' : {'desc': 'Returns a list of encoding formats.',
                                    'params' : [{'name': 'formats', 'direction': 'out', 'type': 'list of string', 'desc': 'Encoding formats.'}]},
                'encoders' : {'desc': 'Returns a list of encoder module names.',
                              'params' : [{'name': 'modules', 'direction': 'out', 'type': 'list of string', 'desc': 'Encoder module names.'}]},
                'execute' : {'desc': 'Executes a module.',
                             'params' : [{'name': 'mtype', 'direction': 'in', 'type': 'string', 'desc': 'Module type.'},
                                         {'name': 'mname', 'direction': 'in', 'type': 'string', 'desc': 'Module name.'},
                                         {'name': 'opts', 'direction': 'in', 'type': 'dict', 'desc': 'Options for the module (such as datastore options).'},
                                         {'name': 'jobid', 'direction': 'out', 'type': 'integer', 'desc': 'Job ID.'},
                                         {'name': 'uuid', 'direction': 'out', 'type': 'string', 'desc': 'UUID.'}]},
                'exploits' : {'desc': 'Returns a list of exploit names.',
                              'params' : [{'name': 'modules', 'direction': 'out', 'type': 'list of string', 'desc': 'Exploit names.'}]},
                'info' : {'desc': 'Returns the metadata for a module.',
                          'params' : [{'name': 'mtype', 'direction': 'in', 'type': 'string', 'desc': 'Module type.'},
                                      {'name': 'mname', 'direction': 'in', 'type': 'string', 'desc': 'Module name.'},
                                      {'name': 'hash', 'direction': 'out', 'type': 'dict', 'desc': 'The module metadata. The exact keys you will get depends on the module.'}]},
                'info_html' : {'desc': 'Returns detailed information about a module in HTML.',
                               'params' : [{'name': 'mtype', 'direction': 'in', 'type': 'string', 'desc': 'Module type.'},
                                           {'name': 'mname', 'direction': 'in', 'type': 'string', 'desc': 'Module name.'},
                                           {'name': 'info', 'direction': 'out', 'type': 'string', 'desc': 'HTML file.'}]},
                'nops' : {'desc': 'Returns a list of NOP module names.',
                          'params' : [{'name': 'modules', 'direction': 'out', 'type': 'list of string', 'desc': 'NOP module names.'}]},
                'options' : {'desc': 'Returns the module datastore options.',
                             'params' : [{'name': 'mtype', 'direction': 'in', 'type': 'string', 'desc': 'Module type.'},
                                         {'name': 'mname', 'direction': 'in', 'type': 'string', 'desc': 'Module name.'},
                                         {'name': 'hash', 'direction': 'out', 'type': 'dict', 'desc': 'The module datastore options.'}]},
                'payloads' : {'desc': 'Returns a list of payload module names.',
                              'params' : [{'name': 'modules', 'direction': 'out', 'type': 'list of string', 'desc': 'Payload module names.'}]},
                'post' : {'desc': 'Returns a list of post module names.',
                          'params' : [{'name': 'modules', 'direction': 'out', 'type': 'list of string', 'desc': 'Post module names.'}]},
                'target_compatible_payloads' : {'desc': 'Returns the compatible target-specific payloads for an exploit.',
                                                'params' : [{'name': 'mtype', 'direction': 'in', 'type': 'string', 'desc': 'Exploit module name.'},
                                                            {'name': 'target', 'direction': 'in', 'type': 'integer', 'desc': 'A specific target the exploit module provides.'},
                                                            {'name': 'payloads', 'direction': 'out', 'type': 'list of string', 'desc': 'A list of payloads.'}]}
    },
    'plugin' : {
                'load' : {'desc': 'Loads a plugin.',
                          'params' : [{'name': 'path', 'direction': 'in', 'type': 'string', 'desc': 'The plugin filename (without the extension).'},
                                      {'name': 'xopts', 'direction': 'in', 'type': 'dict', 'desc': 'Options to pass to the plugin.'},
                                      {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                'loaded' : {'desc': 'Returns a list of loaded plugins.',
                            'params' : [{'name': 'plugins', 'direction': 'out', 'type': 'list of string', 'desc': 'A list of plugin names.'}]},
                'unload' : {'desc': 'Unloads a plugin.',
                            'params' : [{'name': 'name', 'direction': 'in', 'type': 'string', 'desc': 'The plugin filename (without the extension).'},
                                        {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]}
    },
    'session' : {
                 'compatible_modules' : {'desc': 'Returns all the compatible post modules for this session.',
                                         'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                     {'name': 'modules', 'direction': 'out', 'type': 'list of string', 'desc': 'An array of post module names.'}]},
                 'list' : {'desc': 'Returns a list of sessions that belong to the framework instance used by the RPC service.',
                           'params' : [{'name': 'type', 'direction': 'out', 'type': 'string', 'desc': 'Payload type. Example: meterpreter.'},
                                       {'name': 'tunnel_local', 'direction': 'out', 'type': 'string', 'desc': 'Tunnel (where the malicious traffic comes from).'},
                                       {'name': 'tunnel_peer', 'direction': 'out', 'type': 'string', 'desc': 'Tunnel (local).'},
                                       {'name': 'via_exploit', 'direction': 'out', 'type': 'string', 'desc': 'Name of the exploit used by the session.'},
                                       {'name': 'desc', 'direction': 'out', 'type': 'string', 'desc': 'Session description.'},
                                       {'name': 'info', 'direction': 'out', 'type': 'string', 'desc': 'Session info (most likely the target computer name).'},
                                       {'name': 'workspace', 'direction': 'out', 'type': 'string', 'desc': 'Name of the workspace.'},
                                       {'name': 'session_host', 'direction': 'out', 'type': 'string', 'desc': 'Session host.'},
                                       {'name': 'session_port', 'direction': 'out', 'type': 'string', 'desc': 'Session port.'},
                                       {'name': 'target_host', 'direction': 'out', 'type': 'string', 'desc': 'Target host.'},
                                       {'name': 'username', 'direction': 'out', 'type': 'string', 'desc': 'Username.'},
                                       {'name': 'uuid', 'direction': 'out', 'type': 'string', 'desc': 'UUID.'},
                                       {'name': 'exploit_uuid', 'direction': 'out', 'type': 'string', 'desc': 'Exploit UUID.'},
                                       {'name': 'routes', 'direction': 'out', 'type': 'string', 'desc': 'Routes.'},
                                       {'name': 'platform', 'direction': 'out', 'type': 'string', 'desc': 'Platform.'}]},
                 'metepreter_directory_separator' : {'desc': 'Returns the separator used by the meterpreter.',
                                                     'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                                 {'name': 'separator', 'direction': 'out', 'type': 'string', 'desc': 'The separator used by the meterpreter.'}]},
                 'metepreter_read' : {'desc': 'Reads the output from a meterpreter session (such as a command output).',
                                      'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                  {'name': 'data', 'direction': 'out', 'type': 'string', 'desc': 'Data read.'}]},
                 'metepreter_run_single' : {'desc': 'Runs a meterpreter command even if interacting with a shell or other channel. You will want to use the #rpc_meterpreter_read to retrieve the output.',
                                            'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                        {'name': 'data', 'direction': 'in', 'type': 'string', 'desc': 'Command.'},
                                                        {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'metepreter_session_detach' : {'desc': 'Detaches from a meterpreter session. Serves the same purpose as [CTRL]+.',
                                                'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                            {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'metepreter_session_kill' : {'desc': 'Kills a meterpreter session. Serves the same purpose as [CTRL]+.',
                                              'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                          {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'metepreter_tabs' : {'desc': 'Returns a tab-completed version of your meterpreter prompt input.',
                                      'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                  {'name': 'line', 'direction': 'in', 'type': 'string', 'desc': 'Input.'},
                                                  {'name': 'tabs', 'direction': 'out', 'type': 'string', 'desc': 'The tab-completed version of your input.'}]},
                 'metepreter_transport_change' : {'desc': 'Changes the Transport of a given Meterpreter Session',
                                                  'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                              {'name': 'opts', 'direction': 'in', 'type': 'dict', 'desc': 'A customizable set of options.'},
                                                              {'name': 'result', 'direction': 'out', 'type': 'bool', 'desc': 'Whether the transport was changed successfully.'}]},
                 'metepreter_write' : {'desc': 'Sends an input to a meterpreter prompt. You may want to use #rpc_meterpreter_read to retrieve the output.',
                                       'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                   {'name': 'data', 'direction': 'in', 'type': 'string', 'desc': 'Input to the meterpreter prompt.'},
                                                   {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'ring_clear' : {'desc': 'Clears a shell session. This may be useful to reclaim memory for idle background sessions.',
                                 'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                             {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'ring_last' : {'desc': 'Returns the last sequence (last issued ReadPointer) for a shell session.',
                                'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                            {'name': 'seq', 'direction': 'out', 'type': 'string', 'desc': 'Sequence.'}]},
                 'ring_put' : {'desc': 'Sends an input to a session (such as a command).',
                               'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                           {'name': 'data', 'direction': 'in', 'type': 'string', 'desc': 'Data to write.'},
                                           {'name': 'write_count', 'direction': 'out', 'type': 'string', 'desc': 'Number of bytes written.'}]},
                 'ring_read' : {'desc': 'Reads from a session (such as a command output).',
                                'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                            {'name': 'ptr', 'direction': 'in', 'type': 'integer', 'desc': 'Pointer.'},
                                            {'name': 'seq', 'direction': 'out', 'type': 'string', 'desc': 'Sequence.'},
                                            {'name': 'data', 'direction': 'out', 'type': 'string', 'desc': 'Read data.'}]},
                 'shell_read' : {'desc': 'Reads the output of a shell session (such as a command output).',
                                 'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                             {'name': 'ptr', 'direction': 'in', 'type': 'integer', 'desc': 'Pointer.'},
                                             {'name': 'seq', 'direction': 'out', 'type': 'string', 'desc': 'Sequence.'},
                                             {'name': 'data', 'direction': 'out', 'type': 'string', 'desc': 'Read data.'}]},
                 'shell_upgrade' : {'desc': 'Upgrades a shell to a meterpreter.',
                                    'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                                {'name': 'lhost', 'direction': 'in', 'type': 'string', 'desc': 'Local host.'},
                                                {'name': 'lport', 'direction': 'in', 'type': 'integer', 'desc': 'Local port.'},
                                                {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]},
                 'shell_write' : {'desc': 'Writes to a shell session (such as a command). Note that you will to manually add a newline at the enf of your input so the system will process it. You may want to use #rpc_shell_read to retrieve the output.',
                                  'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                              {'name': 'data', 'direction': 'in', 'type': 'string', 'desc': 'The data to write.'},
                                              {'name': 'write_count', 'direction': 'out', 'type': 'integer', 'desc': 'Number of bytes written.'}]},
                 'stop' : {'desc': 'Stops a session.',
                           'params' : [{'name': 'sid', 'direction': 'in', 'type': 'integer', 'desc': 'Session ID.'},
                                       {'name': 'result', 'direction': 'out', 'type': 'string', 'desc': 'A successful message: success.'}]}
    }
}
