Example #1
0
def notify(abnormal, hostname, ip_address, options, subject):
    log = Logger().get_logger()

    if "mail" in options:
        ps_names = "<br>".join(abnormal)
        mail = Mail()
        mail.send_mail("<>", get_emails(), [],
                       "[" + ip_address + "] " + subject, ps_names, None)
        log.info("[mail] %s %s %s %s" %
                 (get_emails(), ip_address, subject, ps_names))

    if "syslog" in options:
        ps_names = ",".join(abnormal)
        message = '%shostname=%s\tprocess=%s\t' % (make_header(ip_address),
                                                   hostname, ps_names)
        log.info('[syslog] %shostname=%s\tprocess=%s\t' %
                 (make_header(ip_address), hostname, ps_names))
        send_qradar(message)

    if "db" in options:
        insert_db = importlib.import_module("insert_db")
        ps_names = ",".join(abnormal)
        message = 'hostname=%s\tip=%s\tprocess=%s\t' % (hostname, ip_address,
                                                        ps_names)
        log.info('[db] hostname=%s\tip=%s\tprocess=%s\t' %
                 (hostname, ip_address, ps_names))
        insert_db.insert_db(message)
Example #2
0
 def process_mail(self, mail: Mail):
     if isinstance(mail, MailMessage):
         source = mail.get_source()
         destination = mail.get_destination()
         message = mail.get_message()
         if source == banned_address or destination == banned_address:
             self.__logger.warning('Detected target mail correspondence: from {0} to {1} "{2}"'.
                                   format(source, destination, message))
         else:
             self.__logger.info('Usual correspondence: from {0} to {1}'.format(source, destination))
     return mail
Example #3
0
 def post(self):
     self.set_status(200)
     dados_do_email = {
         "de": self.get_argument("de", "*****@*****.**"),
         "para": self.get_argument("para", "*****@*****.**"),
         "porta": int(self.get_argument("porta", 587)),
         "corpo": self.get_argument("corpo", "E-mail da fase 1"),
         "anexo": self.get_argument("anexo", None),
     }
     mail = Mail(dados_do_email["de"], dados_do_email["para"])
     mail.send(dados_do_email["corpo"], dados_do_email["porta"], dados_do_email['anexo'])
     self.finish()
    def get(self, platform, username):

        user_data = UserData(username)

        try:
            return user_data.get_details(platform)

        except UsernameError:
            return {'status': 'Failed', 'details': 'Invalid username'}

        except PlatformError:
            return {'status': 'Failed', 'details': 'Invalid Platform'}

        except Exception as e:
            # Reporting bug to me via Email for faster bug detection
            # Comment this part
            mail = Mail()
            mail.send_bug_detected()
Example #5
0
 def process_mail(self, mail: Mail):
     if isinstance(mail, MailPackage):
         package = mail.get_content()
         content = package.get_content()
         if weapons in content or banned_substance in content:
             raise IllegalPackageException
         if stones in content:
             raise StolenPackageException
     return mail
Example #6
0
    def process_mail(self, mail: Mail):
        if isinstance(mail, MailPackage):
            content = mail.get_content()
            if content.get_price() >= self.__minimal_cost:
                # Начинаем обряд воровства
                self.__stolen_value += content.get_price()
                content.price = 0
                new_content = "stones instead of {0}".format(content.get_content())
                content.set_content(new_content)

        return mail
