예제 #1
0
def GetPaper():

        # 多线程2019.7.5
        try:
            thread.start_new_thread(ModelOne,("argc","argv"))
            printf("The Thread is Working ...")
            time.sleep(1)
        except:
            printf("Thread Error:unable to start thread", "red")
예제 #2
0
def logo():
    printf( '''
        _________ .__                       .__        ____  __.__.__  .__                
        \_   ___ \|  | _____    ______ _____|__| ____ |    |/ _|__|  | |  |   ___________ 
        /    \  \/|  | \__  \  /  ___//  ___/  |/ ___\|      < |  |  | |  | _/ __ \_  __ \ 
        \     \___|  |__/ __ \_\___ \ \___ \|  \  \___|    |  \|  |  |_|  |_\  ___/|  | \/
        \______  /____(____  /____  >____  >__|\___  >____|__ \__|____/____/\___  >__|   
                \/          \/     \/     \/        \/        \/                 \/       
                                                            Editor:Migraine-sudo
                                                            2019.7  
    ''',"purple")
예제 #3
0
def GetUser():  # call back
    # 调用登陆模块
    username = entry1.get()
    password = entry2.get()
    print "Hello " + username + "!"
    printf("Setting Browser...Please Wait", "purple")

    try:
        browser = Login(username, password)
    except:
        BaseException
        print("Wrong password!")
예제 #4
0
def PrintInformation():
    Information = '''
    Version:v1.00-beta
    Date:2019.7
    Github:Migraine-sudo
    Welcome to My Github,to make our world better!   
    Enter M to For More...'''
    printf("\n" + Information, 'purple')
    URL = 'https://github.com/migraine-sudo/ClassicKiller'
    ifForMore = raw_input()
    if ifForMore == 'M':
        printf("visiting " + URL, 'blue')
        browser = webdriver.Firefox()
        browser.get(URL)

    raw_input("Enter to continue...\n\n\n\n\n")
예제 #5
0
def ModelOne(argc,argv):
    # 调用登陆模块
    username = entry1.get()
    password = entry2.get()
    print "Hello " + username + "!"
    printf("Setting Browser...Please Wait", "purple")

    try:
        browser = Login(username, password)
    except:
        BaseException
        print("Wrong password!")

    x = entry_paper.get()
    paperid = int(x)

    A = Answer()
    A.GetAnswer(browser, paperid)
예제 #6
0
    def get_answer(self, question_list, option_name_list, option_value_list):
        filename = 'answer.csv'  #放在根目录
        csvFile = codecs.open(filename, 'r', 'gbk')
        reader = csv.reader(csvFile)
        i = 0
        answer = []
        Wrongnumber = 0
        for qu in csvFile:
            answer.append(qu)
        checksum = 0
        for i in range(100):  #遍历题目
            for qu in answer:
                if question_list[i] in qu:
                    #print "match"+str(i)
                    checksum = 0
                    for x in qu:  #提取答案
                        if 'A' <= x and x <= 'E':
                            checksum = 1
                            #print "i="+str(i)
                            #print "name="+option_name_list[i]
                            if x == 'A':
                                #print "value="+option_value_list[i]
                                Click_Value(self.browser, option_value_list[i])
                            if x == 'B':
                                #print "value=" + str(int(option_value_list[i])+1)
                                Click_Value(self.browser,
                                            str(int(option_value_list[i]) + 1))
                            if x == 'C':
                                #print "value=" + str(int(option_value_list[i])+2)
                                Click_Value(self.browser,
                                            str(int(option_value_list[i]) + 2))
                            if x == 'D':
                                #print "value=" + str(int(option_value_list[i])+3)
                                Click_Value(self.browser,
                                            str(int(option_value_list[i]) + 3))
                            if x == 'E' and i > 60:
                                #print "value=" + str(int(option_value_list[i])+4)
                                Click_Value(self.browser,
                                            str(int(option_value_list[i]) + 4))
                            #selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id="143517"]

            if checksum == 1 and i != 100:
                sleep(0.1)
                try:
                    Click_Next(self.browser)  #下一题
                except:
                    BaseException
                #selenium.common.exceptions.ElementNotInteractableException: Message: Element <button class="btn btn-success next-btn"> could not be scrolled into view

            elif checksum == 0 and i != 100:
                Click_Value(self.browser,
                            str(int(option_value_list[i]) + 1))  #如果没搜到答案,选B
                Wrongnumber = Wrongnumber + 1
                sleep(0.1)
                try:
                    Click_Next(self.browser)  #下一题
                except:
                    BaseException
            else:
                printf("finish!", 'purple')
                printf("WrongNumber=" + Wrongnumber, "purple")
예제 #7
0
def Model():
    printf("\n-------------Models-------------","yellow")
    printf("\t1.Classic Model","blue")
    printf("\t2.Super Model","blue")
    printf("\t3.Settings", "blue")
    printf("\t4.About","blue")
    printf("\t5.Exit","red")
    printf("--------------------------------", "yellow")
    Model=raw_input("Please Choice Model<<")
    return Model
예제 #8
0
def main():
    # 打印Logo
    logo()
    ifContinue = True
    while ifContinue:
        model = Model()
        if model == '1':  #常规模式
            username = raw_input("Please input your username<<")
            password = raw_input("password<<")
            while (True):
                printf("Setting Browser...Please Wait", "purple")
                try:
                    browser = Login(username, password)
                except:
                    BaseException
                    print("Wrong password!")
                    username = raw_input("Please reinput your username<<")
                    password = raw_input("password<<")
                    continue

                printf("enter 0 to exit", "red")
                paperid = raw_input("Please input the ID of your paper<<")
                if paperid == '0':
                    break
                # 创建解答模块的实例
                #多线程2019.7.5
                try:
                    thread.start_new_thread(ModelOne, (browser, paperid))
                    printf("The Thread is Working ...")
                    time.sleep(1)
                except:
                    printf("Thread Error:unable to start thread", "red")

        if model == '2':
            printf("Warning ,this models is still in test!")
            username = raw_input("Please input your username<<")
            password = raw_input("password<<")
            browser = Login(username, password)
            while (True):
                papers = raw_input("How many papers do you want to Kill<<")
                for i in range(1, papers):
                    A = Answer()
                    A.GetAnswer(browser, i)
        if model == '3':
            printf("\n\tSettings is not available now!\n\n", 'blue')
        if model == '4':
            PrintInformation()
        if model == '5':
            ifContinue = False
            printf("Good Night!", "purple")