Esempio n. 1
0
    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()
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
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. 4
0
    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()
Esempio n. 5
0
running = True
def cleanup(sig, frame):
    global running
    running = False
signal.signal(signal.SIGTERM, cleanup)
signal.signal(signal.SIGINT, cleanup)

if not opts.dryrun:
    pid = str(os.getpid())
    file(pidfile, 'w+').write("%s\n" % pid)
    ledStrip = LedStrip_WS2801("/dev/spidev0.0", 40)
else:
    ledStrip = LedStrip_Dummy(40)
ledStrip.update()

loc = Geoloc()
tz = tzlocal.get_localzone()
timezone = pytz.timezone(str(tz))

# Current brightness
is_night = False
is_night_time = False

prev_leds = []
while running:
    d = timezone.localize(datetime.now())
    utc = d.astimezone(pytz.utc)
    cur = d.timetuple()

    if loc.located():
        night_b = d.replace(hour=night[0], minute=0, second=0)
Esempio n. 6
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"])