This section describes the configuration specified in your configuration file (second argument to the runner).
This section describes the components involved with writing your own tests with Syntribos.
All Syntribos tests inherit from syntribos.tests.base.BaseTestCase, either directly, or through a subclass like syntribos.tests.fuzz.base_fuzz.BaseFuzzTestCase.
All tests are aggregated in the syntribos.tests.base.test_table variable
This is the metaclass for each class extending BaseTestCase.
Base class for building new tests
Attribute test_name: | |
---|---|
A name like XML_EXTERNAL_ENTITY_BODY, containing the test type and the portion of the request template being tested |
Creates an extension for the class
Each TestCase class created is added to the test_table, which is then read in by the test runner as the master list of tests to be run.
Parameters: |
|
---|---|
Return type: | class |
Returns: | A TestCase class extending BaseTestCase |
Returns tests for a given TestCase class (overwritten by children)
Adds an issue to the test’s list of issues
Registers a syntribos.issue.Issue object as a failure and associates the test’s metadata to it.
Parameters: | issue (syntribos.issue.Issue) – issue object to update |
---|---|
Returns: | new issue object with metadata associated |
Return type: | syntribos.issue.Issue |
This kicks off the test(s) for a given TestCase class
After running the tests, an AssertionError is raised if any tests were added to self.failures.
Raises: | AssertionError |
---|
This method is overwritten by individual TestCase classes
It represents the actual test that is called in run_test(), and handles populating self.failures
Run assertions for each test registered in test_case.
Replace invalid characters in test names
This function corrects string so the following is true.
Identifiers (also referred to as names) are described by the following lexical definitions:
Parameters: |
|
---|---|
Returns: | The test name, with invalid characters replaced with new_char |
Return type: | str |
Mixin for fuzz tests
This class provides the _fuzz_data() function which yields a test name and all iterations of a given piece of data (currently supports dict, xml.etree.ElementTree.Element, and basestring formats) with each string provided.
Places fuzz string in fuzz location for object data.
Parameters: |
|
---|
Places fuzz_string in fuzz location for string data.
Parameters: |
|
---|
Places fuzz string in fuzz location for XML data.
Iterates through model fields and places fuzz string in each field
For each attribute in the model object, call the _build_combinations method corresponding to the type of the data parameter, which replaces the value with the fuzz string.
Parameters: |
|
---|
Merge dicts together
Create a copy of x, and update that with elements of y, to prevent squashing of passed in dicts.
Parameters: |
|
---|---|
Returns: | Merged dictionary |
Return type: | dict |
Copies an XML element, populates attributes from attribs
Parameters: |
|
---|---|
Returns: | XML element with all attributes overwritten by attribs |
Return type: | xml.ElementTree.Element |
Copies an XML element, updates its text attribute with text
Parameters: |
|
---|---|
Returns: | XML element with “text” attribute set to text |
Return type: | xml.ElementTree.Element |
Copies an XML element, populates sub-elements from list_
Returns a copy of the element with the subelements given via list_ :param ele: XML element to be copied, modified :type ele: xml.ElementTree.Element :param list list_: List of subelements to append to ele :returns: XML element with new subelements from list_ :rtype: xml.ElementTree.Element
Remove braces from strings (in request templates)
Creates the fuzzed request object
Gets the name and the fuzzed request model from _fuzz_data, and creates a request object from the parameters of the model.
Parameters: |
|
---|---|
Returns: | Tuple of (name, request, fuzz string, ImpactedParameter name) |
Return type: | tuple |
This section describes the representation of issues that are uncovered by Syntribos.
Object that encapsulates a security vulnerability
This object is designed to hold the metadata associated with a vulnerability.
Variables: |
|
---|
Convert the issue to a dict of values for outputting.
Return type: | dict |
---|---|
Returns: | dictionary of issue data |
Convert the request object to a dict of values for outputting.
Parameters: | req – The request object |
---|---|
Return type: | dict |
Returns: | dictionary of HTTP request data |
Convert the response object to a dict of values for outputting.
Parameters: | res – The result object |
---|---|
Return type: | dict |
Returns: | dictionary of HTTP response data |
This section describes the representation of results (collections of issues) from a given Syntribos run.
Custom unnittest results holder class
This class aggregates syntribos.issue.Issue objects from all the tests as they run
Duplicates parent class addError functionality.
Parameters: |
|
---|
Adds issues to data structures
Appends issues to the result’s list of failures, as well as to a dict of {url: {method: {test_name: issue}}} structure.
Parameters: |
|
---|
Print out each syntribos.issue.Issue that was encountered
Parameters: | output_format (str) – Either “json” or “xml” |
---|
Print errors when the test run is complete.
This section describes the components related to generating, fuzzing, and making HTTP requests.
Parse the body of the HTTP request (e.g. POST variables)
Parameters: | lines (list) – lines of the HTTP body |
---|---|
Returns: | object representation of body data (JSON or XML) |
Find and return headers in HTTP request
Parameters: | lines (str) – All but the first line of the HTTP request (list) |
---|---|
Return type: | dict |
Returns: | headers as key:value pairs |
Split first line of an HTTP request into its components
Parameters: |
|
---|---|
Return type: | tuple |
Returns: | HTTP method, URL, request parameters, HTTP version |
Parse external function calls in the body of request templates
Parameters: | string (str) – full HTTP request template as a string |
---|---|
Return type: | str |
Returns: | the request, with EXTERNAL calls filled in with their values or UUIDs |
Parse the HTTP request template into its components
Parameters: |
|
---|---|
Return type: | |
Returns: | RequestObject with method, url, params, etc. for use by runner |
alias of RequestObject
An object that holds information about an HTTP request.
Class that helps with fuzzing requests.
Fuzz a string.
Recursively fuzz variables in data and its children
Parameters: |
|
---|---|
Returns: | object or string with action_field fuzzed |
Return type: | dict OR str OR ElementTree.Element |
Run fuzz iterators for a dict type.
Run fuzz iterators for a list type.
Run fuzz iterators for an XML element type.
Replace various objects types with string representations.
Create a copy of self, and prepare it for use by a fuzzer
Returns: | Copy of request object that has been prepared for sending |
---|---|
Return type: | RequestHelperMixin |
Prepare a request for sending off
It should be noted this function does not make a request copy, destroying iterators in request. A copy should be made if making multiple requests.