MCPcopy
hub / github.com/mitmproxy/mitmproxy / replace

Method replace

examples/contrib/webscanner_helper/mapping.py:95–101  ·  view source on GitHub ↗

Replaces the content of soup that matches the css selector with the given replace content.

(
        self, soup: BeautifulSoup, css_sel: str, replace: BeautifulSoup
    )

Source from the content-addressed store, hash-verified

93 self.persistent = updated[self.OPT_MAP_PERSISTENT]
94
95 def replace(
96 self, soup: BeautifulSoup, css_sel: str, replace: BeautifulSoup
97 ) -> None:
98 """Replaces the content of soup that matches the css selector with the given replace content."""
99 for content in soup.select(css_sel):
100 self.logger.debug(f'replace "{content}" with "{replace}"')
101 content.replace_with(copy.copy(replace))
102
103 def apply_template(
104 self, soup: BeautifulSoup, template: dict[str, BeautifulSoup]

Callers 11

apply_templateMethod · 0.95
_init_transformationsMethod · 0.45
test_get_XSS_infoMethod · 0.45
__call__Method · 0.45
responseFunction · 0.45
responseFunction · 0.45
injectMethod · 0.45
modifyFunction · 0.45
responseFunction · 0.45
tcp_messageFunction · 0.45

Calls 3

selectMethod · 0.45
debugMethod · 0.45
copyMethod · 0.45

Tested by 1

test_get_XSS_infoMethod · 0.36