-
Notifications
You must be signed in to change notification settings - Fork 28
/
ucashelper.py
91 lines (68 loc) · 2.53 KB
/
ucashelper.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# @Author : GentleCP
# @Email : 574881148@qq.com
# @File : ucashelper.py
# @Item : PyCharm
# @Time : 2019/11/28/028 13:58
# @WebSite : https://www.gentlecp.com
import click
import sys
import os
from handler import ui
from core.wifi import AccHacker
from core.assess import Assesser
from core.grade import GradeObserver
from core.download import Downloader
from core.wifi import WifiLoginer
import settings
ROOT_PATH = os.path.dirname(__file__)
sys.path.append(ROOT_PATH)
@click.group()
def start():
"""UCASHelper is a useful tool for UCASer, following are the arguments that you could choose"""
@click.command(name='config',help='Set your user info and download path(not support on windows)')
def config():
if not sys.platform.startswith('win'):
from handler.configer import UCASHelperConfigApp
UCASHelperConfigApp().run()
else:
print('config not support on windows. please set config in conf/user_config.ini by yourself.')
@click.command(name='ui',help='Get UI interface of UCASHelper')
def UI():
ui.main(record_path=settings.RECORD_PATH)
@click.command(name='down',help='Download resources from sep website')
def download_source():
downloader = Downloader(
urls=settings.URLS,
user_config_path=settings.USER_CONFIG_PATH,
filter_list=settings.FILTER_LIST)
downloader.run()
@click.command(name='assess',help='Auto assess courses and teachers')
def auto_assess():
assesser = Assesser(
urls=settings.URLS,
user_config_path=settings.USER_CONFIG_PATH,
assess_msgs=settings.ASSESS_MSG)
assesser.run()
@click.command(name='grade',help='Query your grades')
def query_grades():
gradeObserver = GradeObserver(
urls=settings.URLS,
user_config_path=settings.USER_CONFIG_PATH) # todo, delete
gradeObserver.run()
@click.command(name='hack',help='Hack wifi accounts')
def hack_accounts():
hacker = AccHacker(data_path='data/data.txt', password_path='data/password.txt')
hacker.run()
@click.command(name='login',help='Login campus network')
def login_wifi():
wifiLoginer = WifiLoginer(accounts_path=settings.ACCOUNTS_PATH)
wifiLoginer.login()
@click.command(name='logout',help='Logout campus network')
def logout_wifi():
wifiLoginer = WifiLoginer(accounts_path=settings.ACCOUNTS_PATH)
wifiLoginer.logout()
if __name__ == '__main__':
commands = [UI,auto_assess,download_source,query_grades,hack_accounts,login_wifi,logout_wifi, config]
for command in commands:
start.add_command(command)
start()