很简短的目录

  • Unipus读写课程做题工具
    • 小小的原理
    • 代码
    • 这里是效果~
    • 更改做题页面

Unipus读写课程做题工具

小小的原理

实际方法就是模拟人工输入寻找对应文本框(笑)
并且利用的是完成作业的用户可以Answer可以展示正确答案
小细节,对方的正确与否不影响你的正确率哦~

python很烂,现学的

记得安装 selenium库和对应浏览器插件
这里我使用的是Edge和Chrome

注:默认不会打开浏览器,自动做题直至结束
可以选择debug=0开启 debug 会显示浏览器并在每道题结束后进行暂停以便人工核对

代码

下面是写的垃圾代码

import time
from selenium import webdriver
from msedge.selenium_tools import EdgeOptions, Edge
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Selectdebug=1def login(driver,bookname):name_input = driver.find_element_by_id('username')password_input = driver.find_element_by_id('password')username = input('请输入学号:')password = input('请输入密码:')driver.maximize_window()name_input.clear()for i in username:# time.sleep(0.03)name_input.send_keys(i)for j in password:# time.sleep(0.03)password_input.send_keys(j)driver.find_element_by_xpath('//*[@id="LoginForm"]/table/tbody/tr[3]/td[2]/input').click()# time.sleep(0.5)# driver.get('http://211.81.52.7/login/hpindex_student.php')driver.refresh()courses = driver.find_elements_by_xpath('//*[@id="BookClassDIV"]/table/tbody/child::tr/td[2]/ul/li/a')for course in courses:if bookname in course.text:# print(type(course.get_attribute('href')))link = course.get_attribute('href')print(link[link.find('BookID=') + 7:link.find('BookID=') + 10])print(course.get_attribute('href'))print(course.text)# driver.get('http://211.81.52.7/book/book{}/index.php?Quiz=N&whichActionPage='.format(course.text))course.click()driver.refresh()return link[link.find('BookID=') + 7:link.find('BookID=') + 10]else:print('未找到相关课程!')returndef isElementExist(browser,xpath):flag=Truetry:browser.find_element_by_xpath(xpath)return flagexcept:flag=Falsereturn flagdef setBlank(book_name,unit,section,sister):url='http://{}/book/book{}/uyu27blank.php?UnitID={}&SectionID={}&SisterID={}'.format(ip,book_name, unit, section, sister)driver.get(url)driver2.get(url)driver2.find_element_by_xpath("/html/body/div[3]/div[4]/a").click()blankrow1 = driver.find_elements_by_class_name("x-su-text-1")blankrow2 = driver2.find_elements_by_xpath(" //*[@class='x-su-text-1'] | //*[@class='zqda']")if isElementExist(driver,"/html/body/div[3]/div[3]")==False:returnbutton = driver.find_element_by_xpath("/html/body/div[3]/div[3]")offest=0for blank1 in blankrow1:blank2=blankrow2[blankrow1.index(blank1)+offest]if(len(blankrow2)>blankrow1.index(blank1)+offest+1):blank3=blankrow2[blankrow1.index(blank1)+offest+1]else:blank3=blank2blank1.clear()if(blank3.get_attribute("class")=="x-su-text-1"):blank1.send_keys(blank2.get_attribute("value"))else:offest+=1blank1.send_keys(blank3.text[1:len(blank3.text)-1])print("uyu27blank.php",unit,section,sister)if(debug==0):answer=input()button.click()try:driver.find_element_by_class_name('layui-layer-btn0').click()except:passdef dragBankedcloze(book_name,unit):url = 'http://{}/book/book{}/uyu211drop.php?UnitID={}&SectionID={}&SisterID={}'.format(ip,book_name, unit, 2, 11)driver.get(url)driver2.get(url)driver2.find_element_by_xpath("/html/body/div[3]/div[7]/a/div").click()blankrow1 = driver.find_elements_by_xpath(" //*[@class='droppable ui-droppable' and @type='text']")offest=0blankrow2 = driver2.find_elements_by_xpath(" //*[@class='droppable ui-droppable' and @type='text'] | //*[@class='tkt-c']")for blank1 in blankrow1:blank2=blankrow2[blankrow1.index(blank1)+offest]if(len(blankrow2)>blankrow1.index(blank1)+offest+1):blank3=blankrow2[blankrow1.index(blank1)+offest+1]else:blank3=blank2if(blank3.get_attribute("class")=="droppable ui-droppable"):driver.execute_script("arguments[0].value = arguments[1];",blank1,blank2.get_attribute("value"))else:offest+=1driver.execute_script("arguments[0].value = arguments[1];",blank1,blank3.text[1:len(blank3.text)-1])print("uyu211drop.php ",unit)if(debug==0):answer=input()try:button = driver.find_element_by_xpath("/html/body/div[3]/a/div")button.click()driver.find_element_by_class_name('layui-layer-btn0').click()except:passdef setUnderstanding(book_name, unit):url = 'http://{}/book/book{}/uyu64mc.php?UnitID={}&SectionID={}&SisterID={}'.format(ip,book_name, unit, 6, 4)driver.get(url)driver2.get(url)driver2.find_element_by_xpath("/html/body/div[4]/div[3]/div[4]").click()driver.find_element_by_id('TR_0')for i in range(8):inputs = driver.find_elements_by_xpath('//*[@id="TR_' + str(i) + '"]/td[2]/input')outputs = driver2.find_elements_by_xpath('//*[@id="TR_' + str(i) + '"]/td[2]/input')# //*[@id="TR_0"]/td[1]/inputfor item in inputs:item2=outputs[inputs.index(item)]if item2.get_attribute('checked'):item.click()break# time.sleep(0.3)  # 每做一题休息半秒   inputs = driver.find_elements_by_xpath('//*[@id="TR_' + str(i) + '"]/td[1]/input')outputs = driver2.find_elements_by_xpath('//*[@id="TR_' + str(i) + '"]/td[1]/input')# //*[@id="TR_0"]/td[1]/inputfor item in inputs:item2=outputs[inputs.index(item)]if item2.get_attribute('checked'):item.click()break# driver.find_element_by_xpath("//div[contains(@class,'submit')]/a").click()print("uyu64mc.php ",unit)if(debug==0):answer=input()driver.find_element_by_xpath("//div[contains(@class,'submit')]").click()try:driver.find_element_by_class_name('layui-layer-btn0').click()except:pass# time.sleep(1)def setBlankTK(book_name,unit):url='http://{}/book/book{}/uyu29blank.php?UnitID={}&SectionID={}&SisterID={}'.format(ip,book_name, unit, 2, 9)driver.get(url)driver2.get(url)driver2.find_element_by_xpath("/html/body/div[3]/div[3]/div[2]").click()blankrow1 = driver.find_elements_by_xpath("//*[@class='tk']/*[1]")blankrow2 = driver2.find_elements_by_xpath("//*[@class='wt-3']/*[@class='dc']")if isElementExist(driver,"/html/body/div[3]/div[2]/div[2]") == False:returnfor blank1 in blankrow1:blank2=blankrow2[blankrow1.index(blank1)]blank1.clear()strlist=blank2.text.split(' / ')blank1.send_keys(strlist[0])print("uyu29blank.php",unit)if(debug==0):answer=input()try:button = driver.find_element_by_xpath("/html/body/div[3]/div[2]/div[2]")button.click()driver.find_element_by_class_name('layui-layer-btn0').click()except:pass#——————————————————————————————————————
print('unipus互助 by:Tricrystal')
bookname=input('输入需要完成的书名(eg:读写2):')
ip=input('输入unipus的ip地址 (eg:1.1.1.1) :')
print('开启浏览器Ing....')
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('log-level=3')
if debug!=0:chrome_options.add_argument('--headless') chrome_options.add_argument('--disable-gpu')chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('http://{}'.format(ip))
driver.minimize_window()edge_options = EdgeOptions()
edge_options.use_chromium = True
if debug!=0:edge_options.add_argument('headless') edge_options.add_argument('disable-gpu')edge_options.add_experimental_option('excludeSwitches', ['enable-logging'])
edge_options.add_argument('log-level=3')
driver2 = Edge(options=edge_options)
driver2.get('http://{}'.format(ip))
driver2.minimize_window()print('浏览器开启完毕')
print('登录待完成用户')
book = login(driver,bookname)
print('登录已完成用户')
login(driver2,bookname)
i=1
while i!=8:dragBankedcloze(book,i)setBlankTK(book,i)setUnderstanding(book,i)#这里根据你自己的书的结构更改setBlank(book,i,2,7) setBlank(book,i,2,10)setBlank(book,i,6,6)setBlank(book,i,6,7)setBlank(book,i,7,3)setBlank(book,i,2,12)i+=1
driver.get("http://{}/book/book138/recordsummary.php".format(ip))
driver2.get("http://{}/book/book138/recordsummary.php".format(ip))
print('已经做完了呦,记得检查哦')

