This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
forked from awangga/outlook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwin.py
62 lines (57 loc) · 2.47 KB
/
win.py
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
from AppHandler.AppHandler import AppHandler_win32
from EmailManager.EmailManager import EmailManager
import time
import configparser
if __name__ == "__main__":
# Load configs from local config.ini
print("[AutoConnect] Load configs.")
config = configparser.ConfigParser()
config.read('config.ini')
# -- cisco
AppDirt = config.get('cisco', 'AppDirt').strip() # App absolute directory
AppUsername = config.get('cisco', 'AppUsername').strip() # App username
AppPassword = config.get('cisco', 'AppPassword').strip() # App password
# -- outlook
EmailAccount = config.get('outlook', 'EmailAccount').strip() # your email account
EmailPassword = config.get('outlook', 'EmailPassword').strip() # your email password
FolderName = config.get('outlook', 'FolderName').strip() # your folder to receive Token emails
SenderEmailAccount = config.get('outlook', 'SenderEmailAccount').strip() # sender email address
# Call App
appHandler = AppHandler_win32(AppDirt)
appHandler.open_app()
status = appHandler.check_status()
# >> Homepage: Connected
if status=="homepage_connected":
pass
# >> Homepage: Disconnected
elif status=="homepage_disconnected":
appHandler.wait_status("homepage_disconnected")
print("[AppHandler] >> Home")
appHandler.click_buttom("Connect")
print("[AppHandler] >> Home >> Click <Connect>")
# >> Login
appHandler.wait_status("login")
print("[AppHandler] >> Login")
appHandler.enter_text(AppUsername,"Username")
print("[AppHandler] >> Login >> Enter <Username>")
appHandler.enter_text(AppPassword,"Password")
print("[AppHandler] >> Login >> Enter <Password>")
appHandler.click_buttom("OK")
# >> Auth
appHandler.wait_status("auth")
# Get Token
print("[AppHandler] >> Auth >> Waiting for Token ...")
em = EmailManager()
em(EmailAccount, EmailPassword, FolderName, SenderEmailAccount)
TOKEN = em.getToken()
appHandler.back_to_app(appHandler.hwnd_auth)
appHandler.enter_text(TOKEN,"Token")
print("[AppHandler] >> Auth >> Enter <Token>")
appHandler.click_buttom("Continue")
print("[AppHandler] >> Auth >> Click <Continue>")
# Wait service launching
print("[AppHandler] Service Launching...")
time.sleep(5)
# END
print("[AppHandler] You are connected. Enjoy!")
time.sleep(2)