diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 8be6d38..e2ce69b 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -44,7 +44,7 @@ warnings.simplefilter('ignore',InsecureRequestWarning) #附註1:沒有寫的很好,很多地方應該可以模組化。 #附註2: -CONST_APP_VERSION = u"MaxBot (2019.12.17)" +CONST_APP_VERSION = u"MaxBot (2020.01.12)" CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom" CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top" @@ -76,8 +76,8 @@ browser = None ticket_number = None facebook_account = None -auto_press_next_step_button = None -auto_fill_ticket_number = None +auto_press_next_step_button = False +auto_fill_ticket_number = False auto_fill_ticket_price = None date_auto_select_enable = None @@ -91,13 +91,14 @@ area_keyword = None area_keyword_1 = None area_keyword_2 = None - kktix_area_auto_select_mode = None kktix_area_keyword = None kktix_answer_dictionary = None kktix_answer_dictionary_list = None +auto_guess_options = False + if not config_dict is None: # read config. if 'homepage' in config_dict: @@ -143,6 +144,8 @@ if not config_dict is None: if len(kktix_answer_dictionary) > 0: kktix_answer_dictionary_list = kktix_answer_dictionary.split(',') + if 'auto_guess_options' in config_dict["kktix"]: + auto_guess_options = config_dict["kktix"]["auto_guess_options"] # for ["tixcraft"] if 'tixcraft' in config_dict: @@ -183,6 +186,7 @@ if not config_dict is None: print("auto_fill_ticket_number", auto_fill_ticket_number) print("kktix_area_keyword", kktix_area_keyword) print("kktix_answer_dictionary", kktix_answer_dictionary) + print("auto_guess_options", auto_guess_options) # for tixcraft print("==[tixcraft]==") @@ -239,6 +243,8 @@ if not config_dict is None: '--disable-sync', '--disable-translate', + '--ignore-certificate-errors', + '--metrics-recording-only', '--no-first-run', '--no-experiments', @@ -249,7 +255,7 @@ if not config_dict is None: '--lang=zh-TW', '--stable-release-mode', '--use-mobile-user-agent', - '--webview-disable-safebrowsing-support', + '--webview-disable-safebrowsing-support', #'--no-sandbox', #'--incognito', ] @@ -1878,9 +1884,9 @@ def kktix_reg_new_main(url, answer_index, registrationsNewApp_div, is_finish_che #print("captcha_password_string:", captcha_password_string) # ask question. - # disable password brute force attack - #if captcha_password_string is None: - # answer_list, my_answer_delimitor = get_answer_list_by_question(captcha_text_div_text) + if auto_guess_options: + if captcha_password_string is None: + answer_list, my_answer_delimitor = get_answer_list_by_question(captcha_text_div_text) # final run. if captcha_password_string is not None: diff --git a/settings.json b/settings.json index b9074de..dc4d8f6 100644 --- a/settings.json +++ b/settings.json @@ -1 +1 @@ -{"tixcraft": {"area_auto_select": {"enable": true, "area_keyword": "", "mode": "from top to bottom", "area_keyword_2": "", "area_keyword_1": ""}, "date_auto_select": {"enable": true, "date_keyword": "", "mode": "from top to bottom"}}, "homepage1": "https://kktix.com", "homepage2": "https://tixcraft.com", "facebook_account": "", "browser1": "chrome", "browser2": "firefox", "kktix": {"auto_fill_ticket_price": "$1,500", "answer_dictionary": "", "area_keyword": "", "auto_press_next_step_button": true, "auto_fill_ticket_number": true, "area_mode": "random"}, "ticket_number": 2, "homepage": "https://tixcraft.com", "browser": "chrome"} \ No newline at end of file +{"tixcraft": {"area_auto_select": {"enable": true, "area_keyword": "", "mode": "from top to bottom", "area_keyword_2": "", "area_keyword_1": ""}, "date_auto_select": {"enable": true, "date_keyword": "", "mode": "from top to bottom"}}, "homepage1": "https://kktix.com", "homepage2": "https://tixcraft.com", "facebook_account": "", "browser1": "chrome", "browser2": "firefox", "kktix": {"auto_guess_options": true, "answer_dictionary": "", "area_keyword": "", "auto_press_next_step_button": true, "area_mode": "random", "auto_fill_ticket_number": true, "auto_fill_ticket_price": "$1,500"}, "ticket_number": 2, "homepage": "https://kktix.com", "browser": "chrome"} \ No newline at end of file diff --git a/settings.py b/settings.py index 0e21226..fbf39bf 100644 --- a/settings.py +++ b/settings.py @@ -16,7 +16,7 @@ import os import sys import json -CONST_APP_VERSION = u"MaxBot (2019.12.17)" +CONST_APP_VERSION = u"MaxBot (2020.01.12)" CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom" CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top" @@ -74,6 +74,8 @@ def btn_save_act(slience_mode=False): global txt_kktix_area_keyword # disable password brute force attack global txt_kktix_answer_dictionary + + global chk_state_auto_guess_options global chk_state_date_auto_select global txt_date_keyword @@ -116,6 +118,7 @@ def btn_save_act(slience_mode=False): config_dict["kktix"]["area_keyword"] = txt_kktix_area_keyword.get().strip() # disable password brute force attack #config_dict["kktix"]["answer_dictionary"] = txt_kktix_answer_dictionary.get().strip() + config_dict["kktix"]["auto_guess_options"] = bool(chk_state_auto_guess_options.get()) config_dict["tixcraft"]["date_auto_select"]["enable"] = bool(chk_state_date_auto_select.get()) config_dict["tixcraft"]["date_auto_select"]["date_keyword"] = txt_date_keyword.get().strip() @@ -326,13 +329,14 @@ def MainMenu(root): browser = None ticket_number = 1 - auto_press_next_step_button = None - auto_fill_ticket_number = None + auto_press_next_step_button = False # default not checked. + auto_fill_ticket_number = False # default not checked. kktix_area_mode = "" kktix_area_keyword = "" # disable password brute force attack #kktix_answer_dictionary = "" + auto_guess_options = False # default not checked. date_auto_select_enable = None date_auto_select_mode = "" @@ -379,6 +383,9 @@ def MainMenu(root): kktix_area_keyword = "" kktix_area_keyword = kktix_area_keyword.strip() + if 'auto_guess_options' in config_dict["kktix"]: + auto_guess_options = config_dict["kktix"]["auto_guess_options"] + # disable password brute force attack if 'answer_dictionary' in config_dict["kktix"]: kktix_answer_dictionary = config_dict["kktix"]["answer_dictionary"] @@ -426,6 +433,7 @@ def MainMenu(root): print("kktix_area_keyword", kktix_area_keyword) # disable password brute force attack #print("kktix_answer_dictionary", kktix_answer_dictionary) + print("auto_guess_options", auto_guess_options) # for tixcraft print("==[tixcraft]==") @@ -562,7 +570,7 @@ def MainMenu(root): txt_kktix_area_keyword = Entry(frame_group_kktix, width=20, textvariable = txt_kktix_area_keyword_value) txt_kktix_area_keyword.grid(column=1, row=group_row_count, sticky = W) - group_row_count+=1 + #group_row_count+=1 # disable password brute force attack global lbl_kktix_answer_dictionary @@ -577,7 +585,19 @@ def MainMenu(root): #txt_kktix_answer_dictionary = Entry(frame_group_kktix, width=20, textvariable = txt_kktix_answer_dictionary_value) #txt_kktix_answer_dictionary.grid(column=1, row=group_row_count, sticky = W) - #group_row_count+=1 + group_row_count+=1 + + lbl_auto_guess_options = Label(frame_group_kktix, text="Guess Options in Question") + lbl_auto_guess_options.grid(column=0, row=group_row_count, sticky = E) + + global chk_state_auto_guess_options + chk_state_auto_guess_options = BooleanVar() + chk_state_auto_guess_options.set(auto_guess_options) + + chk_auto_guess_options = Checkbutton(frame_group_kktix, text='Enable', variable=chk_state_auto_guess_options) + chk_auto_guess_options.grid(column=1, row=group_row_count, sticky = W) + + group_row_count+=1 lbl_hr = Label(frame_group_kktix, text="") lbl_hr.grid(column=0, row=group_row_count)