DiscoveryFunctions - findNodeValueWithAttribute(Object node, String attrName)

Finds the node value with a specified attribute.

Table 1. Parameters
Name Type Description
node Object The current node
attrName String The attribute for which to search
Table 2. Returns
Type Description
Object The node array, if found; otherwise, returns null.

Example payload:
<results probe_time="6313">
  <result>
    <Registry>
       <entry key="HKEY_LOCAL_MACHINE">
          <entry key="Software">
             <entry key="Microsoft">
                <entry key="Windows">
                    <entry key="Name">
                        <value>Just a name</value>
                     </entry>
                  </entry>
               </entry>
            </entry>
         </entry>
      </Registry>
    </entry>
</results>
 
 // To find the value of the key called "name", here's how these methods can be used.
 // registry is a variable representing the payload
 var node = findRegistryNode(registry, "HKEY_LOCAL_MACHINE.Software.Microsoft");
 var name = findNodeValueWithAttribute(node, "Name");