Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > lvestats > lib > > chart
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 20275 bytes | May 30 2025 10:30:46. | |
dbgovchartmain.py | File | 4466 bytes | May 30 2025 10:30:46. | |
lvechartmain.py | File | 15782 bytes | May 30 2025 10:30:46. | |
polysimplify.py | File | 7555 bytes | May 30 2025 10:30:46. | |
rdp.py | File | 1434 bytes | May 30 2025 10:30:46. | |
svg2png.py | File | 3216 bytes | May 30 2025 10:30:46. | |
svggraph.py | File | 21226 bytes | May 30 2025 10:30:46. | |
util.py | File | 484 bytes | May 30 2025 10:30:46. |
# coding=utf-8 # # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2025 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT import os import subprocess from typing import Optional def svg_to_png(svg_data: str) -> bytes: """ Converts SVG data to PNG format using available converters. Args: svg_data (str): The SVG data to convert. Returns: bytes: The converted PNG data. Raises: RuntimeError: If no suitable converter is found. """ # alt-ImageMagick is preferred over the native ImageMagick and rsvg. alt_imagemagick = _get_alt_imagemagick_binary() if alt_imagemagick: return _convert_with_imagemagick(svg_data, alt_imagemagick) rsvg_convert = _get_rsvg_convert_binary() if rsvg_convert: return _convert_with_rsvg(svg_data, rsvg_convert) imagemagick = _get_imagemagick_binary() if imagemagick: return _convert_with_imagemagick(svg_data, imagemagick) raise RuntimeError("No suitable SVG to PNG converter found") def _get_alt_imagemagick_binary() -> Optional[str]: """ Returns the path to the alt-ImageMagick binary if it exists, otherwise None. """ alt_imagemagick = "/opt/alt/alt-ImageMagick/usr/bin/magick" if os.path.exists(alt_imagemagick): return alt_imagemagick return None def _get_imagemagick_binary() -> Optional[str]: """ Returns the path to the ImageMagick binary if it exists, otherwise None. """ native_imagemagick = "/usr/bin/convert" if os.path.exists(native_imagemagick): return native_imagemagick return None def _get_rsvg_convert_binary() -> Optional[str]: """ Returns the path to the rsvg-convert binary if it exists, otherwise None. """ rsvg_convert = "/usr/bin/rsvg-convert" if os.path.exists(rsvg_convert): return rsvg_convert return None def _convert_with_rsvg(svg_data: str, rsvg_convert: str) -> bytes: """ Converts SVG data to PNG format using rsvg-convert. Args: svg_data (str): The SVG data to convert. rsvg_convert (str): The path to the rsvg-convert binary. Returns: bytes: The converted PNG data. """ cwd = '/var/lve/tmp' if os.getuid() == 0 else None with subprocess.Popen( [rsvg_convert, "-f", "png", "-b", "rgba(255, 255, 255, 255)"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=cwd ) as proc: png_data, _ = proc.communicate(input=svg_data.encode()) return png_data def _convert_with_imagemagick(svg_data: str, imagemagick: str) -> bytes: """ Converts SVG data to PNG format using ImageMagick. Args: svg_data (str): The SVG data to convert. imagemagick (str): The path to the ImageMagick binary. Returns: bytes: The converted PNG data. """ cwd = '/var/lve/tmp' if os.getuid() == 0 else None with subprocess.Popen( [imagemagick, "-", "png:-"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=cwd ) as proc: png_data, _ = proc.communicate(input=svg_data.encode()) return png_data
SILENT KILLER Tool