Esempio n. 1
0
class Dasher(object):
    """
    Dasher class definition.

    Simply the middleware between the raw datalog and the view functions.
    Takes the raw lists of usefull info and does all the counting and preparing
    for view by Flask.
    """
    def __init__(self, config):
        """
        Inits the object by registering the configuration object
        """
        self.config = config
        self.parser = Parser(self.config)
        self.geoloc = Geoloc(self.config)

        self.data = self.parser.getData()

    def initialCheck(self):
        """
        Once the class is instanciated, this method will do the basic checks
        from the logs and call different other functions.
        """
        bans = []

        for entry in self.data:
            ban = {}
            # Step 1 : get the geoloc data corresponding to the IP address
            geoloc = self.geoloc.get(entry["ip"])
Esempio n. 2
0
class Dasher(object):
    """
    Dasher class definition.

    Simply the middleware between the raw datalog and the view functions.
    Takes the raw lists of usefull info and does all the counting and preparing
    for view by Flask.
    """

    def __init__(self, config):
        """
        Inits the object by registering the configuration object
        """
        self.config = config
        self.parser = Parser(self.config)
        self.geoloc = Geoloc(self.config)

        self.data = self.parser.getData()

    def initialCheck(self):
        """
        Once the class is instanciated, this method will do the basic checks
        from the logs and call different other functions.
        """
        bans = []

        for entry in self.data:
            ban = {}
            # Step 1 : get the geoloc data corresponding to the IP address
            geoloc = self.geoloc.get(entry["ip"])
Esempio n. 3
0
    # Basic configuration about the application
    debug = True

    # Authentication configuration
    auth_mail = "root@localhost"
    auth_password = "******"
    secret = "8897879668D998AD5E9C4200E90E6056BBEB2FA38745ECA4D6710BC535ACDA02"

    # Fail2Ban parsing configuration
    log_file = "/home/nocternology/Work/fail2dash/sample.log"
    parse_default = "all"

    # Geolocalisation API setup
    api_endpoint = "https://www.telize.com/geoip/%s"
    api_parser = "json"

config = Config()

# Parser module testing
parser = Parser(config)
data = parser.getData()
# print data
#
# # Host info testing
# print utils.gatherHostInfo()

# Geoloc module testing
geoloc = Geoloc(config)
for entry in data:
    print geoloc.get(entry["ip"])