1.1.14. web_cloner
¶
This module contains the functionality used by the client to clone web pages.
1.1.14.1. Classes¶
-
class
ClonedResourceDetails
[source]¶ A named tuple which contains details regard a resource that has been cloned.
-
class
WebPageCloner
(target_url, dest_dir)[source]¶ Bases:
object
This object is used to clone web pages. It will use the WebKit2GTK+ engine and hook signals to detect what remote resources that are loaded from the target URL. These resources are then written to disk. Resources that have a MIME type of text/html have the King Phisher server javascript file patched in..
-
cloned_resources
= None[source]¶ A
collections.OrderedDict
instance ofClonedResourceDetails
keyed by the web resource they describe.
-
copy_resource_data
(resource, data)[source]¶ Copy the data from a loaded resource to a local file.
Parameters: - resource (
WebKit2.WebResource
) – The resource whose data is being copied. - data (bytes, str) – The raw data of the represented resource.
- resource (
-
patch_html
(data, encoding='utf-8')[source]¶ Patch the HTML data to include the King Phisher javascript resource. The script tag is inserted just before the closing head tag. If no head tag is present, the data is left unmodified.
Parameters: data (str) – The HTML data to patch. Returns: The patched HTML data. Return type: str
-