Skip to content

Commit 01a522f

Browse files
committed
chg: [html_to_markdown] black fix
1 parent 52cda9c commit 01a522f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

misp_modules/modules/expansion/html_to_markdown.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
}
2828

2929

30-
3130
BLOCKED_RANGES = [
3231
ipaddress.ip_network("127.0.0.0/8"),
3332
ipaddress.ip_network("10.0.0.0/8"),
@@ -37,6 +36,7 @@
3736
ipaddress.ip_network("::1/128"),
3837
]
3938

39+
4040
def _is_ip_blocked(ip_str: str) -> bool:
4141
ip = ipaddress.ip_address(ip_str)
4242
return any(ip in net for net in BLOCKED_RANGES)
@@ -59,12 +59,14 @@ def is_safe_url(url: str) -> bool:
5959
except ValueError:
6060
return not _hostname_resolves_to_blocked_ip(parsed.hostname)
6161

62+
6263
def fetchHTML(url):
6364
if not is_safe_url(url):
6465
raise ValueError(f"Blocked URL: {url}")
6566
r = requests.get(url, timeout=10)
6667
return r.text
6768

69+
6870
def stripUselessTags(html):
6971
soup = BeautifulSoup(html, "html.parser")
7072
toRemove = ["script", "head", "header", "footer", "meta", "link"]

0 commit comments

Comments
 (0)