authcaptureproxy.examples.modifiers
¶
Python Package for auth capture proxy.
Example modifiers.
Module Contents¶
-
authcaptureproxy.examples.modifiers.
autofill
(items: dict, html: Text) → Text¶ Autofill input tags in form.
WARNING: This modifier does not obfuscate debug logs.
- Parameters
items (dict) – Dictionary of values to fill. The key the name or id of the form input to fill and the value is the value.
html (Text) – html to convert
- Returns
html with values filled in
- Return type
Text
-
async
authcaptureproxy.examples.modifiers.
replace_matching_urls
(old_url: yarl.URL, new_url: yarl.URL, html: Text) → Text¶ Replace urls or parts of a url.
- Parameters
old_url (URL) – Old url to find and replace. If there is any additional path, it will be added to the new_url.
new_url (URL) – New url to replace.
html (Text) – Text to replace
- Returns
Replaced text
- Return type
Text
-
async
authcaptureproxy.examples.modifiers.
replace_empty_action_urls
(new_url: yarl.URL, html: Text) → Text¶ Replace urls of empty action attributes.
For example, <form id=”form” method=”post” novalidate action=””>
- Parameters
new_url (URL) – New url to replace.
html (Text) – Text to replace
- Returns
Replaced text
- Return type
Text
-
async
authcaptureproxy.examples.modifiers.
prepend_relative_urls
(base_url: yarl.URL, html: Text) → Text¶ Prepend relative urls with url host.
This is intended to be used for to place the proxy_url in front of relative urls in src=”/
- Parameters
base_url (URL) – Base URL to prepend
html (Text) – Text to replace
- Returns
Replaced text
- Return type
Text
-
async
authcaptureproxy.examples.modifiers.
find_regex_urls
(modifier: Optional[Callable] = None, patterns: Dict[Text, Text] = None, html: Text = '') → Text¶ Find urls for based on regex.
Seen in Tesla login with MFA enabled.
- Parameters
modifier (Optional[Callable], optional) – The function to call. It will take in the html_tag, tag, and attribute and modify the html_tag. Defaults to None.
patterns ([Dict[Text,Text]) – A dictionary of regex patterns to search. Key is name and value is regex string.
html (Text, optional) – Text to replace. Defaults to “”.
- Returns
Text after applying the modifier to the urls found using the search.
- Return type
Text
-
async
authcaptureproxy.examples.modifiers.
find_urls_bs4
(modifier: Optional[Callable] = None, search: Dict[Text, Text] = None, exceptions: Dict[Text, List[Text]] = None, html: Text = '') → Text¶ Find urls in html using bs4.
This function will search using beautifulsoup.find_all() and then apply the modifier function to the found url.
- Parameters
modifier (Optional[Callable], optional) – The function to call. It will take in the html_tag, tag, and attribute and modify the html_tag. Defaults to None.
search (Dict[Text, Text], optional) – Search dictionary where keys is a tag and the value is an attribute. Defaults to {}.
exceptions (Dict[Text, List[Text]], optional) – Exceptions dictionary where keys is a tag and the value is a url to not modify. Defaults to {}.
html (Text, optional) – Text to replace. Defaults to “”.
- Returns
Text after applying the modifier to the urls found using the search.
- Return type
Text