Skip to content

Commit a5ce933

Browse files
author
xirenbing
committed
version-2.0
1 parent c914c89 commit a5ce933

File tree

14 files changed

+1725
-171
lines changed

14 files changed

+1725
-171
lines changed

.gitignore

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
*.txt
2-
chrome*.exe
3-
*.png
4-
*.ico
5-
auto*.exe
6-
dist*/*
7-
*win10x64*
8-
test.py
9-
debug.log
10-
*quiry_ans*
11-
*picshow*
12-
*ver*code*
131
FAQ*
14-
*pycache*/
15-
test.bat
16-
!logindata.txt
2+
img/*
3+
版本包/*
4+
test/*
5+
*codes/*

SearchAns.exe

-11.3 MB
Binary file not shown.

README_docker.md renamed to docker/README_docker.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ autocx是autochaoxing的Docker版本,是在作者[@Luoofan](https://github.com
55
### 当您pull镜像后,只需进行以下几步:
66

77
- 以特权模式运行容器
8-
`docker run -it --name autocx --privileged autocx bash`
8+
`docker run -it --name autocx --privileged kimjungwha/autocx bash`
99
- 按照提示修改logindata.txt里的信息
1010
`vim logindata.txt`
1111
- 运行脚本
@@ -14,7 +14,7 @@ autocx是autochaoxing的Docker版本,是在作者[@Luoofan](https://github.com
1414
### 关于镜像的详细说明:
1515

1616
 autocx镜像基于`debian:buster-slim` 只替换了网易源、添加了脚本运行所需的环境,其余均与官方保持一致。其中内置了sudo、vim,默认用户/密码均为autocx,默认workdir为/home/autocx/
17-
 因为内置了py3、chromium,还有我本人水平限制,目前的镜像足足700+M,随着脚本的更新,我会尽量使它变得更加完美小巧,同时也欢迎各位大佬来群里指导,吹水啊!
17+
 因为内置了py3、chromium环境,还有我本人水平限制,目前的镜像足足700+M,随着脚本的更新,我会尽量使它变得更加完美小巧,同时也欢迎各位大佬来群里指导,吹水啊!
1818

1919
### 如果遇到问题:
2020

@@ -24,4 +24,4 @@ autocx是autochaoxing的Docker版本,是在作者[@Luoofan](https://github.com
2424

2525

2626

27-
**By:[KimJungWha](https://github.com/KimJungWha)**
27+
**By:[KimJungWha](https://github.com/KimJungWha)**
File renamed without changes.

viu renamed to docker/viu

File renamed without changes.

logindata.txt

Whitespace-only changes.

source_code/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*pycache*/
2+
*bak*
3+
*.exe
4+
test*
File renamed without changes.

