XML to CSV
Hello!!
I have the following XML file (exported from nessus) and I want to convert it to CSV format.
<?xml version="1.0" ?>
<NessusClientData_v2>
<Policy>
<policyName>all</policyName>
<policyComments></policyComments>
<Preferences>
<ServerPreferences>
<preference>
<name>max_simult_tcp_sessions</name>
<value>unlimited</value>
</preference>
</ServerPreferences>
<PluginsPreferences>
<item>
<pluginName>Hydra: PostgreSQL</pluginName>
<pluginId>18660</pluginId>
<fullName>Hydra: PostgreSQL[entry]:Database name (optional) :</fullName>
<preferenceName>Database name (optional) :</preferenceName>
<preferenceType>entry</preferenceType>
<preferenceValues></preferenceValues>
<selectedValue></selectedValue>
</item>
</PluginsPreferences>
</Preferences>
<FamilySelection>
<FamilyItem>
<FamilyName>MacOS X Local Security Checks</FamilyName>
<Status>enabled</Status>
</FamilyItem>
</IndividualPluginSelection>
</Policy>
<Report name="internal_all_nessus">
<ReportHost name="10.0.0.80"><HostProperties>
<tag name="HOST_END">Tue Jun 28 14:25:11 2011</tag>
<tag name="mac-address">00:15:f9:f8:b0:27</tag>
<tag name="host-ip">10.0.0.80</tag>
<tag name="host-fqdn">SIP0015F9F8B027.lan</tag>
<tag name="HOST_START">Tue Jun 28 14:20:24 2011</tag>
</HostProperties>
<ReportItem port="23" svc_name="telnet" protocol="tcp" severity="0" pluginID="0" pluginName="" pluginFamily=""/>
<ReportItem port="5060" svc_name="sip" protocol="udp" severity="1" pluginID="21642" pluginName="Session Initiation Protocol Detection" pluginFamily="Service detection">
<solution>If possible, filter incoming connections to the port so that it is
used by trusted sources only.</solution><risk_factor>None</risk_factor><description>The remote system is running software that speaks the Session
Initiation Protocol.
SIP is a messaging protocol to initiate communication sessions between
systems. It is a protocol used mostly in IP Telephony networks /
systems to setup, control and teardown sessions between two or more
systems.</description><plugin_publication_date>2003/12/29</plugin_publication_date><synopsis>The remote system is a SIP signaling device.</synopsis><plugin_type>remote</plugin_type><see_also>http://en.wikipedia.org/wiki/Session_Initiation_Protocol</see_also><plugin_modification_date>2011/03/07</plugin_modification_date><plugin_output>
The remote service was identified as :
Cisco-CP7960G/8.0
It supports the following options :
ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTE R,UPDATE
</plugin_output>
<plugin_version>$Revision: 1.18 $</plugin_version></ReportItem>
</ReportHost>
</Report>
</NessusClientData_v2>
The .csv must llok like this:
Host,Synopsis,Description,Solution,Risk Factor,PluginID
... ... ... ... ... .. ..
My main problem is that certain tags (the <Report item> tag) contain some attributes and I need to the "value" of the attributes in my .csv file. I am a bit confused since I am new with xsl but it is urgent for to accomplish the transformation as soon as posible.
Any help is welcome :)
Thank you
|