├── images ├── jc.png ├── jc1.png ├── rk1.png ├── rk2.png ├── agin.png ├── result.png ├── clazz_id.png ├── 1970797714.png ├── 2248617723.png ├── 284581516.png ├── 3924891976.png ├── 4219675771.png ├── 471900538.png └── article_id.png ├── requirements.txt ├── .idea ├── vcs.xml ├── misc.xml ├── inspectionProfiles │ └── profiles_settings.xml ├── modules.xml ├── crawler.iml └── workspace.xml ├── README.md ├── config.py └── moso.py /images/jc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/jc.png -------------------------------------------------------------------------------- /images/jc1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/jc1.png -------------------------------------------------------------------------------- /images/rk1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/rk1.png -------------------------------------------------------------------------------- /images/rk2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/rk2.png -------------------------------------------------------------------------------- /images/agin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/agin.png -------------------------------------------------------------------------------- /images/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/result.png -------------------------------------------------------------------------------- /images/clazz_id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/clazz_id.png -------------------------------------------------------------------------------- /images/1970797714.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/1970797714.png -------------------------------------------------------------------------------- /images/2248617723.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/2248617723.png -------------------------------------------------------------------------------- /images/284581516.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/284581516.png -------------------------------------------------------------------------------- /images/3924891976.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/3924891976.png -------------------------------------------------------------------------------- /images/4219675771.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/4219675771.png -------------------------------------------------------------------------------- /images/471900538.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/471900538.png -------------------------------------------------------------------------------- /images/article_id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodfe/go_moso/HEAD/images/article_id.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.6.0 2 | bs4==0.0.1 3 | cookiecutter==1.6.0 4 | cookiejar==0.0.1 5 | urllib3=1.24.2 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/crawler.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | EdgeOne logo and website link: Best Asian CDN, Edge, and Secure Solutions - Tencent EdgeOne 2 | [![Use EdgeOne Pages to deploy](https://cdnstatic.tencentcs.com/edgeone/pages/deploy.svg)](https://edgeone.ai/pages/new?repository-url=https://github.com/nodfe/go_moso) 3 | 4 | # go_moso 5 | 6 | 蓝墨云刷分工具 7 | # 项目已停止更新,开源代码可供学习研究 8 | 9 | 使用方法: 10 | 11 | 1.打开config.py 12 | 13 | 更改articleId为你的蓝墨云活动id 14 | 15 | 更改courseId为你的蓝墨云班级id 16 | 17 | 以上两部分的教程在这:https://www.ailoli.org/archives/50/ 18 | 19 | 更改values下的accout_name为你的蓝墨云账号 20 | 21 | 更改values下的user_pwd为你的蓝墨云密码 22 | 23 | 更改article_id为你的蓝墨云班级活动id 24 | 25 | 更改sleepNumber为你需要的睡眠时间 26 | 27 | k变量说明: 28 | 29 | k变量为概率性变量: 30 | 31 | k的数值代表循环次数,每次循环都会自动从ABCD中随机选择一个,设为0则不执行 32 | 33 | 设的越高分数理论上来讲会越低(不排除人品特别好的) 34 | 35 | 总的来说这个变量就是来控制正确率的,经过测试一般设在20~35就差不多了 36 | 37 | 最后 38 | 39 | ./moso.py 40 | 41 | 或者 42 | 43 | python moso.py 44 | 45 | 来运行他吧,之后你就可以挂着去干其他事情啦! 46 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | articleId = ""#此处为蓝墨云活动的id 2 | courseId = ""#此处为蓝墨云的班级id 3 | sleepNumber = 0#此值/60等于蓝墨云真实的做题用时时间 4 | k = 0#此值代表随机选择试题的数量 5 | URL_ROOT = r'https://www.mosoteach.cn/web/index.php?c=passport&m=account_login'#蓝墨云登陆提交地址 6 | values = { 7 | 'account_name': '', # 此处为蓝墨云的账号 8 | 'user_pwd': '', # 此处为蓝墨云的密码 9 | 'remember_me': 'N' # 是否记住登陆状态,默认不记住 10 | } 11 | headers = { 12 | 'Host': 'www.mosoteach.cn', 13 | 'Accept-Encoding': 'gzip, deflate', 14 | 'Origin': 'https://www.mosoteach.cn', 15 | 'X-Requested-With': 'XMLHttpRequest', 16 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36', 17 | 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 18 | 'Referer': 'https://www.mosoteach.cn/web/index.php?c=passport&m=index', 19 | } 20 | 21 | subJectUrl = "https://www.mosoteach.cn/web/index.php?c=interaction_quiz&m=reply&clazz_course_id=" + courseId + "&id=" + articleId + "&order_item=group" -------------------------------------------------------------------------------- /moso.py: -------------------------------------------------------------------------------- 1 | #coding=UTF-8 2 | import json 3 | import urllib.request 4 | from urllib.parse import urlencode 5 | import zlib 6 | import http.cookiejar 7 | from bs4 import BeautifulSoup 8 | import time 9 | import random 10 | import config 11 | 12 | k = config.k 13 | articleId = config.articleId 14 | courseId = config.courseId 15 | sleepNumber = config.sleepNumber 16 | URL_ROOT = config.URL_ROOT 17 | values = config.values 18 | headers = config.headers 19 | subJectUrl = config.subJectUrl 20 | 21 | def getOpener(): 22 | cookie = http.cookiejar.CookieJar() 23 | handler = urllib.request.HTTPCookieProcessor(cookie) 24 | opener = urllib.request.build_opener(handler) 25 | return opener 26 | 27 | def getUserInfo(opener): 28 | data = urlencode(values).encode() 29 | request = urllib.request.Request(URL_ROOT, data, headers) 30 | response = opener.open(request) 31 | print(response.info().get('Content-Encoding'))#输出网页压缩状态 32 | result_data = zlib.decompress(response.read(), 16 + zlib.MAX_WBITS)#解压 33 | mJson = json.loads(result_data) 34 | print(mJson) 35 | return mJson 36 | 37 | def getSubJectAnswer(opener,userId): 38 | topic = [] 39 | i = 0 40 | url = "https://www.mosoteach.cn/web/index.php?c=interaction_quiz&m=person_quiz_result&clazz_course_id=" + courseId + "&id=" + articleId + "&order_item=group&user_id="+userId 41 | response = opener.open(url) 42 | html = response.read().decode('utf8') 43 | mbs = BeautifulSoup(html, "html.parser") 44 | main_div = mbs.find(attrs={"id": "cc-main"}) 45 | testList_div = main_div.findAll(attrs={"class": "view-quiz-row"}) 46 | 47 | for item in testList_div: 48 | trueRate = item.find(attrs={"style": "color:#07AC6C;"}).string 49 | title = item.find(attrs={"class": "color-33 topic-subject"}).string 50 | mDict = {'title': title, 'truerate': trueRate} 51 | topic.append(mDict) 52 | i = i + 1 53 | print("subJectAnswer:" + str(len(topic))) 54 | return topic 55 | 56 | def getSubJect(opener,subJectUrl): 57 | response = opener.open(subJectUrl) 58 | result_data = response.read().decode('utf8') 59 | mbs = BeautifulSoup(result_data, "html.parser") 60 | main_div = mbs.find(attrs={"id": "cc-main"}) 61 | topics_box = main_div.find(attrs={"id": "topics-box"}) 62 | topicRows = topics_box.findAll(attrs={"class": "student-topic-row"}) 63 | print("topicRows:" + str(len(topicRows))) 64 | return topicRows 65 | 66 | def getRandom(k): 67 | randomChoice = [] 68 | while (1): 69 | if k > 0: 70 | randomNumber = random.randint(0, 99) 71 | randomChoice.append(randomNumber) 72 | else: 73 | break 74 | k = k - 1 75 | return randomChoice 76 | 77 | def subJectToAnwser(topicRows,answerRows,randomChoice): 78 | j = 0 79 | postData = [] 80 | for item in topicRows: 81 | title = item.find(attrs={"class": "topic-subject"}).string 82 | data_id = item.attrs['data-id'] 83 | while (1): 84 | if (answerRows[j]['title'] == title): 85 | abcdToInteger = { 86 | "A": [0], 87 | "B": [1], 88 | "C": [2], 89 | "D": [3] 90 | } 91 | if (j in randomChoice): 92 | truerate = getABCD(random.randint(0, 3)) 93 | else: 94 | truerate = answerRows[j]['truerate'] 95 | trueInt = abcdToInteger[truerate.strip()] 96 | j = 0 97 | break 98 | if (j == 99): 99 | break 100 | j = j + 1 101 | postData.append({"topic_id": data_id, "choice": trueInt}) 102 | j = 0 103 | return postData 104 | 105 | def submit(postData): 106 | url = "https://www.mosoteach.cn/web/index.php?c=interaction_quiz&m=save_answer" 107 | time.sleep(sleepNumber) 108 | postValues = { 109 | "id": articleId, 110 | "force": "", 111 | "data": json.dumps(postData), 112 | "clazz_course_id": courseId 113 | } 114 | data = urlencode(postValues).encode('utf-8') 115 | response = opener.open(url, data) 116 | result_data = response.read().decode('utf8') 117 | print(json.loads(result_data)) 118 | print(u'刷题结束,请打开蓝墨云APP或者蓝墨云Web页面查看!') 119 | 120 | def getABCD(integerNumber): 121 | selectDict = { 122 | 0:"A", 123 | 1:"B", 124 | 2:"C", 125 | 3:"D" 126 | } 127 | return selectDict[integerNumber] 128 | 129 | opener = getOpener() 130 | userInfo = getUserInfo(opener) 131 | userId = userInfo['user']['user_id'] 132 | randomChoice = getRandom(k) 133 | answerRows = getSubJectAnswer(opener,userId) 134 | topicRows = getSubJect(opener,subJectUrl) 135 | postData = subJectToAnwser(topicRows,answerRows,randomChoice) 136 | submit(postData) 137 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 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 | 62 | 63 | 64 | 65 | SNMP所采用的传输层协议是___ 66 | result_data 67 | student_topic_rows 68 | 69 | 70 | 71 | 72 | 73 | 74 | 76 | 77 | 99 | 100 | 101 | 102 | 103 | true 104 | DEFINITION_ORDER 105 | 106 | 107 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 137 | 138 | 141 | 142 | 143 | 144 | 147 | 148 | 151 | 152 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 181 | 182 | 183 | 184 | 202 | 203 | 221 | 222 | 240 | 241 | 259 | 260 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 309 | 310 | 323 | 324 | 342 | 343 | 355 | 356 | project 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 391 | 392 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 425 | 426 | 427 | 428 | 1502860473530 429 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 462 | 463 | 465 | 466 | 467 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | --------------------------------------------------------------------------------