notebookvb
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
"""
|
||||
MailStore Server API Explorer
|
||||
Připojí se k API, zjistí konfiguraci a vypíše klíčové info.
|
||||
Spusť: python explore_api.py
|
||||
"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
import base64
|
||||
import urllib3
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
# ── Konfigurace ───────────────────────────────────────────────
|
||||
HOST = "https://192.168.1.53:8463" # nebo https://mailstore.buzalka.cz pokud funguje
|
||||
USER = "admin"
|
||||
PASS = "*$N(B)vMUym!%"
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
|
||||
session = requests.Session()
|
||||
session.auth = (USER, PASS)
|
||||
session.verify = False
|
||||
session.headers.update({"Content-Type": "application/x-www-form-urlencoded"})
|
||||
|
||||
|
||||
def call(fn, **params):
|
||||
r = session.post(f"{HOST}/api/invoke/{fn}", data=params or {})
|
||||
r.raise_for_status()
|
||||
data = r.json()
|
||||
if data.get("error"):
|
||||
raise Exception(data["error"]["message"])
|
||||
return data.get("result")
|
||||
|
||||
|
||||
def pp(label, data):
|
||||
print(f"\n{'='*60}")
|
||||
print(f" {label}")
|
||||
print('='*60)
|
||||
print(json.dumps(data, indent=2, ensure_ascii=False, default=str))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Připojuji se k MailStore API...")
|
||||
|
||||
# 1. Server info
|
||||
info = call("GetServerInfo")
|
||||
pp("Server Info", info)
|
||||
|
||||
# 2. Všechny dostupné API funkce
|
||||
r = session.post(f"{HOST}/api/get-metadata")
|
||||
metadata = r.json()
|
||||
fn_names = [f["name"] for f in metadata.get("functions", [])]
|
||||
pp("Dostupné API funkce", fn_names)
|
||||
|
||||
# 3. Uživatelé
|
||||
users = call("GetUsers")
|
||||
pp("Uživatelé", users)
|
||||
|
||||
# 4. Archive stores (úložiště)
|
||||
stores = call("GetStoreInfos")
|
||||
pp("Archive Stores (úložiště)", stores)
|
||||
|
||||
# 5. Archivační profily
|
||||
try:
|
||||
profiles = call("GetProfiles")
|
||||
pp("Archivační profily", profiles)
|
||||
except Exception as e:
|
||||
print(f"\nProfily: {e}")
|
||||
|
||||
# 6. Složky (mailboxes) pro admin uživatele
|
||||
try:
|
||||
folders = call("GetFolderStatistics")
|
||||
pp("Folder statistiky", folders)
|
||||
except Exception as e:
|
||||
print(f"\nFolder stats: {e}")
|
||||
|
||||
print("\n\nHotovo. Zkopíruj výstup výše a pošli mi ho.")
|
||||
Reference in New Issue
Block a user