Esempio n. 1
0
    def __init__(self, url, data_dir, data_file_name, log_dir, log_file_name):
        self.dax_url = url
        self.data_dir = data_dir
        self.data_file_name = data_file_name
        self.data_file_path = data_dir + "/" + data_file_name

        self.logger = logger.Logger(log_dir, log_file_name)
 def __init__(self, user, password):
     self.user = user
     self.password = password
     self.logger = logger.Logger()
     self.xml_parser = xml_parser.XmlParser()
     self.month_to_integer_conversion = MonthToIntegerConverter()
     return
 def __init__(self,
              config):
     
     deamon.AbstractDaemon.__init__(self, config['pid_path'], '/dev/null', config['output_log'], config['error_log'])
     self.interval = config['interval']
     self.manager = manager.Manager()
     self.logger = logger.Logger(self.stdout, self.stderr)
Esempio n. 4
0
    def __init__(self,
                 sender_address,
                 recipient_list,
                 subject,
                 host,
                 port,
                 message,
                 file=''):
        sender = sender_address
        self.logger = logger.Logger()
        recipients = recipient_list.split(',')
        outer = MIMEMultipart()
        outer['Subject'] = subject
        outer['To'] = COMMASPACE.join(recipients)
        outer['From'] = sender
        outer.attach(MIMEText(message, 'plain'))
        if file != '':
            attachments = [file]

            for file in attachments:
                try:
                    with open(file, 'rb') as fp:
                        msg = MIMEBase('application/excel', 'octect-stream')
                        msg.set_payload(fp.read())
                    encoders.encode_base64(msg)
                    msg.add_header('Content-Disposition',
                                   'attachment',
                                   filename=os.path.basename(file))
                    outer.attach(msg)
                except Exception as e:
                    self.logger.exception(
                        'Unable to open  attachment: {}'.format(e))

        composed = outer.as_string()
        try:
            with smtplib.SMTP(host, port) as mail:
                mail.ehlo()
                mail.starttls()
                mail.ehlo()
                mail.sendmail(sender, recipients, composed)
                mail.close()
            self.logger.info('Email sent!')
        except Exception as e:
            self.logger.error('Error sending message: {}'.format(e))
Esempio n. 5
0
import os
import platform
from datetime import *
import imgui
import threading
import json
from modules import logger
from modules import LTKSModule

log = logger.Logger()


class FileWatch(LTKSModule.LTKSModule):

    alerts = []
    alertsData = {}

    watchLoopTime = 30.0
    started = False
    interfaceActive = False

    addingPathText = ""

    def __init__(self):
        with open('saves/watch-list.json') as watchInformation_json:
            self.watchInformation = json.load(watchInformation_json)

        super().__init__(
            "File/Directory Watcher",
            "This module is responsible for timely checks on certain directories and files to see if anything has changed"
        )
Esempio n. 6
0
 def __init__(self, user, password):
     self.user = user
     self.password = password
     self.logger = logger.Logger()
     self.xml_parser = xml_parser.XmlParser()
     return