<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do you search port ranges and match to service? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-search-port-ranges-and-match-to-service/m-p/421651#M121088</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I hope someone can help me?&lt;/P&gt;

&lt;P&gt;I'm looking to search through several port ranges and match against one or multiple services that the port ranges match.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;From_Port To_Port            Service
3600            3389                MySQL RDP
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Right now, my search is only matching on the first value which is MySQL and not MySQL and RDP.&lt;/P&gt;

&lt;P&gt;Does anyone have a smart way of doing this? I believe you can use a lookup, but you need to specific each port and the ranges are massive.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 10:24:50 GMT</pubDate>
    <dc:creator>MABurberry</dc:creator>
    <dc:date>2019-03-05T10:24:50Z</dc:date>
    <item>
      <title>How do you search port ranges and match to service?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-search-port-ranges-and-match-to-service/m-p/421651#M121088</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I hope someone can help me?&lt;/P&gt;

&lt;P&gt;I'm looking to search through several port ranges and match against one or multiple services that the port ranges match.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;From_Port To_Port            Service
3600            3389                MySQL RDP
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Right now, my search is only matching on the first value which is MySQL and not MySQL and RDP.&lt;/P&gt;

&lt;P&gt;Does anyone have a smart way of doing this? I believe you can use a lookup, but you need to specific each port and the ranges are massive.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 10:24:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-search-port-ranges-and-match-to-service/m-p/421651#M121088</guid>
      <dc:creator>MABurberry</dc:creator>
      <dc:date>2019-03-05T10:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do you search port ranges and match to service?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-search-port-ranges-and-match-to-service/m-p/421652#M121089</link>
      <description>&lt;P&gt;A lookup is a good approach for this - but yes you would need to specify each of the ports to make the reporting comprehensive, and there are a number of services which share ports with other applications. However you can download a ready made CSV list of all the assigned ports from here:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml"&gt;https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This would give you a head start, but if you have custom apps/services you may want to consider manually adding these to your lookup.&lt;/P&gt;

&lt;P&gt;Also - this file is quite big, so you may wish to consider loading it into KV store instead of a CSV lookup.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 10:49:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-search-port-ranges-and-match-to-service/m-p/421652#M121089</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-05T10:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you search port ranges and match to service?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-search-port-ranges-and-match-to-service/m-p/421653#M121090</link>
      <description>&lt;P&gt;Create a lookup called &lt;CODE&gt;AppPortLookup&lt;/CODE&gt; which has entries like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app    port
ssl    443,8443
http   80,443
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then, you can do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats summariesonly=true count min(_time) AS firstTime max(_time) AS lastTime 
FROM datamodel=Network_Traffic 
WHERE
   [|inputlookup AppPortLookup 
   | rename app AS All_Traffic.app
   | rename port AS All_Traffic.dest_port
   | format
   | rex field=search mode=sed "s/AND \"All_Traffic.dest_port\"=/AND NOT \"All_Traffic.dest_port\" IN(/g s/ \) /) ) /g s/,/\",\"/g" ]
BY All_Traffic.src_ip, All_Traffic.dest_ip, All_Traffic.app, All_Traffic.dest_port
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2019 05:43:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-search-port-ranges-and-match-to-service/m-p/421653#M121090</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-03-06T05:43:11Z</dc:date>
    </item>
  </channel>
</rss>

