def handle_expand_url(mobj): domain = get_group('domain', mobj) if not domain: return mobj.group() add_ssrf_allowed_domain(domain) if 'https' in get_group('scheme', mobj) or force_https_domains == 'ALL': scheme_prefix = 'https-' else: scheme_prefix = '' return 'data-expanded-url="%s"' % ('/extdomains/' + scheme_prefix + domain + get_group('path', mobj))
def demo__handle_expand_url(mobj): import config from zmirror.zmirror import add_ssrf_allowed_domain, get_group domain = get_group('domain', mobj) if not domain: return mobj.group() add_ssrf_allowed_domain(domain) if 'https' in get_group('scheme', mobj) or config.force_https_domains == 'ALL': scheme_prefix = 'https-' else: scheme_prefix = '' return 'data-expanded-url="%s"' % ('/extdomains/' + scheme_prefix + domain + get_group('path', mobj))