Your IP : 216.73.216.247


Current Path : /opt/cpanel/
Upload File :
Current File : //opt/cpanel/test2.py

from pyepp import EppCommunicator
from pyepp.transport import EppMessage
import uuid
import os

# Path to your XML command file
xml_path = "info.xml"

# Configure EPP server connection details
config = {
    "server": "epp.zarc.net.za",
    "port": "700",
    # "client_cert": "/path/to/client.crt",
    # "client_key": "/path/to/client.key",
}

# Load XML and inject a unique clTRID
def load_and_prepare_xml(path):
    if not os.path.exists(path):
        raise FileNotFoundError(f"XML file not found: {path}")
    with open(path, "r", encoding="utf-8") as f:
        xml_data = f.read()
    return xml_data.replace("__CLTRID__", str(uuid.uuid4()))

# Main EPP flow
def main():
    epp = EppCommunicator(**config)
    try:
        print("[*] Connecting to EPP server...")
        epp.connect()
        print("[+] Connected.")

        print("[*] Logging in...")
        epp.login("enetworks", "36ancerg9a2")
        print("[+] Logged in.")

        greeting = epp.hello()
        print("[i] Server Greeting:\n", greeting.decode("utf-8"))

        # Read and send XML
        xml_to_send = load_and_prepare_xml(xml_path)
        print(f"[*] Sending EPP XML from {xml_path}...")
        msg = EppMessage(xml_to_send)
        response = epp.send(msg)
        print("[+] Server Response:\n", response.decode("utf-8"))

    except Exception as e:
        print(f"[!] Error: {e}")

    finally:
        try:
            print("[*] Logging out...")
            epp.logout()
            epp.disconnect()
            print("[+] Disconnected from EPP server.")
        except Exception:
            pass

if __name__ == "__main__":
    main()