⚝
One Hat Cyber Team
⚝
Your IP:
18.190.157.16
Server IP:
162.254.39.145
Server:
Linux premium289.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
View File Name :
NCSentry.py
#!/opt/hc_python/bin/python3 import os import warnings import importlib.metadata as metadata import sentry_sdk from packaging.version import Version class NCSentry: """ Simple Wrapper sentry = NCSentry() After successfully inited class we can use Sentry debug system: Report to Sentry: SentryClient.capture_message("test") SentryClient.capture_exception(Exception("MyAwesomeString")) """ __conflict_under_version = "0.19.2" def __init__(self, config_dir=None): self.sentry_args = {} if config_dir: dir_path = config_dir else: dir_path = os.path.dirname(os.path.realpath(__file__)) self.conf_path = os.path.join(dir_path, ".sentry.conf") self.construct_args() with open(self.conf_path) as fh: self.dsn = fh.read().strip() self.client = sentry_sdk.init(self.dsn, **self.sentry_args) self.capture_message = sentry_sdk.capture_message self.capture_exception = sentry_sdk.capture_exception def construct_args(self): try: dist_version_str = metadata.version("sentry-sdk") installed_version = Version(dist_version_str) conflict_version = Version(self.__conflict_under_version) if installed_version >= conflict_version: self.sentry_args["traces_sample_rate"] = 0 except Exception as err: warnings.warn(f"Can't set up sentry default args properly: {err}")