473,326 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

xml/xsl - grouping help

Hi,

I want to revise the nmap.xsl so that it would display IP addresses if a host has at least one port is opened AND group each IP into a group based on a SSH server. Here is the output that I want to get:

Open SSH:
Show each host’s IP address & host name in hyperlink that has at least one port is opened and it is running Open SSH
.....
BitWise:

F-secure:

Others SSH:

Here is the original nmap.xsl which displays all of the scanned host’s ip addresses.
Expand|Select|Wrap|Line Numbers
  1. <xsl:for-each select="host">
  2. <xsl:sort select="substring ( address/@addr, 1, string-length ( sub string-before ( address/@addr, '.' ) ) )* (256*256*256) + substring ( substring-after (address/@addr, '.' ), 1, string-length ( substring-before ( substring-after ( address/@addr, '.' ), '.' ) ) )* (256*256) + substring ( substring-after (substring-after ( address/@addr, '.' ), '.' ), 1, string-length ( substring-before ( substring-after ( substring-after (address/@addr, '.' ), '.' ), '.' ) ) ) * 256 + substring ( substring-after ( substring-after ( substring-after ( address/@addr, '.' ), '.' ), '.' ), 1 )" order="ascending" data-type="number"/>
  3.  
  4. <li>
  5. <xsl:element name="a">
  6.  
  7. <xsl:attribute name="href">#<xsl:value-of select="translate(address/@addr, '.', '_') " /></xsl:attribute>
  8.  
  9.       <xsl:attribute name="class">      
  10. <xsl:choose>
  11.                   <xsl:when test="status/@state ='up'">green</xsl:when>
  12.                   <xsl:otherwise>red</xsl:otherwise>
  13. </xsl:choose>
  14.     </xsl:attribute>
  15.  
  16.    <xsl:value-of select="address/@addr"/>
  17.  
  18.    <xsl:if test="count(hostnames/hostname) > 0">
  19.    <xsl:for-each select="hostnames/hostname">
  20.        <xsl:sort select="@name" order="ascending" data-type="text"/>
  21.        <xsl:text> / </xsl:text><xsl:value-of select="@name"/>
  22.    </xsl:for-each></xsl:if>
  23.  
  24.    </xsl:element>
  25.    <xsl:text> | </xsl:text>
  26. </li></xsl:for-each>

Couple examples of XML output:
Expand|Select|Wrap|Line Numbers
  1. <host><status state="up" />
  2. <address addr="150.215.20.5" addrtype="ipv4" />
  3. <hostnames />
  4. <ports><extraports state="unknown" count="0" />
  5. <port protocol="tcp" portid="22"><state state="open" /><service name="ssh" product="OpenSSH" version="1.2.3" extrainfo="protocol 1.5" method="probed" conf="10"/>
  6. </port>
  7. <port protocol="tcp" portid="2220"><state state="closed" /></port>
  8. <port protocol="tcp" portid="2260"><state state="closed" /></port>
  9. <port protocol="tcp" portid="2280"><state state="closed" /></port>
  10. </ports>
  11. </host>
Expand|Select|Wrap|Line Numbers
  1. <host><status state="up" />
  2. <address addr="150.215.20.40" addrtype="ipv4" />
  3. <hostnames />
  4. <ports><extraports state="unknown" count="0" />
  5. <port protocol="tcp" portid="22"><state state="open" /><service name="ssh" product="SunSSH" version="1.1" extrainfo="protocol 2.0" method="probed" conf="10" />
  6. </port>
  7. <port protocol="tcp" portid="2220"><state state="closed" /></port>
  8. <port protocol="tcp" portid="2260"><state state="closed" /></port>
  9. <port protocol="tcp" portid="2280"><state state="closed" /></port>
  10. </ports>
Any help is appreciated!!! Thank you very much.

Summer
Sep 18 '06 #1
0 1398

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Debbie Davis | last post by:
Hi there, SQL 2000 I have the following query: SELECT sponsor, COUNT(sponsor) * 2 AS total FROM Referrals GROUP BY sponsor Works great, returns the sponsor and the total * 2 of their...
3
by: Graham | last post by:
Hi, I am having trouble getting XSL to count the members of a group. What I am trying to do is group by <objectid.Contactid> and count the number of <activityid>'s for each <objectid.contactid>....
5
by: Jody Greening | last post by:
Transforming with XSLT, Grouping elements until difference found. I am seeking some help with the following problem, I am fairly new at XSLT transformations, and my problem may lie in looking at...
0
by: MEC6304 | last post by:
I have the following fragment repeated mulitple times and need to sum the SKU_QUANTITY and transform the XML based upon a grouping of the SKU_TIE, SKU_NUMBER, and MFG_PART_NUM, ie display the...
2
by: Andreas Håkansson | last post by:
Seeing how my previous post seem to have fallen between the cracks, I thought I would have a second, more direct, go at it. So my question is "Is it possible to group (Muenchian method) over...
1
by: Brian Coy | last post by:
I am creating a database to track scrap on a daily basis at my plant. I have to provide a weekly scrap report with the amount of each part scrapped per day. I have the basic database set up, and...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
0
by: Corey | last post by:
hello, I’m trying to run a query and I’m getting error messages Can anyone help me get though this problem? 1: Tried this and got this error message ORA-00923 , decode...
0
by: Roman Bertle | last post by:
Hello, I try to format monetary values using the locale module, python2.5: Python 2.5.2a0 (r251:54863, Jan 3 2008, 17:59:56) on linux2 Type "help", "copyright", "credits" or "license" for...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.