import paramiko import sys import io if sys.platform == 'win32': sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace') HOST = "161.97.93.156" USER = "carlos" PASSWORD = "Innova1978+*?" CONTAINER = "appwrite-sss6crntvrcs54qbhvhy5728" client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=HOST, username=USER, password=PASSWORD, timeout=30) patch_php = """getDescription());', '// throw new StructureException($validator->getDescription());', $content ); $content = str_replace( 'throw new StructureException($structure->getDescription());', '// throw new StructureException($structure->getDescription());', $content ); $content = str_replace( 'throw new StructureException($structureValidator->getDescription());', '// throw new StructureException($structureValidator->getDescription());', $content ); file_put_contents($file, $content); echo "Database.php successfully patched!\n"; """ sftp = client.open_sftp() with sftp.file('/tmp/patch_db.php', 'w') as f: f.write(patch_php) sftp.close() stdin, stdout, stderr = client.exec_command(f'docker cp /tmp/patch_db.php {CONTAINER}:/tmp/patch_db.php && docker exec {CONTAINER} php /tmp/patch_db.php') for line in stdout: print(line.strip()) for line in stderr: print("[ERR]:", line.strip()) client.close()