Advertisement
Guest User

JNDI tree functions - Vulnerable tree node @params

a guest
May 17th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. @Abdelmoughite Eljoaydi
  3.  
  4. Vulnerable tree node @params (unsanitized) :
  5.  
  6. TreeNode() :
  7. ------------
  8. * The definition of a tree node. Used as a class object
  9. * @param nodeName : The name of the node
  10. * @param nodeUrl  : The target url when the node is clicked (Optional)
  11. * @param altText      : Text which will be shown as a popup when the mouse hovers on the folder
  12.  
  13. function TreeNode(nodeId, parent, nodeName, nodeUrl, iconSrcOpen, iconSrcClosed, popupId, altText, isOpen, hasChildren)
  14. {
  15. this.nodeId       = nodeId;
  16. this.parent       = parent;
  17. this.nodeName     = nodeName;         /** unsanitized User-Controlled data.
  18. this.nodeUrl      = nodeUrl;          /**
  19. this.nId = escapeQuotes(nodeId);     // escape the quotes out of the nodeId string.
  20. this.children     = new Array();
  21. this.hasChildren  = hasChildren;
  22. }
  23.  
  24. CreateTree(startNode) :
  25. ------------------------
  26. /**
  27. * Create the tree
  28. *
  29. * @param startNode   : The node which represents the start point of the tree. If not specified
  30. *                      The tree will start with the first node in the list.
  31. * addNode(parentNode, recursedNodes): function to add a new node in the tree.
  32. *
  33. */
  34.  
  35. function createTree(startNode)
  36. {
  37.  
  38.    preloadIcons();
  39.  
  40.    var node = null;
  41.    var sId = null;
  42.  
  43.    if (startNode != null)
  44.    {
  45.        node = startNode
  46.    } else {
  47.        // get the first node
  48.        if(nodes.length > 0)
  49.           node = nodes[0];
  50.    }
  51.  
  52.    if(node == null)
  53.       return; // nothing can be displayed in the tree.
  54.    
  55.    // if setLocal=true (Note : setLocal it's a variable which decides if the tree is going to expand locally or, if it needs to ask the  //server to get the data), load all the openNodes from cookie.
  56.    if (!isLocal)
  57.       retrieveOpenNodesFromCookie();
  58.    else
  59.       retrieveOpenNodesFromServer();
  60.  
  61.    highlightNode = false;
  62.    if(highlightedNodes != null && highlightedNodes[node.nodeId] != null)
  63.    {
  64.       highlightNode = true;
  65.    }
  66. /**
  67. *main @param node   : The TreeNode object to be written.
  68. *Write a unique node out using document.write. This method is called in case of using treenodes other than a Tree (ie in a list).
  69. **/
  70.    writeNode(node, node.iconSrcOpen, highlightNode, null, node.nodeName);
  71.    document.write('<br />');
  72.  
  73.   var recursedNodes = new Array();
  74.   addNode(node, recursedNodes);
  75.  
  76.   setTimeout(scrollToElement, 300);
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement