Packages

  • package root

    This is documentation for Mothra, a collection of Scala and Spark library functions for working with Internet-related data.

    This is documentation for Mothra, a collection of Scala and Spark library functions for working with Internet-related data. Some modules contain APIs of general use to Scala programmers. Some modules make those tools more useful on Spark data-processing systems.

    Please see the documentation for the individual packages for more details on their use.

    Scala Packages

    These packages are useful in Scala code without involving Spark:

    org.cert.netsa.data

    This package, which is collected as the netsa-data library, provides types for working with various kinds of information:

    org.cert.netsa.io.ipfix

    The netsa-io-ipfix library provides tools for reading and writing IETF IPFIX data from various connections and files.

    org.cert.netsa.io.silk

    To read and write CERT NetSA SiLK file formats and configuration files, use the netsa-io-silk library.

    org.cert.netsa.util

    The "junk drawer" of netsa-util so far provides only two features: First, a method for equipping Scala scala.collection.Iterators with exception handling. And second, a way to query the versions of NetSA libraries present in a JVM at runtime.

    Spark Packages

    These packages require the use of Apache Spark:

    org.cert.netsa.mothra.datasources

    Spark datasources for CERT file types. This package contains utility features which add methods to Apache Spark DataFrameReader objects, allowing IPFIX and SiLK flows to be opened using simple spark.read... calls.

    The mothra-datasources library contains both IPFIX and SiLK functionality, while mothra-datasources-ipfix and mothra-datasources-silk contain only what's needed for the named datasource.

    org.cert.netsa.mothra.analysis

    A grab-bag of analysis helper functions and example analyses.

    org.cert.netsa.mothra.functions

    This single Scala object provides Spark SQL functions for working with network data. It is the entirety of the mothra-functions library.

    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package cert
    Definition Classes
    org
  • package netsa
    Definition Classes
    cert
  • package io
    Definition Classes
    netsa
  • package silk

    SiLK file formats, data types, and methods to read them, including support for reading them from Spark.

    SiLK file formats, data types, and methods to read them, including support for reading them from Spark.

    RWRec is the type of SiLK flow records.

    You can use RWRecReader to read SiLK files from Scala, including compressed files if Hadoop native libraries are available. For example:

    import org.cert.netsa.io.silk.RWRecReader
    import java.io.FileInputStream
    
    val inputFile = new FileInputStream("path/to/silk/rw/file")
    
    for ( rec <- RWRecReader.ofInputStream(inputFile) ) {
      println(rec.sIP)
    }
    Definition Classes
    io
    See also

    org.cert.netsa.mothra.datasources.silk.flow for working with SiLK data in Spark using the Mothra SiLK datasource.

  • package config
    Definition Classes
    silk
  • package io
    Definition Classes
    silk
  • BagDataType
  • BagReader
  • BagResult
  • BagWriter
  • CompressionMethod
  • FileFormat
  • FlowType
  • Header
  • HeaderEntry
  • IPSetReader
  • IPSetWriter
  • PrefixMapProtocolPortPair
  • PrefixMapReader
  • PrefixMapResult
  • RWRec
  • RWRecReader
  • RWRecWriter
  • Sensor
  • SilkConfig
  • SilkDataFormatException
  • SilkVersion
  • TCPState

abstract class IPSetReader extends Iterator[IPBlock]

A reader of binary SiLK IPset files. This is usable as an Iterator over IPBlock objects.

Example:
  1. This example uses the single argument form of the companion object's ofInputStream() method to read the IPset file "example.set"; the code may be used outside of Hadoop.

    val stream = new java.io.FileInputStream("example.set")
    val ipset = IPSetReader.ofInputStream(stream)
    ipset.hasNext
    val ipblock = ipset.next()
    println(ipblock.min + "/" + ipblock.prefixLength)
See also

the companion object for more details

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. IPSetReader
  2. Iterator
  3. IterableOnceOps
  4. IterableOnce
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new IPSetReader(reader: BufferReader, header: Header)
    Attributes
    protected

Type Members

  1. class GroupedIterator[B >: A] extends AbstractIterator[Seq[B]]
    Definition Classes
    Iterator

