Class Logger


  • public class Logger
    extends Object
    The Logger class exposes static methods that can be used to create colored output. Additionally, most of the methods add a '[+]' or '[-]' prefix. The Logger class also handles a unified indent that can be increased or decreased by invoking classes. This saves invoking classes from handle indentation manually. It is probably not the prettiest approach, but it works quite nice :D
    Author:
    Tobias Neitzel (@qtc_de)
    • Field Detail

      • indent

        public static int indent
        current indent of the logger
      • printCount

        public static int printCount
        how many lines have already be printed
      • stdout

        public static boolean stdout
        whether stdout is enabled
      • stderr

        public static boolean stderr
        whether stderr is enabled
    • Constructor Detail

      • Logger

        public Logger()
    • Method Detail

      • disable

        public static void disable()
      • disableStdout

        public static void disableStdout()
      • disableStderr

        public static void disableStderr()
      • disableIfNotVerbose

        public static void disableIfNotVerbose()
      • enable

        public static void enable()
      • enableStdout

        public static void enableStdout()
      • enableStderr

        public static void enableStderr()
      • blue

        public static String blue​(String msg)
        Format the specified string in blue.
        Parameters:
        msg - message to format
        Returns:
        formatted message
      • yellow

        public static String yellow​(String msg)
        Format the specified string in yellow.
        Parameters:
        msg - message to format
        Returns:
        formatted message
      • red

        public static String red​(String msg)
        Format the specified string in red.
        Parameters:
        msg - message to format
        Returns:
        formatted message
      • purple

        public static String purple​(String msg)
        Format the specified string in purple.
        Parameters:
        msg - message to format
        Returns:
        formatted message
      • green

        public static String green​(String msg)
        Format the specified string in green.
        Parameters:
        msg - message to format
        Returns:
        formatted message
      • lineBreak

        public static void lineBreak()
      • print

        public static void print​(String msg)
        Parameters:
        msg - the message to log
      • printPlain

        public static void printPlain​(String msg)
        Parameters:
        msg - the message to log
      • println

        public static void println​(String msg)
        Parameters:
        msg - the message to log
      • printlnPlain

        public static void printlnPlain​(String msg)
        Parameters:
        msg - the message to log
      • eprint

        public static void eprint​(String msg)
        Parameters:
        msg - the message to log
      • eprintln

        public static void eprintln​(String msg)
        Parameters:
        msg - the message to log
      • eprintlnPlain

        public static void eprintlnPlain​(String msg)
        Parameters:
        msg - the message to log
      • printlnBlue

        public static void printlnBlue​(String msg)
        Parameters:
        msg - the message to log
      • eprintlnBlue

        public static void eprintlnBlue​(String msg)
        Parameters:
        msg - the message to log
      • printlnYellow

        public static void printlnYellow​(String msg)
        Parameters:
        msg - the message to log
      • eprintlnYellow

        public static void eprintlnYellow​(String msg)
        Parameters:
        msg - the message to log
      • printlnPlainBlue

        public static void printlnPlainBlue​(String msg)
        Parameters:
        msg - the message to log
      • printPlainBlue

        public static void printPlainBlue​(String msg)
        Parameters:
        msg - the message to log
      • printPlainGreen

        public static void printPlainGreen​(String msg)
        Parameters:
        msg - the message to log
      • printlnPlainGreen

        public static void printlnPlainGreen​(String msg)
        Parameters:
        msg - the message to log
      • eprintlnPlainBlue

        public static void eprintlnPlainBlue​(String msg)
        Parameters:
        msg - the message to log
      • printlnPlainYellow

        public static void printlnPlainYellow​(String msg)
        Parameters:
        msg - the message to log
      • printPlainYellow

        public static void printPlainYellow​(String msg)
        Parameters:
        msg - the message to log
      • eprintlnPlainYellow

        public static void eprintlnPlainYellow​(String msg)
        Parameters:
        msg - the message to log
      • printlnMixedRed

        public static void printlnMixedRed​(String first,
                                           String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnPlainMixedRed

        public static void printlnPlainMixedRed​(String first,
                                                String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printPlainMixedRed

        public static void printPlainMixedRed​(String first,
                                              String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnMixedGreen

        public static void printlnMixedGreen​(String first,
                                             String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnPlainMixedGreen

        public static void printlnPlainMixedGreen​(String first,
                                                  String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printPlainMixedGreen

        public static void printPlainMixedGreen​(String first,
                                                String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnMixedPurple

        public static void printlnMixedPurple​(String first,
                                              String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnPlainMixedPurple

        public static void printlnPlainMixedPurple​(String first,
                                                   String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printPlainMixedPurple

        public static void printPlainMixedPurple​(String first,
                                                 String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnMixedBlue

        public static void printlnMixedBlue​(String first,
                                            String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnMixedBlue

        public static void printlnMixedBlue​(String first,
                                            String second,
                                            String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printlnMixedYellow

        public static void printlnMixedYellow​(String first,
                                              String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnMixedYellow

        public static void printlnMixedYellow​(String first,
                                              String second,
                                              String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printlnPlainMixedYellow

        public static void printlnPlainMixedYellow​(String first,
                                                   String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnPlainMixedYellow

        public static void printlnPlainMixedYellow​(String first,
                                                   String second,
                                                   String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printPlainMixedYellowFirst

        public static void printPlainMixedYellowFirst​(String first,
                                                      String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintPlainMixedYellowFirst

        public static void eprintPlainMixedYellowFirst​(String first,
                                                       String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnPlainMixedYellowFirst

        public static void printlnPlainMixedYellowFirst​(String first,
                                                        String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnPlainMixedYellowFirst

        public static void printlnPlainMixedYellowFirst​(String first,
                                                        String second,
                                                        String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printlnPlainMixedBlue

        public static void printlnPlainMixedBlue​(String first,
                                                 String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintlnPlainMixedBlue

        public static void eprintlnPlainMixedBlue​(String first,
                                                  String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnPlainMixedBlue

        public static void printlnPlainMixedBlue​(String first,
                                                 String second,
                                                 String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintlnPlainMixedBlue

        public static void eprintlnPlainMixedBlue​(String first,
                                                  String second,
                                                  String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printPlainMixedBlue

        public static void printPlainMixedBlue​(String first,
                                               String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printPlainMixedBlueFirst

        public static void printPlainMixedBlueFirst​(String first,
                                                    String second,
                                                    String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintlnMixedBlue

        public static void eprintlnMixedBlue​(String first,
                                             String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintlnMixedBlue

        public static void eprintlnMixedBlue​(String first,
                                             String second,
                                             String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintlnMixedYellow

        public static void eprintlnMixedYellow​(String first,
                                               String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintlnMixedYellow

        public static void eprintlnMixedYellow​(String first,
                                               String second,
                                               String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printlnMixedBlueFirst

        public static void printlnMixedBlueFirst​(String first,
                                                 String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnMixedBlueFirst

        public static void printlnMixedBlueFirst​(String first,
                                                 String second,
                                                 String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printlnPlainMixedBlueFirst

        public static void printlnPlainMixedBlueFirst​(String first,
                                                      String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintlnPlainMixedBlueFirst

        public static void eprintlnPlainMixedBlueFirst​(String first,
                                                       String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintlnPlainMixedBlueFirst

        public static void eprintlnPlainMixedBlueFirst​(String first,
                                                       String second,
                                                       String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printlnPlainMixedBlueFirst

        public static void printlnPlainMixedBlueFirst​(String first,
                                                      String second,
                                                      String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printlnMixedYellowFirst

        public static void printlnMixedYellowFirst​(String first,
                                                   String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printlnMixedYellowFirst

        public static void printlnMixedYellowFirst​(String first,
                                                   String second,
                                                   String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintlnMixedBlueFirst

        public static void eprintlnMixedBlueFirst​(String first,
                                                  String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintlnMixedBlueFirst

        public static void eprintlnMixedBlueFirst​(String first,
                                                  String second,
                                                  String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintlnMixedYellowFirst

        public static void eprintlnMixedYellowFirst​(String first,
                                                    String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintlnMixedYellowFirst

        public static void eprintlnMixedYellowFirst​(String first,
                                                    String second,
                                                    String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printMixedBlue

        public static void printMixedBlue​(String first,
                                          String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printMixedBlue

        public static void printMixedBlue​(String first,
                                          String second,
                                          String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printMixedYellow

        public static void printMixedYellow​(String first,
                                            String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printMixedYellow

        public static void printMixedYellow​(String first,
                                            String second,
                                            String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintMixedBlue

        public static void eprintMixedBlue​(String first,
                                           String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintMixedBlue

        public static void eprintMixedBlue​(String first,
                                           String second,
                                           String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintMixedYellow

        public static void eprintMixedYellow​(String first,
                                             String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintMixedYellow

        public static void eprintMixedYellow​(String first,
                                             String second,
                                             String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printMixedBlueFirst

        public static void printMixedBlueFirst​(String first,
                                               String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printMixedBlueFirst

        public static void printMixedBlueFirst​(String first,
                                               String second,
                                               String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printMixedYellowFirst

        public static void printMixedYellowFirst​(String first,
                                                 String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • printMixedYellowFirst

        public static void printMixedYellowFirst​(String first,
                                                 String second,
                                                 String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintMixedBlueFirst

        public static void eprintMixedBlueFirst​(String first,
                                                String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintMixedBlueFirst

        public static void eprintMixedBlueFirst​(String first,
                                                String second,
                                                String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • eprintMixedYellowFirst

        public static void eprintMixedYellowFirst​(String first,
                                                  String second)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
      • eprintMixedYellowFirst

        public static void eprintMixedYellowFirst​(String first,
                                                  String second,
                                                  String third)
        Parameters:
        first - the first part of the message to log
        second - the second part of the message to log
        third - the third part of the message to log
      • printInfoBox

        public static void printInfoBox()
      • statusVulnerable

        public static void statusVulnerable()
      • statusOk

        public static void statusOk()
      • statusOutdated

        public static void statusOutdated()
      • statusDefault

        public static void statusDefault()
      • statusNonDefault

        public static void statusNonDefault()
      • statusUndecided

        public static void statusUndecided​(String statusType)
        Parameters:
        statusType - the thing that was checked (e.g. vulnerability, configuration, ...)
      • increaseIndent

        public static void increaseIndent()
      • decreaseIndent

        public static void decreaseIndent()
      • getIndent

        public static String getIndent()
        Returns:
        the current Logger indent
      • disableColor

        public static void disableColor()
      • printCodebaseAttackIntro

        public static void printCodebaseAttackIntro​(String endpointName,
                                                    String callName,
                                                    String className)
        Parameters:
        endpointName - remote endpoint that is attacked
        callName - the name or signature of the call that was used
        className - the class name used for the codebase attack
      • printGadgetCallIntro

        public static void printGadgetCallIntro​(String endpointName)
        Parameters:
        endpointName - remote endpoint that is attacked
      • padRight

        public static String padRight​(String s,
                                      int n)
        Parameters:
        s - the string to pad
        n - the padding to apply
        Returns:
        padded string