disalbe answer dictionary feature

master
Max Yao 2019-12-18 11:45:48 +08:00
parent 6cc0b5853f
commit 503e2c74f6
2 changed files with 46 additions and 24 deletions

View File

@ -36,12 +36,15 @@ logger = logging.getLogger('logger')
# for check reg_info
import requests
import warnings
from urllib3.exceptions import InsecureRequestWarning
warnings.simplefilter('ignore',InsecureRequestWarning)
#執行方式python chrome_tixcraft.py 或 python3 chrome_tixcraft.py
#附註1沒有寫的很好很多地方應該可以模組化。
#附註2
CONST_APP_VERSION = u"MaxBot (2019.12.10)"
CONST_APP_VERSION = u"MaxBot (2019.12.17)"
CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom"
CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"
@ -130,6 +133,7 @@ if not config_dict is None:
kktix_area_keyword = ""
kktix_area_keyword = kktix_area_keyword.strip()
# disable password brute force attack
if 'answer_dictionary' in config_dict["kktix"]:
kktix_answer_dictionary = config_dict["kktix"]["answer_dictionary"]
if kktix_answer_dictionary is None:
@ -1390,7 +1394,7 @@ def kktix_assign_ticket_number():
current_ticket_number = str(ticket_price_input.get_attribute('value'))
if current_ticket_number == "0":
try:
print("asssign ticket number:%s" % str(ticket_number))
#print("asssign ticket number:%s" % str(ticket_number))
ticket_price_input.clear()
ticket_price_input.send_keys(ticket_number)
@ -1549,7 +1553,7 @@ def kktix_reg_new_main(url, answer_index, registrationsNewApp_div, is_finish_che
is_assign_ticket_number = kktix_assign_ticket_number()
if is_assign_ticket_number:
break
print('is_assign_ticket_number:', is_assign_ticket_number)
#print('is_assign_ticket_number:', is_assign_ticket_number)
#---------------------------
# part 3: captcha
@ -1584,6 +1588,7 @@ def kktix_reg_new_main(url, answer_index, registrationsNewApp_div, is_finish_che
if captcha_text_div is not None:
is_captcha_appear = True
captcha_text_div_text = ""
try:
captcha_text_div_text = captcha_text_div.text
except Exception as exc:
@ -1873,8 +1878,9 @@ def kktix_reg_new_main(url, answer_index, registrationsNewApp_div, is_finish_che
#print("captcha_password_string:", captcha_password_string)
# ask question.
if captcha_password_string is None:
answer_list, my_answer_delimitor = get_answer_list_by_question(captcha_text_div_text)
# 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)
# final run.
if captcha_password_string is not None:
@ -3051,6 +3057,7 @@ def main():
driver.switch_to.window(driver.window_handles[0])
except Exception as excSwithFail:
pass
except UnexpectedAlertPresentException as exc1:
#print('UnexpectedAlertPresentException at this url:', url )
#print("last_url:", last_url)
@ -3070,7 +3077,9 @@ def main():
except NoAlertPresentException:
pass
#print('*crickets*')
except Exception as exc:
logger.error('Exception')
logger.error(exc, exc_info=True)
#UnicodeEncodeError: 'ascii' codec can't encode characters in position 63-72: ordinal not in range(128)

View File

@ -16,7 +16,7 @@ import os
import sys
import json
CONST_APP_VERSION = u"MaxBot (2019.12.10)"
CONST_APP_VERSION = u"MaxBot (2019.12.17)"
CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom"
CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"
@ -72,6 +72,7 @@ def btn_save_act(slience_mode=False):
global chk_state_auto_press_next_step_button
global chk_state_auto_fill_ticket_number
global txt_kktix_area_keyword
# disable password brute force attack
global txt_kktix_answer_dictionary
global chk_state_date_auto_select
@ -113,7 +114,8 @@ def btn_save_act(slience_mode=False):
config_dict["kktix"]["auto_fill_ticket_number"] = bool(chk_state_auto_fill_ticket_number.get())
config_dict["kktix"]["area_mode"] = combo_kktix_area_mode.get().strip()
config_dict["kktix"]["area_keyword"] = txt_kktix_area_keyword.get().strip()
config_dict["kktix"]["answer_dictionary"] = txt_kktix_answer_dictionary.get().strip()
# disable password brute force attack
#config_dict["kktix"]["answer_dictionary"] = txt_kktix_answer_dictionary.get().strip()
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()
@ -171,10 +173,12 @@ def showHideBlocks(all_layout_visible=False):
# for kktix only.
global lbl_kktix_area_mode
global lbl_kktix_answer_dictionary
global txt_kktix_answer_dictionary
global txt_kktix_answer_dictionary_index
# disable password brute force attack
#global lbl_kktix_answer_dictionary
#global txt_kktix_answer_dictionary
#global txt_kktix_answer_dictionary_index
global combo_kktix_area_mode
global combo_kktix_area_mode_index
@ -200,7 +204,8 @@ def showHideBlocks(all_layout_visible=False):
pass
else:
combo_kktix_area_mode.grid_forget()
txt_kktix_answer_dictionary.grid_forget()
# disable password brute force attack
#txt_kktix_answer_dictionary.grid_forget()
else:
frame_group_kktix.grid_forget()
@ -211,23 +216,27 @@ def showHideBlocks(all_layout_visible=False):
if u'kktix' in new_homepage:
combo_kktix_area_mode.grid(column=1, row=combo_kktix_area_mode_index, sticky = W)
txt_kktix_answer_dictionary.grid(column=1, row=txt_kktix_answer_dictionary_index, sticky = W)
# disable password brute force attack
#txt_kktix_answer_dictionary.grid(column=1, row=txt_kktix_answer_dictionary_index, sticky = W)
else:
combo_kktix_area_mode.grid_forget()
txt_kktix_answer_dictionary.grid_forget()
# disable password brute force attack
#txt_kktix_answer_dictionary.grid_forget()
else:
frame_group_tixcraft.grid(column=0, row=frame_group_tixcraft_index, padx=UI_PADDING_X)
frame_group_kktix.grid_forget()
lbl_kktix_area_mode_default = 'Area select order'
lbl_kktix_answer_default = 'Answer Dictionary'
#lbl_kktix_answer_default = 'Answer Dictionary'
if u'kktix' in new_homepage:
lbl_kktix_area_mode['text'] = lbl_kktix_area_mode_default
lbl_kktix_answer_dictionary['text'] = lbl_kktix_answer_default
# disable password brute force attack
#lbl_kktix_answer_dictionary['text'] = lbl_kktix_answer_default
else:
lbl_kktix_area_mode['text'] = ''
lbl_kktix_answer_dictionary['text'] = ''
# disable password brute force attack
#lbl_kktix_answer_dictionary['text'] = ''
showHideTixcraftBlocks()
@ -322,7 +331,8 @@ def MainMenu(root):
kktix_area_mode = ""
kktix_area_keyword = ""
kktix_answer_dictionary = ""
# disable password brute force attack
#kktix_answer_dictionary = ""
date_auto_select_enable = None
date_auto_select_mode = ""
@ -369,6 +379,7 @@ def MainMenu(root):
kktix_area_keyword = ""
kktix_area_keyword = kktix_area_keyword.strip()
# disable password brute force attack
if 'answer_dictionary' in config_dict["kktix"]:
kktix_answer_dictionary = config_dict["kktix"]["answer_dictionary"]
if kktix_answer_dictionary is None:
@ -413,7 +424,8 @@ def MainMenu(root):
print("auto_fill_ticket_number", auto_fill_ticket_number)
print("kktix_area_mode", kktix_area_mode)
print("kktix_area_keyword", kktix_area_keyword)
print("kktix_answer_dictionary", kktix_answer_dictionary)
# disable password brute force attack
#print("kktix_answer_dictionary", kktix_answer_dictionary)
# for tixcraft
print("==[tixcraft]==")
@ -552,19 +564,20 @@ def MainMenu(root):
group_row_count+=1
# disable password brute force attack
global lbl_kktix_answer_dictionary
lbl_kktix_answer_dictionary = Label(frame_group_kktix, text="Answer Dictionary")
lbl_kktix_answer_dictionary.grid(column=0, row=group_row_count, sticky = E)
#lbl_kktix_answer_dictionary = Label(frame_group_kktix, text="Answer Dictionary")
#lbl_kktix_answer_dictionary.grid(column=0, row=group_row_count, sticky = E)
global txt_kktix_answer_dictionary
global txt_kktix_answer_dictionary_index
txt_kktix_answer_dictionary_index = group_row_count
global txt_kktix_answer_dictionary_value
txt_kktix_answer_dictionary_value = StringVar(frame_group_kktix, value=kktix_answer_dictionary)
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)
#txt_kktix_answer_dictionary_value = StringVar(frame_group_kktix, value=kktix_answer_dictionary)
#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_hr = Label(frame_group_kktix, text="")
lbl_hr.grid(column=0, row=group_row_count)