com.martealert
Class martealertUtils

java.lang.Object
  extended bycom.martealert.martealertUtils
All Implemented Interfaces:
martealertConstants

public class martealertUtils
extends java.lang.Object
implements martealertConstants


Field Summary
protected static java.lang.String _
           
 
Fields inherited from interface com.martealert.martealertConstants
AMBIGUOUS_FIELDS, ANALYZER, CLASSIFICATION, COMPLETION, FTS, FTSTZ, HOUR_IN_MILLIS, INTERVAL, IPADDRS, LASTJOIN, LTS, LTSTZ, MAXMSGID, MAXSEVERITY, MFTS, MLTS, MSGID, MSOURCEPORT, NALERTS, NOTNULL_FIELDS, NULL_FIELDS, NXCLASSIFICATION, ORDER_BY_ALERTS, ORDER_BY_MAXTIME, ORDER_BY_TIME, PRELUDE_TABLES, PROTOCOL, SENSOR, SEVERITY, SEVERITY_COMPLETION, SOURCE, SOURCEIP, SOURCEPORT, SOURCEUID, TARGET, TARGETIP, TARGETPORT, TARGETPORT_PROTOCOL, TARGETUID, TERMINAL, TIME, TIMETZ, TLAST, TOP, TOTALTIME
 
Constructor Summary
martealertUtils()
           
 
Method Summary
static void beep()
          It sounds a speaker beep.
static int confirmDialogYesNo(java.awt.Component parent, java.lang.String text)
          Get confirmation message after having clicked on a confirm dialog window with yes and no options.
static int confirmDialogYesNoCancel(java.awt.Component parent, java.lang.String text)
          Get confirmation message after having clicked on a confirm dialog window with yes, no and cancel options.
static java.lang.String dialog(java.awt.Component parent, java.lang.String titulo)
          Shows a question-message dialog requesting input from the user parented to parentComponent.
static java.lang.String dialog(java.awt.Component parent, java.lang.String titulo, java.lang.String inicial)
          Shows a question-message dialog requesting input from the user parented to parentComponent.
static void error(java.awt.Component parent, java.lang.String s)
          Show an error message passed as param s in advanced filter dialog, with an error icon.
protected static java.lang.String getClassificationFilter(java.lang.String classifValue, java.lang.String advancedFilter)
          Get a filter for classification field, which is the only field whose values can content spaces.
static java.lang.String getSourceAddrFilter(java.lang.String sourceIPaddr, java.lang.String operator)
          Get a filter for source address field, giving sourceIP value and logic operator.
static java.lang.String getTargetAddrFilter(java.lang.String sourceIPaddr, java.lang.String targetIPaddr, java.lang.String operator)
          Get a filter for target address field, giving targetIP value and logic operator.
static void information(java.awt.Component parent, java.lang.String s)
          Show an info message passed as param s in advanced filter dialog, with an info icon.
static boolean isValidIpAddr(java.lang.String value)
          Return if an IPv4 address is valid or not.
static int max(int[] tab)
          Calculate maximum value of int[]tab and return it.
static java.sql.Timestamp maxDate(java.util.Vector row)
          Return maximum Date in sql.Timestamp format from a Timestamp vector given.
static java.lang.String maxSeverity(java.util.Vector row)
          Return maximum severity of a Vector.
static int min(int[] tab)
          Calculate minimum value of int[]tab and return it.
static java.sql.Timestamp minDate(java.util.Vector row)
          Return minimum Date in sql.Timestamp format from a Timestamp vector given.
static int nOcurrences(java.lang.String str, java.lang.String c)
          Count number of ocurrences of c in string str.
static java.util.Vector toVector(java.lang.String[] st)
          Convert an array to Vector.
protected static java.lang.String unComile(java.lang.String s)
          Quit comiles of string s, in case that exist.
static java.lang.String unconcatNx(java.lang.String NxClassification)
          Return a String from classification field without number of ocurrences.
static java.lang.String uniSpaced(java.lang.String s)
          Format a String using regular expressions: [ ]* for 0 or more spaces.
static java.lang.String unSplit(java.lang.String[] st, java.lang.String separator)
          It makes unSplit of String[]st and separator
static java.lang.String unSplit(java.lang.String[] st, java.lang.String separator, boolean includesep)
          It makes unSplit of String[]st and separator if includesep is True.
static java.lang.String unSplit(java.util.Vector v, java.lang.String separator)
          It makes unSplit of Vector v and separator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_

protected static final java.lang.String _
See Also:
Constant Field Values
Constructor Detail

martealertUtils

public martealertUtils()
Method Detail

getSourceAddrFilter

public static java.lang.String getSourceAddrFilter(java.lang.String sourceIPaddr,
                                                   java.lang.String operator)
Get a filter for source address field, giving sourceIP value and logic operator.

Parameters:
sourceIPaddr - String with source IP value.
operator - Logic operator: AND, OR.
Returns:
String with filter value including NULL instead default value 127.0.0.1.

getTargetAddrFilter

public static java.lang.String getTargetAddrFilter(java.lang.String sourceIPaddr,
                                                   java.lang.String targetIPaddr,
                                                   java.lang.String operator)
Get a filter for target address field, giving targetIP value and logic operator.

Parameters:
sourceIPaddr - String with source IP value.
targetIPaddr - String with target IP value.
operator - Logic operator: AND, OR.
Returns:
String with filter value including NULL instead default value 127.0.0.1.

getClassificationFilter

protected static java.lang.String getClassificationFilter(java.lang.String classifValue,
                                                          java.lang.String advancedFilter)
Get a filter for classification field, which is the only field whose values can content spaces.

Parameters:
classifValue - String with value without comile: "Admin login successful"
advancedFilter - String component of advanced filter.
Returns:
String with filter component correct format to apply filter.

maxDate

public static java.sql.Timestamp maxDate(java.util.Vector row)
Return maximum Date in sql.Timestamp format from a Timestamp vector given.

Parameters:
row - Vector of Timestamps to calculate maximum date.
Returns:
Timestamp with maximum date.

minDate

public static java.sql.Timestamp minDate(java.util.Vector row)
Return minimum Date in sql.Timestamp format from a Timestamp vector given.

Parameters:
row - Vector of Timestamps to calculate minimum date.
Returns:
Timestamp with minimum date.

unComile

protected static java.lang.String unComile(java.lang.String s)
Quit comiles of string s, in case that exist.

Parameters:
s - String to be uncomiled
Returns:
String without comile at the beginning and end.

min

public static int min(int[] tab)
Calculate minimum value of int[]tab and return it.

Parameters:
tab - array of int to calculate minimum value.
Returns:
minimum value of array passed as param.

max

public static int max(int[] tab)
Calculate maximum value of int[]tab and return it.

Parameters:
tab - array of int to calculate maximum value.
Returns:
maximum value of array passed as param.

unconcatNx

public static java.lang.String unconcatNx(java.lang.String NxClassification)
Return a String from classification field without number of ocurrences.

Parameters:
NxClassification - String with number of ocurrences and log type info.
Returns:
Log type from a String with following format: "N x Log_type" --> "Log_type"

maxSeverity

public static java.lang.String maxSeverity(java.util.Vector row)
Return maximum severity of a Vector.

Parameters:
row - Vector to calculate max severity among its components.
Returns:
String with maximum Severity.

nOcurrences

public static int nOcurrences(java.lang.String str,
                              java.lang.String c)
Count number of ocurrences of c in string str.

Parameters:
str - String where c is counted.
c - String to be found in str for count ocurrences.
Returns:
number of ocurrences.

isValidIpAddr

public static boolean isValidIpAddr(java.lang.String value)
Return if an IPv4 address is valid or not.

Parameters:
value - String with inet address.
Returns:
boolean true if it's valid or false if value has not an ip valid syntax.

error

public static void error(java.awt.Component parent,
                         java.lang.String s)
