API Reference

Scanner

class sslscan.Scanner(module_manager=None)[source]

The main scanner object.

append(module)[source]

Append a scan or report module.

Parameters:module – Instance of a scan or report module
append_load(name, config, base_class=None)[source]

Append a module but load it first by using the module manager.

Parameters:
  • name (String) – Name of the module to load
  • config (Mixed) – Config of the module
  • base_class (class) – Module lookup filter
Returns:

False if module not found

get_enabled_versions()[source]

Uses the scanner config to create and return a list of all enabled SSL/TLS protocol versions.

Returns:List of methods
Return type:List
get_handler()[source]

Get the active protocol handler.

Returns:Instance of the handler
Return type:sslscan.module.handler.BaseHandler
get_knowledge_base()[source]

Return the knowledge base used by this scanner.

get_module_manager()[source]

Return the active module manager for this scanner.

load_handler_from_uri(host_uri)[source]

Load a handler from a given uri.

Parameters:host_uri (String) – The URI
Returns:The handler
load_rating(name)[source]

Use the active module manager to load a rating module

Parameters:name (String) – Name of the rating module
reset_knowledge_base()[source]

Create and activate a new knowledge base for this scanner.

run()[source]

Execute all scan and report modules attached to the scanner.

run_reports()[source]

Execute all report modules attached to the scanner.

run_scans()[source]

Execute all scan modules attached to the scanner.

set_handler(handler)[source]

Set the active protocol handler.

Parameters:handler – Instance of the handler

Config

A collection of classes to handle the configuration of a scanner or a module.

class sslscan.config.BaseConfig(options=None, parent=None)[source]

The base config. All other configuration classes use it as base class.

add_option(name, **kwargs)[source]

Add an option.

Parameters:
  • name (String) – Name of the config option
  • kwargs – Additional params are used for a new sslscan.config.Option instance
add_option_group(group)[source]

Add grouped options.

Parameters:group (sslscan.config.OptionGroup) – Instance of sslscan.config.OptionGroup
get_option(name)[source]

Return an option.

Parameters:name (String) – The name of the option
Returns:The option or None if not found
get_option_map()[source]

Return the option map

get_option_names()[source]

Return list of option names

get_parent()[source]

Return the parent config object or None if no parent is set.

Returns:Object or None
get_value(name, default=None)[source]

Get the value of an option.

Parameters:
  • name (String) – Name of the option
  • default (Mixed) – Default value
Returns:

If found the value of the option or the default value

set_parent(parent)[source]

Set the current parent config object.

Parameters:parent (Object|None) – Set or reset parent config object
set_value(name, value)[source]

Set the value of an option.

Parameters:
  • name (String) – Name of the option
  • value (Mixed) – The value of the option to set
Returns:

False or True

Return type:

Boolean

set_values(data)[source]

Set the value of multiple options at once.

Parameters:date – The values to set
Todo:Improve docs
class sslscan.config.ModuleConfig(module=None, **kwargs)[source]

Holds the config of a module

Parameters:module – The module this config is for
get_module()[source]
class sslscan.config.Option(name, action='store', default=None, help='', metavar='', type='string', values=None, negation=None, parent=None)[source]
convert_value_type(value)[source]

Tries to convert the value into the right type

Parameters:value (Mixed) – Value to convert
Returns:The value
Return type:Mixed
get_parent()[source]

Return the parent config object or None if no parent is set.

Returns:Object or None
get_value(default=None)[source]

Get the value.

Parameters:default (Mixed) – Default value if value of option not set
Returns:The value or the default value
Return type:Mixed
set_value(value)[source]

Set the value and returns True if it was successful or False if not.

Parameters:value (Mixed) – The value
Raises sslscan.exception.OptionValueError:
 if types do not match
class sslscan.config.OptionGroup(label, help=None)[source]

Used to group multiple options

class sslscan.config.ScanConfig(**kwargs)[source]

Holds the config of a scanner instance

Knowledge base

The knowledge base is used to store and access all collected information.

Example 1:

>>> kb = KnowledgeBase()
>>> kb.set("test.foo", 1234)
>>> kb.get("test.foo")

Example 2:

>>> kb = KnowledgeBase()
>>> cipher = Cipher()
>>> kb.append("client.ciphers", cipher)
>>> kb.get("client.ciphers")

Example 3:

>>> group = ResultGroup(label="My Results")
>>> value = ResultValue(label="Yes/No", True)
>>> group.append(value)
class sslscan.kb.BaseResult(label=None)[source]

Base class for custom results.

class sslscan.kb.CipherResult(protocol_version, cipher_suite, status=None)[source]

This class is used to store all information for a cipher.

protocol_version_name[source]
status_name[source]
class sslscan.kb.KnowledgeBase[source]

The knowledge base is used to store and access all collected information.

append(kb_id, value)[source]

Append a new value to the knowledge base.

Parameters:
  • kb_id (String) – The ID of the value
  • value (Mixed) – The value
get(kb_id)[source]

Fetch a value by its ID

Parameters:kb_id (String) – The ID
Todo:Add default value
get_group_ids(kb_id)[source]

Collect and return all values that are result groups.

The given kb_id is used as filter.

Parameters:kb_id (String) – The ID
get_list(kb_id)[source]

Fetch all values and sub-values by a given ID

Parameters:kb_id (String) – The ID
Returns:List of values
Return type:List
set(kb_id, value)[source]
class sslscan.kb.ResultGroup(**kwargs)[source]

Group results

append(item)[source]
get_items()[source]
class sslscan.kb.ResultValue(name=None, value=None, **kwargs)[source]

A single result value

Modules

class sslscan.module.BaseModule(scanner=None, config=None)[source]

Base class used by all modules.

It provides the basic functionality.

get_scanner()[source]

Get the current scanner instance.

set_scanner(scanner)[source]

Set the scanner instance the module was appended to.