fluidasserts.helper.http module

This module provide support for HTTP connections.

exception fluidasserts.helper.http.ConnError

Bases: Exception

A connection error occurred.

errors = (<class 'requests.exceptions.ChunkedEncodingError'>, <class 'requests.exceptions.ConnectTimeout'>, <class 'requests.exceptions.ConnectionError'>, <class 'requests.exceptions.ContentDecodingError'>, <class 'requests.exceptions.HTTPError'>, <class 'requests.exceptions.ProxyError'>, <class 'requests.exceptions.ReadTimeout'>, <class 'requests.exceptions.RetryError'>, <class 'requests.exceptions.SSLError'>, <class 'requests.exceptions.StreamConsumedError'>, <class 'requests.exceptions.Timeout'>, <class 'requests.exceptions.TooManyRedirects'>, <class 'requests.exceptions.UnrewindableBodyError'>)
class fluidasserts.helper.http.HTTPSession(url, params=None, headers=None, method=None, cookies=None, data='', json=None, files=None, auth=None, redirect=True, timeout=10.0, stream=False, request_at_instantiation=True)

Bases: object

Class of HTTP request objects.

Construct method.

Parameters
add_unit(*, is_vulnerable, specific=None)

Append a new fluidasserts.Unit object to this session.

Return type

None

do_request()

Do HTTP request.

Return type

typing.Optional[requests.models.Response]

formauth_by_response(text)

Authenticate using regex as verification.

Parameters

text (str) – Regex to look for in request response.

Return type

requests.models.Response

get_fingerprint()

Get HTTP fingerprint.

Return type

typing.Optional[dict]

Returns

A dict containing the SHA and banner of the host, as per Service.get_fingerprint().

get_html_value(field_type, field_name, field_id='name', field='value')

Get a value from an HTML field.

Parameters
  • field_type (str) – Name of HTML tag type to look for, e.g. script.

  • field (typing.Optional[str]) – Name of field, e.g. type.

  • enc – Whether to URL-encode the results.

Return type

str

get_tuple_result()

Return a typing.Tuple version of the results object.

Return type

typing.Tuple[str, str, typing.List[fluidasserts.Unit], typing.List[fluidasserts.Unit]]

set_messages(*, source, msg_open, msg_closed)

Set the open and closed msg attributes for this session.

exception fluidasserts.helper.http.ParameterError

Bases: Exception

A parameter (user input) error occurred.

errors = (<class 'requests.exceptions.URLRequired'>, <class 'requests.exceptions.InvalidHeader'>, <class 'requests.exceptions.InvalidProxyURL'>, <class 'requests.exceptions.InvalidSchema'>, <class 'requests.exceptions.InvalidURL'>, <class 'requests.exceptions.MissingSchema'>)
class fluidasserts.helper.http.WebBot(developer_mode=False, implicitly_wait=8.0)

Bases: object

HTTP Automation Bot.

WebBot Constructor.

Parameters
  • implicitly_wait (float) – How many seconds will the Bot poll the DOM when trying to find any element (or elements) not immediately available.

  • developer_mode (bool) – When set to True you’ll get usefull messages to aid in the development of exploits, (it logs to console).

click_by_human_text(identifier)

Click an element identifying it by the visible text.

Click an element identifying it by its link text.

click_by_name(identifier)

Click an element identifying it by its name.

Click an element identifying it by its partial link text.

fill_by_class_name(identifier, fill_with)

Fill an element identifying it by its class name.

fill_by_css_selector(identifier, fill_with)

Fill an element identifying it by its css selector.

fill_by_id(identifier, fill_with)

Fill an element identifying it by its id.

Fill an element identifying it by its link text.

fill_by_name(identifier, fill_with)

Fill an element identifying it by its name.

Fill an element identifying it by partial link text.

fill_by_xpath(identifier, fill_with)

Fill an element identifying it by its xpath.

get_clickables()

Print a list of possible elements to click.

Return type

typing.Tuple[dict, …]

Return a cookie in the current session.

get_cookies()

Return all cookies in the current session.

get_cookies_as_dict()

Return all cookies in the current session as a dictionary.

Return type

typing.Dict[str, str]

get_cookies_as_jar()

Return all cookies in the current session as a RequestsCookieJar.

Return type

requests.cookies.RequestsCookieJar

get_fillables(show_hidden=False)

Print a list of possible fields to fill.

Return type

typing.Tuple[dict]

get_source()

Return the current page source code.

Return type

str

send_enter()

Send an Enter to the current active element.

show_me()

Take an snapshot and display it in the default image viewer.

visit(url)

Visit a url.

wait(seconds)

Wait seconds seconds.

Return type

typing.NoReturn