这里是效果~


上面为需要写的人,下面为已写的人


运行中界面 首行为页面 第二行为 unitID 第三行为 SectionID 第四行为 SisterID

更改做题页面

http://xx.xx.xx.xx/book/book138/uyu33.php?UnitID=3&SectionID=3&SisterID=3
其中可通用的目前只有uyu27blank,其中后面的三个数字参数分别为UnitID,SectionID,SisterID

有问题可以发邮箱到 miku_mi@foxmail.com

Unipus读写课程做题工具相关推荐

  1. 国外问卷调查做题工具

    大家好,今天我们来聊一下做国外问卷调查都需要用到哪些电脑工具,因为是做国外的问卷调查,调查的对象都是针对外国人,所以我们要把自己伪装成一个外国人的答题方式,最重要的是就把你这台答题的电脑伪装成为一台国 ...

  2. Algorithm:数学建模大赛(国赛和美赛)的简介/内容、数学建模做题流程、历年题目类型及思想、常用算法、常用工具之详细攻略

    Algorithm:数学建模大赛(国赛和美赛)的简介/内容.数学建模做题流程.历年题目类型及思想.常用算法.常用工具之详细攻略 目录 国内数学建模大赛简介 1.本科生数学建模大赛 2.研究生数学建模大 ...

  3. 计算机一级ps哪里有刷题的,同事用Excel做了一个刷题工具,看完我就跪了!

    本文作者:绿水零 本文编辑:竺兰 PS: 文末可获取配套练习文件,一定要看到最后哦~ 马上就到年末了,等着你的除了过年,还有考试. 被考试什么的支配的,可不只有中小学生,因为还有大学考试.研究生考试. ...

  4. AI学高数达到MIT本科水平,学了微积分线性代数概率论等6门课,不光能做题还能出题...

    梦晨 发自 凹非寺 量子位 报道 | 公众号 QbitAI 让语言模型做数学题,有多难? 强如GPT-3,在9-12岁的小学数学上,第一次才考20多分. 去年底GPT-3用上新方法努力了很久终于拿到5 ...

  5. 系统架构设计师(截图+做题思路+目录)

    目录 文章目录 目录 系统架构设计师考试介绍 计算机组成与体系结构 计算机体系结构分类-Flkynn CISC与RISC的区别 层次化存储结构 Cache 局部性原理 主存-分类 磁盘结构与参数 磁盘 ...

  6. 计算机网络自顶向下做题总结一(应用层)

    文章目录 计算机网路自顶向下做题总结一 第一章 1.1.复习题 1.2.作业题 1.3.第一次实验wireshark入门 第二章 2.1.telnet在windows使用 2.2.SMTP协议和HTT ...

  7. 计算机二级一做题就不会,2017年计算机二级考试做题经验分享

    2017年计算机二级考试做题经验分享 计算机科学的大部分研究是基于"冯·诺依曼计算机"和"图灵机"的,它们是绝大多数实际机器的计算模型.下面是小编整理的关于计算 ...

  8. 温州大学c语言作业布置的网站,老师APP上布置作业 三年级娃为刷排名半夜做题_央广网...

    在温州读小学三年级的皮皮(化名),因为学习需要,在妈妈黄女士的手机里安装了5个APP学习软件.有数学速算的,英语配音的,还有语文复习的.这些软件,都是班上的老师推荐安装的. 每天放学回家,皮皮就拿着黄 ...

  9. 怎么判断第几范式例题_学完就忘、做题就懵!初级会计怎么备考才能更高效?...

    备考初级会计之路真是艰辛,目前官方政策初级会计职称是一年一考,早早开始学吧,又有惰性,总觉得时间还很多,报完名再开始学吧,又总是搞不透彻知识点,一个知识点需要一天甚至更多才能消化...... 很多时候 ...

