From 49f4d631c6e298414b0e0dc2c885bed84572fa8d Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 29 Jan 2024 09:25:33 +0500 Subject: [PATCH] bug fix: https://github.com/usmannasir/cyberpanel/issues/1199 --- install/install.py | 2 +- plogical/test.py | 84 +++++++++++++++++++++++++++++---------------- plogical/upgrade.py | 2 +- 3 files changed, 57 insertions(+), 31 deletions(-) diff --git a/install/install.py b/install/install.py index 32fefe347..a8c0080f5 100755 --- a/install/install.py +++ b/install/install.py @@ -106,7 +106,7 @@ class preFlightsChecks: debug = 1 cyberPanelMirror = "mirror.cyberpanel.net/pip" cdn = 'cyberpanel.sh' - SnappyVersion = '2.32.0' + SnappyVersion = '2.33.0' def __init__(self, rootPath, ip, path, cwd, cyberPanelPath, distro, remotemysql=None, mysqlhost=None, mysqldb=None, mysqluser=None, mysqlpassword=None, mysqlport=None): diff --git a/plogical/test.py b/plogical/test.py index 22ead3191..b96c287bc 100644 --- a/plogical/test.py +++ b/plogical/test.py @@ -2,14 +2,34 @@ # import imaplib # import getpass # from email import message_from_string +# import socket +# +# import dns.resolver as dnspython +# +# def get_mx_records(domain): +# try: +# # Query MX records for the domain +# mx_records = dns.resolver.resolve(domain, 'MX') +# # Extract and return the MX record data +# return [(mx.exchange.to_text(), mx.preference) for mx in mx_records] +# except dns.resolver.NoAnswer: +# print(f"No MX records found for {domain}") +# return [] +# except dns.resolver.NXDOMAIN: +# print(f"Domain {domain} not found") +# return [] +# except Exception as e: +# print(f"Error: {str(e)}") +# return [] +# # # # IMAP server settings -# imap_server = 'mail.wpmautic.net' +# imap_server = '' # imap_port = 993 # # # User credentials -# email_address = 'usman@wpmautic.net' -# password = getpass.getpass("Enter your email password: ") +# +# # # # Connect to the IMAP server # mail = imaplib.IMAP4_SSL(imap_server, imap_port) @@ -29,39 +49,45 @@ # result, message_data = mail.fetch(email_id, "(BODY[HEADER.FIELDS (FROM TO SUBJECT DATE)])") # raw_email = message_data[0][1].decode('utf-8') # msg = message_from_string(raw_email) +# FromDomain = msg['From'].split('@')[1].rstrip('>') +# MailServer = get_mx_records(FromDomain) +# print(f'From Domain {FromDomain}') +# print(f'MX Records of the domains {MailServer}') +# print(f'Mail Server From Domain {MailServer}') # print(f"Email ID: {email_id}") # print(f"From: {msg['From']}") # print(f"To: {msg['To']}") # print(f"Subject: {msg['Subject']}") # print(f"Date: {msg['Date']}") # print("-" * 30) +# print(message_data) # # # Logout # mail.logout() -# -# # from cryptography import x509 -# # from cryptography.hazmat.backends import default_backend # # -# # def get_domains_covered(cert_path): -# # with open(cert_path, 'rb') as cert_file: -# # cert_data = cert_file.read() -# # cert = x509.load_pem_x509_certificate(cert_data, default_backend()) -# # -# # # Check for the Subject Alternative Name (SAN) extension -# # san_extension = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName) -# # -# # if san_extension: -# # # Extract and print the domains from SAN -# # san_domains = san_extension.value.get_values_for_type(x509.DNSName) -# # return san_domains -# # else: -# # # If SAN is not present, return the Common Name as a fallback -# # return [cert.subject.get_attributes_for_oid(x509.NameOID.COMMON_NAME)[0].value] -# # -# # # Example usage -# # cert_path = '/etc/letsencrypt/live/cyberplanner.io/fullchain.pem' -# # domains_covered = get_domains_covered(cert_path) -# # -# # print("Domains covered by the certificate:") -# # for domain in domains_covered: -# # print(domain) +# # # from cryptography import x509 +# # # from cryptography.hazmat.backends import default_backend +# # # +# # # def get_domains_covered(cert_path): +# # # with open(cert_path, 'rb') as cert_file: +# # # cert_data = cert_file.read() +# # # cert = x509.load_pem_x509_certificate(cert_data, default_backend()) +# # # +# # # # Check for the Subject Alternative Name (SAN) extension +# # # san_extension = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName) +# # # +# # # if san_extension: +# # # # Extract and print the domains from SAN +# # # san_domains = san_extension.value.get_values_for_type(x509.DNSName) +# # # return san_domains +# # # else: +# # # # If SAN is not present, return the Common Name as a fallback +# # # return [cert.subject.get_attributes_for_oid(x509.NameOID.COMMON_NAME)[0].value] +# # # +# # # # Example usage +# # # cert_path = '/etc/letsencrypt/live/cyberplanner.io/fullchain.pem' +# # # domains_covered = get_domains_covered(cert_path) +# # # +# # # print("Domains covered by the certificate:") +# # # for domain in domains_covered: +# # # print(domain) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index b7e1c1175..f30779703 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -39,7 +39,7 @@ class Upgrade: UbuntuPath = '/etc/lsb-release' openEulerPath = '/etc/openEuler-release' FromCloud = 0 - SnappyVersion = '2.32.0' + SnappyVersion = '2.33.0' LogPathNew = '/home/cyberpanel/upgrade_logs' SoftUpgrade = 0