28 lines
782 B
Python
28 lines
782 B
Python
import subprocess
|
|
import os
|
|
|
|
edge_path = r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
|
|
out_png = os.path.abspath("docs/snarfnet_homelab_topology.png")
|
|
html_url = "file:///" + os.path.abspath("docs/snarfnet_homelab_topology.html").replace("\\", "/")
|
|
|
|
cmd = [
|
|
edge_path,
|
|
"--headless",
|
|
"--disable-gpu",
|
|
"--no-sandbox",
|
|
"--hide-scrollbars",
|
|
"--window-size=1920,2400",
|
|
f"--screenshot={out_png}",
|
|
html_url
|
|
]
|
|
|
|
print("Running cmd:", " ".join(cmd))
|
|
res = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
|
|
print("Return code:", res.returncode)
|
|
print("Stdout:", res.stdout)
|
|
print("Stderr:", res.stderr)
|
|
print("File exists?", os.path.exists(out_png))
|
|
if os.path.exists(out_png):
|
|
print("File size:", os.path.getsize(out_png))
|
|
|