Show an error message passed as param s in advanced filter dialog, with an error icon.

Parameters:
parent - Component parent of martealertAdvancedFilterView dialog.
s - Error message to show

information

public static void information(java.awt.Component parent,
                               java.lang.String s)
Show an info message passed as param s in advanced filter dialog, with an info icon.

Parameters:
parent - Component parent of martealertAdvancedFilterView dialog.
s - Info message to show.

confirmDialogYesNoCancel

public static int confirmDialogYesNoCancel(java.awt.Component parent,
                                           java.lang.String text)
Get confirmation message after having clicked on a confirm dialog window with yes, no and cancel options.

Parameters:
parent - Component parent of advanced filter dialog.
text - Message to be shown.
Returns:
int with option selected: yes, no, cancel.

confirmDialogYesNo

public static int confirmDialogYesNo(java.awt.Component parent,
                                     java.lang.String text)
Get confirmation message after having clicked on a confirm dialog window with yes and no options.

Parameters:
parent - Component parent of advanced filter dialog.
text - Message to be shown.
Returns:
int with option selected: yes, no.

dialog

public static java.lang.String dialog(java.awt.Component parent,
                                      java.lang.String titulo)
Shows a question-message dialog requesting input from the user parented to parentComponent. The dialog is displayed on top of the Component's frame, and is usually positioned below the Component.

Parameters:
parent - Component parent object.
titulo - String to show.

dialog

public static java.lang.String dialog(java.awt.Component parent,
                                      java.lang.String titulo,
                                      java.lang.String inicial)
Shows a question-message dialog requesting input from the user parented to parentComponent. The dialog is displayed on top of the Component's frame, and is usually positioned below the Component.

Parameters:
parent - Component parent object.
titulo - String to show.
inicial - Value used to initialize input field.

beep

public static void beep()
It sounds a speaker beep.


uniSpaced

public static java.lang.String uniSpaced(java.lang.String s)
Format a String using regular expressions:
  • [ ]* for 0 or more spaces.
  • [ ]+ for 1 or more spaces.
  • [ ]? for only 1 space and it's optional.
  • Parameters:
    s - String to be formatted.
    Returns:
    String with word separated by only one space. Furthermore, brackets are not separated from the words.
    example: s = " ( word1 word2   word3) word4 "
    return example: "(word1 word2 word3) word4"

    unSplit

    public static java.lang.String unSplit(java.util.Vector v,
                                           java.lang.String separator)
    It makes unSplit of Vector v and separator

    Parameters:
    v - Vector with components to join.
    separator - String of separator between components of v Vector.
    Returns:
    String composed with the following format: "v.get(0)+separator+v.get(1)+separator+...+v.get(n)"

    unSplit

    public static java.lang.String unSplit(java.lang.String[] st,
                                           java.lang.String separator)
    It makes unSplit of String[]st and separator

    Parameters:
    st - String array with components to join.
    separator - String of separator between components of String[]st.
    Returns:
    String composed with the following format: "st[0]+separator+st[1]+separator+...+st[n]"

    unSplit

    public static java.lang.String unSplit(java.lang.String[] st,
                                           java.lang.String separator,
                                           boolean includesep)
    It makes unSplit of String[]st and separator if includesep is True.

    Parameters:
    st - String array with components to join.
    separator - String of separator between components of String[]st.
    includesep - boolean which determinate if separator is included or not in String to be returned.
    Returns:
    String composed with the following format: "st[0]+sep?+st[1]+sep?+...+st[n]"

    toVector

    public static java.util.Vector toVector(java.lang.String[] st)
    Convert an array to Vector.

    Parameters:
    st - Array to be converted into Vector.
    Returns:
    Vector with same components as String[]st.


    e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.


    DISEÑO DE UNA PLATAFORMA DE GESTIÓN Y MONITORIZACIÓN DE EVENTOS DE SEGURIDAD

    : Galera Ruiz, Alejandro David
    : Ingeniería Telecomunicación
    Contenido del proyecto: