add web
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import psycopg2
|
||||
from datetime import datetime
|
||||
|
||||
conn_params = {
|
||||
'dbname': 'syntaxdb',
|
||||
'user': 'syntax',
|
||||
'password': 'PjZqyvUWXgmp6g3gMqJPYqZz5YpnhXbCjVsAMdoyuuvmCKNxtE7EQgGWUTFXNtJsoKf73w9hHNFRM6fFqGmH946cbJLNjAjaUQ0z',
|
||||
'host': '127.0.0.1',
|
||||
'port': '5432'
|
||||
}
|
||||
# dat aint my db pass so its calm
|
||||
def modify_database_schema():
|
||||
try:
|
||||
conn = psycopg2.connect(**conn_params)
|
||||
conn.autocommit = False
|
||||
cur = conn.cursor()
|
||||
|
||||
|
||||
print("Adding full_3dcontenthash column to user_thumbnail table...")
|
||||
try:
|
||||
cur.execute("""
|
||||
ALTER TABLE user_thumbnail
|
||||
ADD COLUMN IF NOT EXISTS full_3dcontenthash VARCHAR(512);
|
||||
""")
|
||||
print("Added full_3dcontenthash column")
|
||||
except Exception as e:
|
||||
print(f"Error adding full_3dcontenthash column: {e}")
|
||||
|
||||
conn.commit()
|
||||
print(f"Successfully updated database schema at {datetime.now()}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Migration failed: {e}")
|
||||
conn.rollback()
|
||||
raise
|
||||
finally:
|
||||
if 'cur' in locals(): cur.close()
|
||||
if 'conn' in locals(): conn.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
modify_database_schema()
|
||||
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
Generates 3 types of keypairs required by SYNTAX backend
|
||||
|
||||
- 1024 bit RSA key for clients that used rbxsig
|
||||
- 2048 bit RSA key for clients that used rbxsig2 and newer
|
||||
- 2048 bit RSA key for gameserver communication and authentication
|
||||
|
||||
These keys will be saved in the same directory as this script
|
||||
"""
|
||||
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
|
||||
def generate_key( key_size : int, priv_key_name : str, pub_key_name : str ) -> None:
|
||||
"""
|
||||
Generates a private key and saves it to a file
|
||||
|
||||
:param key_size: The size of the key to generate
|
||||
:param key_name: The name of the file to save the key to
|
||||
"""
|
||||
private_key = rsa.generate_private_key(
|
||||
public_exponent=65537,
|
||||
key_size=key_size,
|
||||
backend=default_backend()
|
||||
)
|
||||
|
||||
with open( priv_key_name, "wb" ) as f:
|
||||
f.write(
|
||||
private_key.private_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PrivateFormat.TraditionalOpenSSL,
|
||||
encryption_algorithm=serialization.NoEncryption()
|
||||
)
|
||||
)
|
||||
|
||||
with open( pub_key_name, "wb" ) as f:
|
||||
f.write(
|
||||
private_key.public_key().public_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PublicFormat.SubjectPublicKeyInfo
|
||||
)
|
||||
)
|
||||
|
||||
generate_key( 1024, "rsa_private_1024.pem", "rsa_public_1024.pub" )
|
||||
generate_key( 2048, "rsa_private_2048.pem", "rsa_public_2048.pub")
|
||||
generate_key( 2048, "rsa_private_gameserver.pem", "rsa_public_gameserver.pub")
|
||||
Reference in New Issue
Block a user