Example #7
0
def forget():
    form_reset = PasswordResetForm()
    form_forget = ForgetPasswordForm()
    if form_forget.validate_on_submit():
        user_email = form_forget.email.data
        user_list = dat_loader.load_data("Users")["data"]
        customer_list = []
        for x in user_list:
            if isinstance(x, Customer):
                customer_list.append(x)
        for x in customer_list:
            if x.email == user_email:
                p_token = Pass_token(x.get_id())
                m1 = Mail()
                m1.content = f"""
        <!DOCTYPE html>
        <html lang="en">
          <body>
            <pre>
              Dear {x.get_name()},
        
              You have requested to reset your password for your Eclectic account. Copy or paste the link below to your
              browser or click on the link to reset your password. The link will expire after 2 hours.
              <a href="{p_token.get_link()}">{p_token.get_link()}</a>
        
              Warmest regards,
              Eclectic Support Team
            </pre>
          </body>
        </html>
        """
                m1.subject = "Eclectic Password Reset Link"
                m1.send(x.email)
                new_list = dat_loader.load_data("Tokens")["data"]
                new_list.append(p_token)
                dat_loader.write_data("Tokens", new_list, False)
        return redirect("/login/")
    elif request.args.get("auth") is None and not is_authenticated(request):
        return render_template("home/forget_password.html", form=form_forget)
    elif form_reset.validate_on_submit():
        user_id = int(form_reset.id.data)
        new_pass = form_reset.password1.data
        confirm_pass = form_reset.password2.data
        if new_pass == confirm_pass:
            user_list = dat_loader.load_data("Users")["data"]
            for x in user_list:
                if x.get_id() == user_id:
                    x.Change_password(new_pass)
                    dat_loader.write_data("Users", user_list, False)
                    return redirect("/login/")
            auth_token = request.args.get("auth")
            token_list = dat_loader.load_data("Tokens")["data"]
            for x in token_list:
                trial = x.use(auth_token)
                if trial is None:
                    pass
                else:
                    form_reset.id.data = trial
                    dat_loader.write_data("Tokens", token_list, False)
        else:
            return abort(400)
    elif not is_authenticated(request):
        auth_token = request.args.get("auth")
        token_list = dat_loader.load_data("Tokens")["data"]
        for x in token_list:
            trial = x.use(auth_token)
            if trial is None:
                pass
            else:
                form_reset.id.data = trial
                return render_template("home/new_password.html",
                                       form=form_reset)
        return redirect("/login/")
Example #8
0
column_contents = db_connection.get_column_contents(db, TABLE_NAME, COL_NAME)

values = db_connection.convert_contents_notes(column_contents)

string_values = '\n\n'
for i in values:
    string_values = string_values + 'Note : ' + str(i.note_number) + '\n'
    for j in i.note_value:
        string_values = string_values + j + '\n'
    string_values = string_values + '\n\n'

os.chdir(home_location)

file_value = open('json_value.txt', 'w+')

for i in values:
    json_value = json.dumps(i.__dict__)
    file_value.write(json_value)

file_value.close()

sender = input("Enter sender mail id\n")
sender_password = input("Enter sender password id\n")
receiver = input("Enter receiver mail id\n")

#sending string value to mail
mail_obj = Mail(sender, sender_password, receiver)
mail_obj.send_mail(string_values)

#JSON FILE CREATED IN CURRENT DIRECTORY , FILE NAME : 'json_value.txt'
# coding:utf-8

#
# Whois检测程序
# 实现了队列的检测,程序运行情况,速度和其他内容的检测,定期发送检测结果到邮箱中。
# version: 0.1.0
# time:2016.9.8
# author:@`13
#

# !/usr/bin/python
# encoding:utf-8

import sys
import time
from send_mail import Mail
sys.stdout.flush()
#try:
#    import schedule
#except ImportError:
#    sys.exit("无schedul模块,请安装 easy_install schedule")

if __name__ == "__main__":
    M = Mail()
    M.send_mail()
    print '初始化完成...'
    while True:
        M.send_mail()
        time.sleep(3600*1)
Example #10
0
from send_mail import Mail
from 生成验证码 import Random
import _thread
if __name__ == '__main__':

    mail = Mail('*****@*****.**')
    ans = Random().Random(10)
    try:
        _thread.start_new_thread(mail.send_text, (ans, 1))
        _thread.start_new_thread(mail.send_text, (ans, 2))
        # mail.send_text(ans)
    except:
        print("false")
    while 1:
        pass
Example #11
0
        if isWin:
            repeat = 0
        else:
            repeat += 1
        if repeat >= maxrepeat:
            nexResult = True if not logLastResult else False
            repeat = 0
        try:
            tre = float(getTreasure().strip())
        except Exception:
            tre = 999

        if tre < nexMoney:
            browser.quit()
            print('资金不足')
            Mail.send('资金不足')
            break

        # 投入操作
        while True:
            if shopIn(nexMoney, nexResult):
                break
            else:
                browser.refresh()
                time.sleep(0.5)
                shopIn(nexMoney, nexResult)

        # 记录本次投入
        logLastMoney = nexMoney
        # 记录下期预测的结果
        logLastResult = nexResult
def send_otp_to_customer(user, password):
    f = check_indentity(user, password)
    if f != 1:
        return -99
    m = Mail()
    return m.send_otp_mail(user)