www.rodneybeede.com "I would love to change the world, but they won't give me the source code" - unknown
 Navigation

Convert Kismet netxml to csv - Last Modified 2012-06-22 21:47 UTC - Created 2012-06-22 21:46 UTC

The latest version drops CSV output support in Kismet. I just need some basic information for the scan results. A quick and easy way without having to write a script in Perl or Java was to use xslt transformation.
  1. Assuming Linux
  2. Install xsltproc
  3. Create the a file with the below contents and name it transform.xslt (or whatever):
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="text" encoding="utf-8" />
    
      <xsl:param name="delim" select="','" />
      <xsl:param name="quote" select="'&quot;'" />
      <xsl:param name="break" select="'&#xA;'" />
    
      <xsl:template match="/">
        <xsl:apply-templates select="detection-run/wireless-network" />
      </xsl:template>
    
      <xsl:template match="wireless-network">
        <xsl:apply-templates />
        <xsl:if test="following-sibling::*">
          <xsl:value-of select="$break" />
        </xsl:if>
      </xsl:template>
    
      <xsl:template match="*">
        <!-- remove normalize-space() if you want keep white-space at it is --> 
        <xsl:value-of select="concat($quote, normalize-space(), $quote)" />
        <xsl:if test="following-sibling::*">
          <xsl:value-of select="$delim" />
        </xsl:if>
      </xsl:template>
    
      <xsl:template match="text()" />
    </xsl:stylesheet>
  4. xsltproc -o MyKismitOutput.csv transform.xslt Kismet-yyyymmdd-hh-MM-ss-1.netxml