import pymysql,sys
c=pymysql.connect(host="10.0.0.11",port=3306,user="java_osc",password="56Wp96Z6bS3kBpBf",database="oscdb",connect_timeout=4,read_timeout=10,write_timeout=10,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])
small=[]
for t in tables:
    try:
        cur.execute("SELECT COUNT(*) FROM `%s`"%t); n=cur.fetchone()[0]
        if n<100: small.append((t,n))
    except Exception: pass
print("SMALL",small[:200])
c.close()