最新文章

  1. UTF-8 CPP的使用
  2. TEASER-plusplus 编译测试
  3. 华为5ipro详细参数使用功能_详细讲解双计双控智能电表技术参数以及新增功能优势...
  4. Nominal data 与Ordinal data区别
  5. C++如何限制对象在堆上或栈上生成
  6. C#操作XML方法集合
  7. 恒大汽车:仍在就出售新能源汽车生活项目等资产进行磋商
  8. 携程否认竞价排名;戴尔为“吃鸡外挂”致歉;腾讯将发区块链游戏 | CSDN极客头条
  9. 【云图】如何制作中国贪官落马图?
  10. codeforces 261D Maxim and Increasing Subsequence(树状数组优化最长上升子列)
  11. C++基础教程之类与对象
  12. oracle常用函数汇总【持续更新中...】
  13. 50个查询系列-第五个查询:查询没学过“叶平”老师课的同学的学号、姓名;...
  14. 超级计算机燕 排名,正文 第一卷 六年之前 HK171 舍弃的超级计算机燕? (485加更)...
  15. 大漠为什么不支持win10_大漠插件3.1233 支持WIN10的游戏后台么
  16. ThreadPoolTaskScheduler实现动态管理定时任务
  17. idea合并分支只合并某次提交的代码
  18. ubuntu下安装navicat
  19. 【Deep Learning学习笔记】Deep learning for nlp without magic_Bengio_ppt_acl2012
  20. Java基础之面向对象部分详解

热门文章

  1. 迎接新时代,维谛技术全面呈献硬核策略
  2. 腾讯发布“天眼云镜”主机安全产品
  3. html中怎么制作选择头像,网页中的个人头像选择框(转)
  4. Github上如何设置个人头像
  5. CTP综合交易平台接口-程序化交易编程模板(VC源码)
  6. 用计算机弹大白菜鸡毛菜,抖音大白菜鸡毛菜什么意思 大白菜鸡毛菜意思出处介绍...
  7. 王半仙儿的日记-0002
  8. 联想笔记本的window server R2系统安装、优化及相关软件安装全过程
  9. 读书笔记软件调试之道 :问题的核心-诊断
  10. JZ 20 表示数值的字符串:抽象与逻辑练习