403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/win_license.py
"""
Installation and activation of windows licenses
===============================================

Install and activate windows licenses

.. code-block:: yaml

    XXXXX-XXXXX-XXXXX-XXXXX-XXXXX:
      license.activate
"""

import logging

import salt.utils.platform

log = logging.getLogger(__name__)
__virtualname__ = "license"


def __virtual__():
    """
    Only work on Windows
    """
    if salt.utils.platform.is_windows():
        return __virtualname__
    return (False, "Only Windows OS supported")


def activate(name):
    """
    Install and activate the given product key

    name
        The 5x5 product key given to you by Microsoft

    """
    ret = {"name": name, "result": True, "comment": "", "changes": {}}

    product_key = name

    license_info = __salt__["license.info"]()
    licensed = False
    key_match = False
    if license_info is not None:
        licensed = license_info["licensed"]
        key_match = license_info["partial_key"] in product_key

    if not key_match:
        out = __salt__["license.install"](product_key)
        licensed = False
        if "successfully" not in out:
            ret["result"] = False
            ret["comment"] += "Unable to install the given product key is it valid?"
            return ret
    if not licensed:
        out = __salt__["license.activate"]()
        if "successfully" not in out:
            ret["result"] = False
            ret["comment"] += "Unable to activate the given product key."
            return ret
        ret["comment"] += "Windows is now activated."
    else:
        ret["comment"] += "Windows is already activated."
    return ret

Youez - 2016 - github.com/yon3zu
LinuXploit