Client credentials and change root password

This commit is contained in:
Gent Semaj 2024-01-26 14:57:33 -05:00
parent 7922fc060a
commit 4196766a2b
Signed by untrusted user: ycc
GPG Key ID: 2D76C57BF6BEADC4

View File

@ -179,6 +179,7 @@ def main(conn, xdt_path):
for table_name in root: for table_name in root:
if "Table" in table_name: if "Table" in table_name:
process_xdt_table(cursor, root, table_name, mappings) process_xdt_table(cursor, root, table_name, mappings)
finalize(cursor)
conn.commit() conn.commit()
def connect_to_db(): def connect_to_db():
@ -192,10 +193,18 @@ def connect_to_db():
def prep_db(): def prep_db():
conn = connect_to_db() conn = connect_to_db()
cursor = conn.cursor() cursor = conn.cursor()
# we have to upload a lot of data, so we need to raise the limit
cursor.execute("SET GLOBAL max_allowed_packet=1073741824") cursor.execute("SET GLOBAL max_allowed_packet=1073741824")
conn.commit() conn.commit()
conn.close() conn.close()
def finalize(cursor):
# credentials used by the game
cursor.execute("GRANT SELECT ON XDB.* TO 'cmog' IDENTIFIED BY 'scooby'")
# change the root password to something more secure
new_root_pw = input("Enter new root password: ")
cursor.execute(f"SET PASSWORD = PASSWORD('{new_root_pw}')")
# %% # %%
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) != 2: if len(sys.argv) != 2: