473,569 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xml/xsl - grouping help

1 New Member
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 1409

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

Similar topics

2
1863
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 referrals
3
1805
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>. My XSL keeps returning zero for the count. The results for the XML/XSLT files below should look like:- Contact # of Visits ...
5
2159
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 it from a traditional programming point of view. I have did quite a bit of searching but have found no answers to my particular problem... please...
0
343
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 resulting node-set where these element values are the same. <SKU_INFO> <DETAIL_SEQ_NUMBER>11</DETAIL_SEQ_NUMBER> <SKU_TIE>1</SKU_TIE>...
2
1696
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 multiple nodes?" I will use an example to try to explain what I need to do and what I have for data. The example might not be very realistic but it's...
1
2071
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 am trying to generate a report. I have created a report that will show all the data. But I need to show either an empty group for the data on days...
3
2721
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 reports at the plan (overall totals), department and division levels which have sorting and grouping implemented with this new
8
3498
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 the moment the printed output is usually going to Word. It's turning into an unholy mess, because I'm having to prepare umpteen different Word...
0
1214
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 (grouping(dsd.Field1,'RETURNED', COUNT(*), 0)) Net1 , decode (grouping(dsd.field1,'COMPLETED', COUNT(*), 0)) Net2
0
1523
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 more information. 'de_AT.utf8' {'mon_decimal_point': ',', 'int_frac_digits': 2, 'p_sep_by_space': 1, 'frac_digits': 2, 'thousands_sep': '',...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.