160 lines
6.2 KiB
Plaintext
160 lines
6.2 KiB
Plaintext
from playwright.sync_api import sync_playwright
|
|
import time
|
|
import re
|
|
from playwright.sync_api import sync_playwright, TimeoutError as PWTimeout
|
|
|
|
|
|
|
|
|
|
def rabbitmq_screenshot(url, username, password, selector, service):
|
|
|
|
output = "service_" + service + ".png"
|
|
|
|
with sync_playwright() as pw:
|
|
ctx = pw.chromium.launch(headless=True).new_context(ignore_https_errors=True)
|
|
page = ctx.new_page()
|
|
page.goto(url)
|
|
print("Current URL:", page.url)
|
|
|
|
page.fill('input[name="username"]', username)
|
|
page.fill('input[name="password"]', password)
|
|
try:
|
|
page.click('input[type="submit"]')
|
|
except:
|
|
page.click('button[type="submit"]')
|
|
|
|
page.wait_for_selector(selector)
|
|
|
|
time.sleep(2)
|
|
page.locator(selector).screenshot(path=output)
|
|
print(f"Saved screenshot: {output}")
|
|
|
|
|
|
def observium_screenshot(url, username, password,service):
|
|
output = "service_" + service + ".png"
|
|
|
|
with sync_playwright() as pw:
|
|
ctx = pw.chromium.launch(headless=True).new_context(ignore_https_errors=True, viewport={"width": 1920, "height": 1080})
|
|
page = ctx.new_page()
|
|
page.goto(url)
|
|
|
|
page.fill('input[name="username"]', username)
|
|
page.fill('input[name="password"]', password)
|
|
page.click('button[id="submit"]')
|
|
|
|
|
|
|
|
|
|
page.wait_for_selector(".container")
|
|
|
|
memory_url = "http://observium.brilliant.com.bd/health/metric=mempool/view=detail/device_id=37,40,67,70,72,77,83,84,86,87,95,96,99,103,105,52,106,107,115,31,85,108,50,121/mempool_descr=physical/requesttoken=f092f74f574a9770add7846d444d8ebc6af52ae93e958d41b252c439b48262b1/"
|
|
page.goto(memory_url, wait_until="networkidle")
|
|
|
|
page.wait_for_selector("table.table", timeout=20000)
|
|
|
|
page.locator("table.table-condensed").screenshot(path="service_observium_memory.png")
|
|
|
|
|
|
def firewall_screenshot(url, username, password, service="firewall"):
|
|
output = "service_" + service + ".png"
|
|
with sync_playwright() as pw:
|
|
ctx = pw.chromium.launch(headless=True).new_context(ignore_https_errors=True, viewport={"width": 1920, "height": 1080})
|
|
page = ctx.new_page()
|
|
page.goto(url)
|
|
|
|
page.fill('input[name="username"]', username)
|
|
page.fill('input[name="secretkey"]', password)
|
|
page.click('button[type="button"]')
|
|
time.sleep(5)
|
|
dashbaord_url = "https://118.67.210.46/ng/system/dashboard/2?vdom=IC-CLOUD"
|
|
page.goto(dashbaord_url, wait_until="networkidle")
|
|
page.wait_for_selector("ul.module-list", timeout=20000)
|
|
|
|
page.screenshot(path=output, full_page=True)
|
|
|
|
def sfssd_screenshot(url, username="admin", password="sL1dSt0gE719", service="sfssd"):
|
|
output = "service_" + service + ".png"
|
|
with sync_playwright() as pw:
|
|
ctx = pw.chromium.launch(headless=True).new_context(ignore_https_errors=True, viewport={"width": 1920, "height": 1080}, http_credentials={"username": username, "password": password})
|
|
page = ctx.new_page()
|
|
page.goto(url)
|
|
|
|
page.wait_for_selector("#reporting-overview", timeout=20000)
|
|
time.sleep(15)
|
|
|
|
page.screenshot(path=output, full_page=True)
|
|
|
|
def NVMe_screenshot(url, username='admin', password='sL1dSt0gE2022', service="nvme"):
|
|
output = "service" + service + ".png"
|
|
with sync_playwright() as pw:
|
|
browser = pw.chromium.launch(headless=True)
|
|
ctx = browser.new_context(ignore_https_errors=True, viewport={"width": 1920, "height": 1080})
|
|
page = ctx.new_page()
|
|
page.goto(url)
|
|
|
|
page.fill('input[name="username"]', username)
|
|
page.fill('input[name="password"]', password)
|
|
page.click('button[type="submit"]')
|
|
page.locator('[data-netapp-id="capacity-bar"]').click()
|
|
|
|
page.screenshot(path=output, full_page=True)
|
|
|
|
time.sleep(10)
|
|
|
|
def ceph_df_screenshot(ip, username='mosiur', password="123Rashik456", service="ceph"):
|
|
output = "service_" + service + ".png"
|
|
url = f"https://{ip}:9090"
|
|
with sync_playwright() as pw:
|
|
ctx = pw.chromium.launch(headless=True).new_context(ignore_https_errors=True, viewport={"width": 1920, "height": 1080})
|
|
page = ctx.new_page()
|
|
page.goto(url)
|
|
|
|
page.fill('input[id="login-user-input"]', username)
|
|
page.fill('input[id="login-password-input"]', password)
|
|
page.click('button[type="submit"]')
|
|
# page.wait_for_load_state("networkidle")
|
|
time.sleep(5)
|
|
page.goto("https://172.20.151.21:9090/system/terminal")
|
|
# page.wait_for_selector("#content iframe", timeout=20000)
|
|
terminal = page.frame_locator("iframe[title='Terminal'], iframe[name='cockpit1:localhost/system/terminal']")
|
|
# terminal.locator("#the-terminal").click()
|
|
terminal.locator("body").click()
|
|
time.sleep(2)
|
|
|
|
page.keyboard.type('source controller_creds')
|
|
page.keyboard.press("Enter")
|
|
page.keyboard.type('clear')
|
|
page.keyboard.press("Enter")
|
|
page.keyboard.type('scon1 ceph df && scon1 ceph -s')
|
|
page.keyboard.press("Enter")
|
|
time.sleep(5)
|
|
|
|
terminal.locator("body").screenshot(path=output)
|
|
|
|
################################################################################################
|
|
wsl_ip = input("Enter WSL IP address: ")
|
|
url = "http://118.67.215.11:15672/#/"
|
|
username = "guest"
|
|
password = "guest"
|
|
selector = "#main"
|
|
print("Starting screenshot capture...")
|
|
print("Capturing RabbitMQ screenshot...")
|
|
rabbitmq_screenshot(url, username, password, selector, "rmq")
|
|
print("RabbitMQ screenshot captured.")
|
|
print("Capturing Observium screenshot...")
|
|
observium_screenshot("http://observium.brilliant.com.bd/", "admin", "0ObBs5e3rv!iuUm@#@!", "observium")
|
|
print("Observium screenshot captured.")
|
|
print("Capturing Firewall screenshot...")
|
|
firewall_screenshot("https://118.67.210.46/login", "mosiur", "AD^%$bhy34Fw26@mnf234@97tr45")
|
|
print("Firewall screenshot captured.")
|
|
print("Capturing SFSSD screenshot...")
|
|
sfssd_screenshot("https://192.168.12.2/")
|
|
print("SFSSD screenshot captured.")
|
|
print("Capturing NVMe screenshot...")
|
|
NVMe_screenshot("https://192.168.12.20/sysmgr/v4/")
|
|
print("NVMe screenshot captured.")
|
|
print("Capturing Ceph screenshot...")
|
|
ceph_df_screenshot(wsl_ip)
|
|
# mail
|
|
# cPanel
|
|
# ownCloud |