source_code/autocx.py

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# coding=utf-8
2+
##
3+
# brief 选择模式启动刷课
4+
# details 先后读取logindata_phone.txt(2行一个账号)和logindata.txt(3行一个账号)的全部账号信息
5+
# windows环境下:对于每一份账号信息启动一个cmd命令行来执行刷课操作
6+
# Linux(docker)环境下:待定
7+
# author Luoofan
8+
# date 2020-03-27 20:38:15
9+
# FilePath\source_codes\autocx.py
10+
#
11+
from subprocess import Popen
12+
from time import sleep
13+
from colorama import Fore
14+
from colorama import init as colorinit
15+
from sys import argv
16+
from getopt import gnu_getopt
17+
from requests import post
18+
from platform import platform,architecture
19+
20+
class Color(object):
21+
END = Fore.RESET
22+
OK = Fore.GREEN
23+
NOTE = Fore.YELLOW
24+
WARN = Fore.MAGENTA
25+
ERR = Fore.RED
26+
DISPLAY = Fore.BLUE
27+
28+
instance =None
29+
30+
def __new__(cls,*args,**kwargs):
31+
if cls.instance is None:
32+
cls.instance=super().__new__(cls)
33+
return cls.instance
34+
35+
def __init__(self):
36+
colorinit()
37+
#print(self)
38+
39+
COLOR = Color()
40+
41+
def getlogindata():
42+
return open(r'./logindata.txt', 'r', encoding='utf-8').readlines()
43+
44+
def getlogindata_phone():
45+
return open(r'./logindata_phone.txt', 'r', encoding='utf-8').readlines()
46+
47+
def send_err(err_info):
48+
data = {
49+
'platform': platform(),
50+
'arch': str(architecture()),
51+
'errorinfo': err_info
52+
}
53+
post('http://39.98.127.46/index.php', data=data)
54+
55+
def perform(mode,rate):
56+
#处理账号信息
57+
print(COLOR.DISPLAY+'Welcome To Multi-Autocx!'+COLOR.END)
58+
59+
# 读取 手机号+密码 弹出多个弹窗
60+
lt_phone = getlogindata_phone()
61+
for i in range(len(lt_phone)//2):
62+
logindata = ""
63+
try:
64+
for j in range(i*2, (i+1)*2):
65+
logindata += (lt_phone[j].strip(' \n'))+','
66+
except IndexError:
67+
print(' Sorry,no info')
68+
break
69+
# print(logindata)
70+
Popen('start cmd /k python login_courses.py '+logindata[0:-1]+' '+str(mode)+' '+str(rate), shell=True)
71+
sleep(2)
72+
73+
# 读取 机构账号 需要输入验证码 每次处理一个 按任意键后处理下一个
74+
lt = getlogindata()
75+
for i in range(len(lt)//3):
76+
logindata = ""
77+
try:
78+
for j in range(i*3, (i+1)*3):
79+
logindata += (lt[j].strip(' \n'))+','
80+
except IndexError:
81+
print(' Sorry,no info')
82+
break
83+
# print(logindata)
84+
Popen('start cmd /k python login_courses.py '+logindata[0:-1]+' '+str(mode)+' '+str(rate), shell=True)
85+
input(COLOR.OK+' please press any key to continue'+COLOR.END)
86+
87+
print(COLOR.DISPLAY+'Now you can exit this program! Good luck!'+COLOR.END)
88+
89+
def main():
90+
#参数处理
91+
try:
92+
opts,args=gnu_getopt(argv[1:],'-m:-r:-v-h',['mode=','rate=','version','help'])
93+
except:
94+
print(COLOR.ERR+'Invalid args, Try -h or --help for more information'+COLOR.END)
95+
exit()
96+
#print(opts)
97+
#print(args)
98+
rate=1
99+
mode="single"
100+
opt_mode = ['single', 'fullauto', 'control']
101+
for opt_name,opt_value in opts:
102+
if opt_name in ('-h','--help'):
103+
print('''
104+
-m(--mode) single 单课程自动模式: 选择课程,自动完成该课程(默认启动参数)
105+
fullauto 全自动模式: 自动遍历全部课程,无需输入(除了机构登录方式下需要输入验证码)
106+
control 单课程控制模式: 选择课程并选择控制章节,自动完成[该课程第一个未完成章节,选定章节)范围内章节
107+
-r(--rate) [0.625,16] 全局倍速设置: 在选定模式的全局范围内开启该倍速
108+
-h(--help) usage
109+
-v(--version) version
110+
''')
111+
exit()
112+
if opt_name in ('-v','--version'):
113+
print('2.0beta')
114+
exit()
115+
if opt_name in ('-r','--rate'):
116+
rate=eval(opt_value)
117+
if rate>16 or rate<0.625:
118+
print(COLOR.ERR+'Invalid rate range, Try -h or --help for more information'+COLOR.END)
119+
exit()
120+
if opt_name in ('-m','--mode'):
121+
mode=opt_value
122+
if mode not in opt_mode:
123+
print(COLOR.ERR+'Invalid args, Try -h or --help for more information'+COLOR.END)
124+
exit()
125+
#调用 执行 mode & rate
126+
print(COLOR.DISPLAY+'Set the mode: %s and the rate: %.2f'%(mode,rate)+COLOR.END)
127+
perform(opt_mode.index(mode),rate)
128+
129+
if __name__=='__main__':
130+
main()

0 commit comments

Comments
 (0)