Abstract Value Members

  1. abstract def containsIPv6: Boolean

    Whether the IPSetReader returns an Iterator over IPv6Blocks or IPv4Blocks.

    Whether the IPSetReader returns an Iterator over IPv6Blocks or IPv4Blocks.

    returns

    true if the IPBlock objects are IPv6Block

  2. abstract def hasNext: Boolean

    Tests whether this iterator can provide another IPBlock.

    Tests whether this iterator can provide another IPBlock.

    returns

    true if a subsequent call to next() will yield an element, false otherwise.

    Definition Classes
    IPSetReader → Iterator
  3. abstract def next(): IPBlock

    Produces the next IPBlock of this iterator.

    Produces the next IPBlock of this iterator.

    returns

    the next IPBlock of this iterator if hasNext is true

    Definition Classes
    IPSetReader → Iterator
    Exceptions thrown

    java.util.NoSuchElementException when the iterator is depleted

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ++[B >: IPBlock](xs: => IterableOnce[B]): Iterator[B]
    Definition Classes
    Iterator
    Annotations
    @inline()
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final def addString(b: StringBuilder): StringBuilder
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  6. final def addString(b: StringBuilder, sep: String): StringBuilder
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  7. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder
    Definition Classes
    IterableOnceOps
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. val bitmap256Length: Int

    Octet-length of the 256-Bitmap

    Octet-length of the 256-Bitmap

    Attributes
    protected
  10. var bufOffset: Int

    Current position (octet offset) in the current buffer.

    Current position (octet offset) in the current buffer.

    Attributes
    protected[this]
  11. var buffer: Array[Byte]

    Current buffer of bytes being processed

    Current buffer of bytes being processed

    Attributes
    protected[this]
  12. def buffered: BufferedIterator[IPBlock]
    Definition Classes
    Iterator
  13. def checkAvailable(avail: Int): Boolean

    Return true if 'avail' octets are available in the buffer, reading more data from the stream if necessary.

    Return true if 'avail' octets are available in the buffer, reading more data from the stream if necessary.

    Attributes
    protected[this]
  14. val cidrBitmapFollows: Int

    For IPset file formats v4 and v5, a special value that indicates that a 256-long bitmap follows the IP address

    For IPset file formats v4 and v5, a special value that indicates that a 256-long bitmap follows the IP address

    Attributes
    protected
  15. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  16. def collect[B](pf: PartialFunction[IPBlock, B]): Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  17. def collectFirst[B](pf: PartialFunction[IPBlock, B]): Option[B]
    Definition Classes
    IterableOnceOps
  18. def concat[B >: IPBlock](xs: => IterableOnce[B]): Iterator[B]
    Definition Classes
    Iterator
  19. def contains(elem: Any): Boolean
    Definition Classes
    Iterator
  20. def copyToArray[B >: IPBlock](xs: Array[B], start: Int, len: Int): Int
    Definition Classes
    IterableOnceOps
  21. def copyToArray[B >: IPBlock](xs: Array[B], start: Int): Int
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecatedOverriding()
  22. def copyToArray[B >: IPBlock](xs: Array[B]): Int
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecatedOverriding()
  23. def corresponds[B](that: IterableOnce[B])(p: (IPBlock, B) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  24. def count(p: (IPBlock) => Boolean): Int
    Definition Classes
    IterableOnceOps
  25. def distinct: Iterator[IPBlock]
    Definition Classes
    Iterator
  26. def distinctBy[B](f: (IPBlock) => B): Iterator[IPBlock]
    Definition Classes
    Iterator
  27. def drop(n: Int): Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnceOps
  28. def dropWhile(p: (IPBlock) => Boolean): Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnceOps
  29. def duplicate: (Iterator[IPBlock], Iterator[IPBlock])
    Definition Classes
    Iterator
  30. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  31. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  32. def exists(p: (IPBlock) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  33. def filter(p: (IPBlock) => Boolean): Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnceOps
  34. def filterNot(p: (IPBlock) => Boolean): Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnceOps
  35. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  36. def find(p: (IPBlock) => Boolean): Option[IPBlock]
    Definition Classes
    IterableOnceOps
  37. def flatMap[B](f: (IPBlock) => IterableOnce[B]): Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  38. def flatten[B](implicit ev: (IPBlock) => IterableOnce[B]): Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  39. def fold[A1 >: IPBlock](z: A1)(op: (A1, A1) => A1): A1
    Definition Classes
    IterableOnceOps
  40. def foldLeft[B](z: B)(op: (B, IPBlock) => B): B
    Definition Classes
    IterableOnceOps
  41. def foldRight[B](z: B)(op: (IPBlock, B) => B): B
    Definition Classes
    IterableOnceOps
  42. def forall(p: (IPBlock) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  43. def foreach[U](f: (IPBlock) => U): Unit
    Definition Classes
    IterableOnceOps
  44. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  45. def grouped[B >: IPBlock](size: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  46. def handleBitmap256(buffer: Array[Byte], offset: Int, swap: Boolean): List[List[Int]]

    Return a List of Pairs of Integers.

    Return a List of Pairs of Integers.

    In each pair, the first value is a location of a high bit in the bitmap, and the second value is the number of consecutive high bits that is also a power of 2. The range of the first value is 0 to 255; the range of the seocond is 1 to 256.

    Attributes
    protected[this]
  47. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  48. val header: Header
    Attributes
    protected[this]
  49. def indexOf[B >: IPBlock](elem: B, from: Int): Int
    Definition Classes
    Iterator
  50. def indexOf[B >: IPBlock](elem: B): Int
    Definition Classes
    Iterator
  51. def indexWhere(p: (IPBlock) => Boolean, from: Int): Int
    Definition Classes
    Iterator
  52. def isEmpty: Boolean
    Definition Classes
    Iterator → IterableOnceOps
    Annotations
    @deprecatedOverriding()
  53. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  54. def isTraversableAgain: Boolean
    Definition Classes
    IterableOnceOps
  55. final def iterator: Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnce
    Annotations
    @inline()
  56. def knownSize: Int
    Definition Classes
    IterableOnce
  57. def lenToCidrV4(c: Int): Int

    Takes the number of consecutive high bits returned by handleBitmap256 and returns the CIDR prefix for IPv6 addresses.

    Takes the number of consecutive high bits returned by handleBitmap256 and returns the CIDR prefix for IPv6 addresses.

    Attributes
    protected[this]
  58. def lenToCidrV6(c: Int): Int

    Takes the number of consecutive high bits returned by handleBitmap256 and returns the CIDR prefix for IPv6 addresses.

    Takes the number of consecutive high bits returned by handleBitmap256 and returns the CIDR prefix for IPv6 addresses.

    Attributes
    protected[this]
  59. final def length: Int
    Definition Classes
    Iterator
    Annotations
    @inline()
  60. def map[B](f: (IPBlock) => B): Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  61. def max[B >: IPBlock](implicit ord: Ordering[B]): IPBlock
    Definition Classes
    IterableOnceOps
  62. def maxBy[B](f: (IPBlock) => B)(implicit cmp: Ordering[B]): IPBlock
    Definition Classes
    IterableOnceOps
  63. def maxByOption[B](f: (IPBlock) => B)(implicit cmp: Ordering[B]): Option[IPBlock]
    Definition Classes
    IterableOnceOps
  64. def maxOption[B >: IPBlock](implicit ord: Ordering[B]): Option[IPBlock]
    Definition Classes
    IterableOnceOps
  65. def min[B >: IPBlock](implicit ord: Ordering[B]): IPBlock
    Definition Classes
    IterableOnceOps
  66. def minBy[B](f: (IPBlock) => B)(implicit cmp: Ordering[B]): IPBlock
    Definition Classes
    IterableOnceOps
  67. def minByOption[B](f: (IPBlock) => B)(implicit cmp: Ordering[B]): Option[IPBlock]
    Definition Classes
    IterableOnceOps
  68. def minOption[B >: IPBlock](implicit ord: Ordering[B]): Option[IPBlock]
    Definition Classes
    IterableOnceOps
  69. final def mkString: String
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  70. final def mkString(sep: String): String
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  71. final def mkString(start: String, sep: String, end: String): String
    Definition Classes
    IterableOnceOps
  72. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  73. def nextOption(): Option[IPBlock]
    Definition Classes
    Iterator
  74. def nonEmpty: Boolean
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecatedOverriding()
  75. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  76. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  77. def padTo[B >: IPBlock](len: Int, elem: B): Iterator[B]
    Definition Classes
    Iterator
  78. def partition(p: (IPBlock) => Boolean): (Iterator[IPBlock], Iterator[IPBlock])
    Definition Classes
    Iterator
  79. def patch[B >: IPBlock](from: Int, patchElems: Iterator[B], replaced: Int): Iterator[B]
    Definition Classes
    Iterator
  80. def product[B >: IPBlock](implicit num: Numeric[B]): B
    Definition Classes
    IterableOnceOps
  81. val reader: BufferReader
    Attributes
    protected[this]
  82. def reduce[B >: IPBlock](op: (B, B) => B): B
    Definition Classes
    IterableOnceOps
  83. def reduceLeft[B >: IPBlock](op: (B, IPBlock) => B): B
    Definition Classes
    IterableOnceOps
  84. def reduceLeftOption[B >: IPBlock](op: (B, IPBlock) => B): Option[B]
    Definition Classes
    IterableOnceOps
  85. def reduceOption[B >: IPBlock](op: (B, B) => B): Option[B]
    Definition Classes
    IterableOnceOps
  86. def reduceRight[B >: IPBlock](op: (IPBlock, B) => B): B
    Definition Classes
    IterableOnceOps
  87. def reduceRightOption[B >: IPBlock](op: (IPBlock, B) => B): Option[B]
    Definition Classes
    IterableOnceOps
  88. def reversed: Iterable[IPBlock]
    Attributes
    protected
    Definition Classes
    IterableOnceOps
  89. def sameElements[B >: IPBlock](that: IterableOnce[B]): Boolean
    Definition Classes
    Iterator
  90. def scanLeft[B](z: B)(op: (B, IPBlock) => B): Iterator[B]
    Definition Classes
    Iterator → IterableOnceOps
  91. def size: Int
    Definition Classes
    IterableOnceOps
  92. def skipBytes(skipLen: Int): Unit

    Read and throw away 'skipLen' bytes from the stream.

    Read and throw away 'skipLen' bytes from the stream. An end-of-file error in this function is not caught.

    Attributes
    protected[this]
  93. def slice(from: Int, until: Int): Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnceOps
  94. def sliceIterator(from: Int, until: Int): Iterator[IPBlock]
    Attributes
    protected
    Definition Classes
    Iterator
  95. def sliding[B >: IPBlock](size: Int, step: Int): GroupedIterator[B]
    Definition Classes
    Iterator
  96. def span(p: (IPBlock) => Boolean): (Iterator[IPBlock], Iterator[IPBlock])
    Definition Classes
    Iterator → IterableOnceOps
  97. def splitAt(n: Int): (Iterator[IPBlock], Iterator[IPBlock])
    Definition Classes
    IterableOnceOps
  98. def stepper[S <: Stepper[_]](implicit shape: StepperShape[IPBlock, S]): S
    Definition Classes
    IterableOnce
  99. def sum[B >: IPBlock](implicit num: Numeric[B]): B
    Definition Classes
    IterableOnceOps
  100. val swap: Boolean

    Whether to byte-swap the bytes as they are read from the buffer

    Whether to byte-swap the bytes as they are read from the buffer

    Attributes
    protected[this]
  101. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  102. def take(n: Int): Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnceOps
  103. def takeWhile(p: (IPBlock) => Boolean): Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnceOps
  104. def tapEach[U](f: (IPBlock) => U): Iterator[IPBlock]
    Definition Classes
    Iterator → IterableOnceOps
  105. def to[C1](factory: Factory[IPBlock, C1]): C1
    Definition Classes
    IterableOnceOps
  106. def toArray[B >: IPBlock](implicit arg0: ClassTag[B]): Array[B]
    Definition Classes
    IterableOnceOps
  107. final def toBuffer[B >: IPBlock]: Buffer[B]
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  108. def toIndexedSeq: IndexedSeq[IPBlock]
    Definition Classes
    IterableOnceOps
  109. def toList: List[IPBlock]
    Definition Classes
    IterableOnceOps
  110. def toMap[K, V](implicit ev: <:<[IPBlock, (K, V)]): Map[K, V]
    Definition Classes
    IterableOnceOps
  111. def toSeq: Seq[IPBlock]
    Definition Classes
    IterableOnceOps
  112. def toSet[B >: IPBlock]: Set[B]
    Definition Classes
    IterableOnceOps
  113. def toString(): String
    Definition Classes
    Iterator → AnyRef → Any
  114. def toVector: Vector[IPBlock]
    Definition Classes
    IterableOnceOps
  115. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  116. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  117. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  118. def withFilter(p: (IPBlock) => Boolean): Iterator[IPBlock]
    Definition Classes
    Iterator
  119. def zip[B](that: IterableOnce[B]): Iterator[(IPBlock, B)]
    Definition Classes
    Iterator
  120. def zipAll[A1 >: IPBlock, B](that: IterableOnce[B], thisElem: A1, thatElem: B): Iterator[(A1, B)]
    Definition Classes
    Iterator
  121. def zipWithIndex: Iterator[(IPBlock, Int)]
    Definition Classes
    Iterator → IterableOnceOps

Deprecated Value Members

  1. final def /:[B](z: B)(op: (B, IPBlock) => B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use foldLeft instead of /:

  2. final def :\[B](z: B)(op: (IPBlock, B) => B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use foldRight instead of :\

  3. def aggregate[B](z: => B)(seqop: (B, IPBlock) => B, combop: (B, B) => B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) aggregate is not relevant for sequential collections. Use foldLeft(z)(seqop) instead.

  4. final def copyToBuffer[B >: IPBlock](dest: Buffer[B]): Unit
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use dest ++= coll instead

  5. final def hasDefiniteSize: Boolean
    Definition Classes
    Iterator → IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) hasDefiniteSize on Iterator is the same as isEmpty

  6. def scanRight[B](z: B)(op: (IPBlock, B) => B): Iterator[B]
    Definition Classes
    Iterator
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Call scanRight on an Iterable instead.

  7. def seq: IPSetReader.this.type
    Definition Classes
    Iterator
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Iterator.seq always returns the iterator itself

  8. final def toIterator: Iterator[IPBlock]
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use .iterator instead of .toIterator

  9. final def toStream: Stream[IPBlock]
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use .to(LazyList) instead of .toStream

Inherited from Iterator[IPBlock]

Inherited from IterableOnce[IPBlock]

Inherited from AnyRef

Inherited from Any

Ungrouped