🐍Python

The Panda Authentication System is designed to seamlessly integrate with Python development, offering robust user authentication and security features. Tailored specifically for Python developers, Panda Authentication provides easy implementation of user registration, login, and key management functionalities. Whether you're building a web service or an application, Panda Authentication ensures smooth integration and enhanced security for your users.

⚠️ WARNING: This Documentation is Outdated. We're currently Updating the Library for New Python Version.

Python Code / Documentation:

import requests
import hashlib

#Replace the Identifier with your own identifier
identifier = "pandadevkit" 

#Get your API Token on Hub Settings (Required) For Security only
APIToken = ""

#--------------------------------------------------
# We use IP Address as our HWID, You can replace it with UUID / Hardware ID & etc as long you
# have knowledge of Python.
#--------------------------------------------------
def fetch_ip():
    response = requests.get(f"https://pandadevelopment.net/serviceapi?service={identifier}&command=getuseripaddress")
    if response.status_code == 200:
        return response.text.strip()  # Return the raw text response
    else:
        return None

def hash_ip(ip_address):
    return hashlib.sha256(ip_address.encode()).hexdigest()
#--------------------------------------------------
#Function ( Get the Key URL )
#--------------------------------------------------
def generate_key():
    hwid = hash_ip(fetch_ip())
    url = f"https://pandadevelopment.net/getkey?hwid={hwid}&service={identifier}"
    return url

#--------------------------------------------------
#Function ( Validate the Key alongside with the Hardware ID )   
#--------------------------------------------------
def validate_key_hwid(key, hwid):
    url = f"https://pandadevelopment.net/v2_validation?hwid={hwid}&service={identifier}&key={key}"
    response = requests.get(url)
    if response.status_code == 200:
        print("Raw response from validate_key_hwid:", response.text)  # Debugging line
        try:
            return response.json()
        except requests.exceptions.JSONDecodeError as e:
            print("JSON decode error:", e)
            return None
    else:
        return None
#--------------------------------------------------
#Example Code ( You can run this on console )
#--------------------------------------------------
def main():
    print("Generated Key URL: " + generate_key())
    key = input("Enter your key: ")
    hwid = hash_ip(fetch_ip())

    validation_response = validate_key_hwid(key, hwid)
    if validation_response:
        v2_authentication = validation_response.get("V2_Authentication", "Not Found")
        key_info = validation_response.get("Key_Information", {})
        expires_at = key_info.get("expiresAt", "Not Found")
        premium_mode = key_info.get("Premium_Mode", "Not Found")

        print(f"V2_Authentication: {v2_authentication}")
        print(f"Expires At: {expires_at}")
        print(f"Premium Mode: {premium_mode}")
    else:
        print("Failed to validate key and HWID.")

if __name__ == "__main__":
    main()

Last updated