/usr/share/wireshark/pdml2html.xsl is in libwireshark-data 1.8.2-5wheezy18.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | <?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This XSLT will convert a PDML file, saved by Wireshark, into
HTML. The HTML page should look like Wireshark. For questions contact
Dirk Jagdmann (doj@cubic.org).
Version: 2010-06-09 -->
<!-- set parameters of the HTML output -->
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="no" standalone="yes" indent="yes"/>
<!-- this matches the "field" tag -->
<xsl:template match="field">
    <!-- indent with 3 non-breaking spaces -->
<!-- output either the "showname" or "show" attribute -->
<xsl:choose>
<xsl:when test="string-length(@showname)>0">
<xsl:value-of select="@showname"/><br/>
</xsl:when>
<xsl:otherwise>
<!--<xsl:value-of select="@name"/>:--> <xsl:value-of select="@show"/><br/>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/> <!-- we expect to match "field" tags -->
</xsl:template>
<!-- this matches the "packet" tag -->
<xsl:template match="packet">
<!-- declare some variables for later use -->
<xsl:variable name="frame_num" select="proto[@name='frame']/field[@name='frame.number']/@show"/>
<xsl:variable name="frame_id" select="concat('f',$frame_num)"/>
<xsl:variable name="frame_c" select="concat($frame_id,'c')"/>
<!-- the "title" bar of the frame -->
<div width="100%" id="{$frame_id}">
<a href="javascript:toggle_node('{$frame_c}')">⇒</a> <!-- #8658 is a "rArr" (double right arrow) character -->
Frame <xsl:value-of select="$frame_num"/>:
<xsl:for-each select="proto[@name!='geninfo']">
<xsl:value-of select="@name"/>,
</xsl:for-each>
<small><a href="javascript:hide_node('{$frame_id}')">[X]</a></small>
</div>
<!-- the frame contents are stored in a div, so we can toggle it -->
<div width="100%" id="{$frame_c}" style="display:none">
<!-- loop trough all proto tags, but skip the "geninfo" one -->
<xsl:for-each select="proto[@name!='geninfo']">
<xsl:variable name="proto" select="concat($frame_id,@name)"/>
<!-- the "title" bar of the proto -->
<div width="100%" style="background-color:#e5e5e5; margin-bottom: 2px">
 <a href="javascript:toggle_node('{$proto}')">⇒</a> <xsl:value-of select="@showname"/>
<!-- print "proto" details inside another div -->
<div width="100%" id="{$proto}" style="display:none">
<xsl:apply-templates/> <!-- we expect to match "field" tags -->
</div>
</div>
</xsl:for-each>
</div>
<!-- use the javascript function set_node_color() to set the color
of the frame title bar. Defer colorization until the full page has
been loaded. If the browser would support the XPath function
replace() we could simply set the class attribute of the title bar div,
but for now we're stuck with class names from Wireshark's colorfilters
that contain spaces and we can't handle them in CSS. -->
<script type="text/javascript">
dojo.addOnLoad(function(){
set_node_color(
'<xsl:value-of select="$frame_id"/>',
'<xsl:value-of select="proto[@name='frame']/field[@name='frame.coloring_rule.name']/@show"/>'
);
});
</script>
</xsl:template>
<xsl:template match="pdml">
Capture Filename: <b><xsl:value-of select="@capture_file"/></b>
PDML created: <b><xsl:value-of select="@time"/></b>
<tt>
<xsl:apply-templates/> <!-- we expect to match the "packet" nodes -->
</tt>
</xsl:template>
<!-- this block matches the start of the PDML file -->
<xsl:template match="/">
<html>
<head>
<title>poor man's Wireshark</title>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js" type="text/javascript"></script>
<script type="text/javascript">
function set_node(node, str)
{
if(dojo.isString(node))
node = dojo.byId(node);
if(!node) return;
node.style.display = str;
}
function toggle_node(node)
{
if(dojo.isString(node))
node = dojo.byId(node);
if(!node) return;
set_node(node, (node.style.display != 'none') ? 'none' : 'block');
}
function hide_node(node)
{
set_node(node, 'none');
}
// this function was generated by colorfilters2js.pl
function set_node_color(node,colorname)
{
if(dojo.isString(node))
node = dojo.byId(node);
if(!node) return;
var fg;
var bg;
if(colorname == 'Bad TCP') {
bg='#000000';
fg='#ff5f5f';
}
if(colorname == 'HSRP State Change') {
bg='#000000';
fg='#fff600';
}
if(colorname == 'Spanning Tree Topology Change') {
bg='#000000';
fg='#fff600';
}
if(colorname == 'OSPF State Change') {
bg='#000000';
fg='#fff600';
}
if(colorname == 'ICMP errors') {
bg='#000000';
fg='#00ff0e';
}
if(colorname == 'ARP') {
bg='#d6e8ff';
fg='#000000';
}
if(colorname == 'ICMP') {
bg='#c2c2ff';
fg='#000000';
}
if(colorname == 'TCP RST') {
bg='#900000';
fg='#fff680';
}
if(colorname == 'TTL low or unexpected') {
bg='#900000';
fg='#ffffff';
}
if(colorname == 'Checksum Errors') {
bg='#000000';
fg='#ff5f5f';
}
if(colorname == 'SMB') {
bg='#fffa99';
fg='#000000';
}
if(colorname == 'HTTP') {
bg='#8dff7f';
fg='#000000';
}
if(colorname == 'IPX') {
bg='#ffe3e5';
fg='#000000';
}
if(colorname == 'DCERPC') {
bg='#c797ff';
fg='#000000';
}
if(colorname == 'Routing') {
bg='#fff3d6';
fg='#000000';
}
if(colorname == 'TCP SYN/FIN') {
bg='#a0a0a0';
fg='#000000';
}
if(colorname == 'TCP') {
bg='#e7e6ff';
fg='#000000';
}
if(colorname == 'UDP') {
bg='#70e0ff';
fg='#000000';
}
if(colorname == 'Broadcast') {
bg='#ffffff';
fg='#808080';
}
if(fg.length > 0)
node.style.color = fg;
if(bg.length > 0)
node.style.background = bg;
}
</script>
</head>
<body>
<xsl:apply-templates/> <!-- we expect to match the "pdml" node -->
</body>
</html>
</xsl:template>
</xsl:stylesheet>
|