def login(driver, email, pwd, account_id, cookie, conn): login_url = 'https://www.pinterest.com/login/?referrer=home_page' login_flag = '' # if cookie: # login_state = cookieLogin(driver, cookie) # else: # login_state = 0 # if login_state == 0: driver.get(login_url) driver.find_element_by_name("id").send_keys(email) driver.find_element_by_name("password").send_keys(pwd) driver.find_element_by_xpath("//form//button").click() time.sleep(5) # Determine if the login was successful try: login_flag = driver.find_element_by_xpath('//form//button/div').text except: pass if login_flag == 'Log in': login_state = 0 else: login_state = 1 cookies = driver.get_cookies() cookies = json.dumps(cookies) cookies = cookies.replace('\\', '\\\\') cookies = cookies.replace('\"', '\\"') sql = "update account set cookie=%s where id=%s" commit_sql(conn, sql, (cookies, account_id)) return login_state
def create_board(self): print('Start create board') sql = "SELECT board_name from board_template order by RAND() limit 5" results = fetch_all_sql(self.conn, sql) for board_echo in results: board_name = board_echo['board_name'] print('Boardname', board_name) sql = "SELECT home_page from account where id=%s" result = fetch_one_sql(self.conn, sql, self.account_id) if result: home_page = result['home_page'] + 'boards/' try: self.driver.get(home_page) time.sleep(5) self.driver.find_element_by_xpath( '//button[@aria-label="Profile actions overflow"]').click() time.sleep(2) self.driver.find_element_by_xpath( '//div[@class="fixedHeader"]//div[text()="Create board"]').click() time.sleep(5) self.driver.find_element_by_xpath( '//form//input[@id="boardEditName"]').send_keys(board_name) time.sleep(1) self.driver.find_element_by_xpath( '//form//button[@type="submit"]').click() time.sleep(2) sql = "UPDATE account set created_boards=created_boards+1 where id=%s" commit_sql(self.conn, sql, self.account_id) time.sleep(3) except: pass self.driver.get('https://www.pinterest.com') time.sleep(5)
def get_account_count(self): sql = 'SELECT * from account_count' result = fetch_one_sql(self.conn, sql) if result: all_count = result['all_count'] real_time_num = result['real_time_num'] last_update_time = result['last_update_time'] if str(last_update_time) < self.current_time: change_domain_state = 'UPDATE domain set state=0 where state=1' commit_sql(self.conn1, change_domain_state) clear_domain_account = 'UPDATE domain set account_id=0' commit_sql(self.conn1, clear_domain_account) recovery_mode = 'UPDATE account set state=1 where state=4' commit_sql(self.conn, recovery_mode) # change_group = 'UPDATE follow_url set account_group=account_group+1 where for_config=10' # commit_sql(self.conn2, change_group) # all_group = 'SELECT count(-1) from follow_url where for_config=10' # all_group_count = fetch_one_sql( # self.conn2, all_group)['count(-1)'] # debug_group = 'UPDATE follow_url set account_group=1 where account_group>%s' # commit_sql(self.conn2, debug_group, all_group_count) sql = '''UPDATE account_count set last_update_time=%s, all_count= (SELECT count(1) from account where state=1 and port>100) where id=1''' commit_sql(self.conn, sql, self.current_time) else: sql = 'UPDATE account_count set real_time_num=(SELECT count(1) from account where state=1 and port>100) where id=1' commit_sql(self.conn, sql) if all_count - real_time_num > 10: os.system('shutdown -r -t 1800') time.sleep(9999) print('Too many account errors today to suspend operations!')
def access_home_page(self): home_page_element = self.driver.find_element_by_xpath( '//div[@aria-label="Saved"]/a') home_page = home_page_element.get_attribute('href') # print(home_page) sql = 'UPDATE account set home_page=%s where id=%s' commit_sql(self.conn, sql, (home_page, self.account_id)) time.sleep(2)
def upload_pic(self): all_upload_num = 0 sql = 'SELECT * from config where id=1' upload_num_res = fetch_one_sql(self.conn3, sql) if upload_num_res: all_upload_num = upload_num_res['upload_num'] print('Start uploading images...') while True: save_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") sql = "SELECT count(-1) as allnum from pin_upload where belong_web=%s and save_time>=%s" upload_num = fetch_one_sql( self.conn3, sql, (self.belong_web, self.current_time))['allnum'] if upload_num < all_upload_num: sql = 'SELECT * from pin_upload where saved=0 and belong_web=%s order by id asc limit 1' result = fetch_one_sql(self.conn3, sql, self.belong_web) if result: upload_pic_path = result['savelink'] upload_pic_board = result['saveboard'] upload_pic_id = result['Id'] self.driver.get(upload_pic_path) time.sleep(5) try: self.driver.find_element_by_xpath( "//input[@id='pickerSearchField']").send_keys(upload_pic_board) except Exception as e: print('Image save failed, element not found') time.sleep(1) try: win32api.keybd_event(13, 0, 0, 0) win32api.keybd_event( 13, 0, win32con.KEYEVENTF_KEYUP, 0) time.sleep(5) except Exception as e: pass if self.driver.page_source.find('Sorry! We blocked this link because it may lead to spam.') > -1: print('Domain name banned!') sql = 'UPDATE web_url set state=4 where url=%s' commit_sql(self.conn3, sql, self.belong_web) sql = 'UPDATE account set upload_done=664 where id=%s' commit_sql(self.conn, sql, account_id) break try: self.driver.find_element_by_xpath( "//div[@class='mainContainer']//div[1]/div/button").click() time.sleep(5) sql = 'UPDATE pin_upload set saved=1, save_time=%s where id=%s' commit_sql(self.conn3, sql, (save_time, upload_pic_id)) print('Uploading %d' % int(upload_num + 1)) write_txt_time() except Exception as e: pass else: print('Not data...') sql = 'UPDATE account set upload_done=669 where id=%s' commit_sql(self.conn, sql, account_id) time.sleep(3) break else: break
def follow(self): print('Turn on the follow function, count:', self.follow_num) sql = 'SELECT * from follow_url where for_config=10 limit %s' results = fetch_all_sql(self.conn2, sql, self.follow_num) if results: for res in results: web_url_id = res['Id'] web_url = res['web_url'] home_url = res['home_url'] sql = 'SELECT * from follow_history where user_id=%s and follow_account=%s' judge_exist = fetch_one_sql(self.conn2, sql, (web_url_id, self.email)) if judge_exist: print('Already followed!') else: try: self.driver.get(home_url) except: pass time.sleep(5) try: follow_state = self.driver.find_element_by_xpath( '//div[@class="fixedHeader"]//div[3]//div[2]/button/div' ).text if follow_state == 'Follow': self.driver.find_element_by_xpath( '//div[@class="fixedHeader"]//div[3]//div[2]/button' ).click() time.sleep(1) except: pass try: follow_state = self.driver.find_element_by_xpath( '//div[@class="CreatorFollowButton step0"]//div[2]/div' ).text if follow_state == 'Follow': self.driver.find_element_by_xpath( '//div[@class="CreatorFollowButton step0"]/div/div/div/div' ).click() time.sleep(1) except: pass sql = 'INSERT INTO follow_history (user_id, user, user_homepage, follow_account) values (%s, %s, %s, %s)' commit_sql(self.conn2, sql, (web_url_id, web_url, home_url, self.email)) write_txt_time()
def get_confirm_bank_info(): if confirm_identity_state == 0 and created_flag == 3: print('Confirm bank!') sql = 'SELECT * from paypal_confirm_info where used=0 and read_num<3 order by id limit 1' confirm_info = fetch_one_sql(conn, sql) if confirm_info: confirm_info_id = confirm_info['id'] confirm_user = confirm_info['user'] confirm_pwd = confirm_info['user_pwd'] routing_number = confirm_info['routing_number'] account_number = confirm_info['account_number'] confirm_type = confirm_info['pay_type'] sql = 'UPDATE paypal_confirm_info set used=1, read_num=read_num+1 where id=%s' commit_sql(conn, sql, confirm_info_id) if login_on_page == 1: login_paypal(driver, email, paypal_pwd) confirm_identity(conn, driver, email, confirm_info_id, confirm_user, confirm_pwd, routing_number, account_number, confirm_type) else: print('No Confirm Info!')
def pinterest_acotion(self): while True: if self.success_num > 4: os.system('shutdown -r') print('clear cache') time.sleep(9999) write_txt_time() print(self.hostname) self.get_account() if self.account_id > 0: self.success_num += 1 connect_vpn(self.conn1, self.vpn) write_txt_time() options = webdriver.ChromeOptions() options.add_argument('disable-infobars') options.add_argument('user-agent="%s"' % self.agent) prefs = { 'profile.default_content_setting_values': {'notifications': 2 } } options.add_experimental_option('prefs', prefs) self.driver = webdriver.Chrome(chrome_options=options) self.driver.maximize_window() login_state = login( self.driver, self.email, self.pwd, self.account_id, self.cookie, self.conn) time.sleep(2) try: home_button = self.driver.find_element_by_xpath( '//div[@aria-label="Home"]/a/div/div/div/div').text if home_button == 'Home': self.login_state_flag = 'on' except Exception as e: self.login_state_flag = 'off' print('State of home page:', self.login_state_flag) if self.login_state_flag == 'on': self.handle_pop_up() # print(login_state) if login_state == 1 and self.login_state_flag == 'on': sql = "UPDATE account set login_times=login_times+1 where id=%s" else: sql = "UPDATE account set state=4, login_times=0, action_computer='-' where id=%s" try: error_type = self.driver.find_element_by_xpath( '//form//button/span').text if error_type == 'Reset your password': sql = 'UPDATE account set state=9, login_times=0, action_computer="-" where id=%s' print('Error code: 9') except Exception as e: pass time.sleep(3) try: if self.driver.page_source.find('Your account has been suspended') > -1: sql = 'UPDATE account set state=99, login_times=0, action_computer="-" where id=%s' print('Error code: 99') except Exception as e: pass commit_sql(self.conn, sql, self.account_id) if login_state == 0 or self.login_state_flag == 'off': print('Account log-in failure, will exit the browser!') try: self.driver.quit() except: pass time.sleep(5) continue else: write_txt_time() self.access_home_page() if self.created_boards < 5: self.create_board() self.upload_pic() print('End of account processing...') self.driver.quit() sql = "UPDATE account set state=1, login_times=0, action_time=%s, action_computer='-' where id=%s" commit_sql(self.conn, sql, (self.current_time, self.account_id)) write_txt_time() time.sleep(10) else: print('Not data...') write_txt_time() time.sleep(10) print('The system will reboot in 30 minutes') os.system('shutdown -r -t 1800') time.sleep(9999)
def get_account(self): # self.get_account_count() if self.hostname == 'Vinter-Wang': sql = 'SELECT * from account where id=1' result = fetch_one_sql(self.conn, sql) else: sql = 'SELECT * from account where state=1 and action_time<%s and upload_done=666 and action_computer=%s order by action_time asc limit 1' result = fetch_one_sql( self.conn, sql, (self.current_time, self.hostname)) if result: self.account_id = result["id"] self.email = result["email"] self.pwd = result["pw"] self.vpn = result['vpn'] self.cookie = result['cookie'] self.config_id = result['setting_other'] self.created_boards = result['created_boards'] self.agent = result['agent'] self.belong_web = result['upload_web'] if not self.agent: sql = 'SELECT * from user_agent where terminal="computer" and read_time<4 order by RAND() limit 1' agent_in_sql = commit_sql(self.conn2, sql) if agent_in_sql: self.agent = agent_in_sql['user_agent'] agent_id = agent_in_sql['Id'] sql = 'UPDATE account set agent=%s where id=%s' commit_sql(self.conn, sql, (self.agent, self.account_id)) sql = 'UPDATE user_agent set read_time=read_time+1 where id=%s' commit_sql(self.conn2, sql, agent_id) print("Start account processing:", "ID:", self.account_id, "Email:", self.email) write_txt_time() else: sql = 'SELECT * from account where state=1 and action_time<%s and upload_done=666 and action_computer="-" order by action_time asc limit 1' result = fetch_one_sql(self.conn, sql, self.current_time) if result: self.account_id = result["id"] self.email = result["email"] self.pwd = result["pw"] self.vpn = result['vpn'] self.cookie = result['cookie'] self.config_id = result['setting_other'] self.created_boards = result['created_boards'] self.account_group = result['account_group'] self.agent = result['agent'] self.belong_web = result['upload_web'] if not self.agent: sql = 'SELECT * from user_agent where terminal="computer" and read_time<4 order by RAND() limit 1' agent_in_sql = fetch_one_sql(self.conn2, sql) if agent_in_sql: self.agent = agent_in_sql['user_agent'] agent_id = agent_in_sql['Id'] sql = 'UPDATE account set agent=%s where id=%s' commit_sql(self.conn, sql, (self.agent, self.account_id)) sql = 'UPDATE user_agent set read_time=read_time+1 where id=%s' commit_sql(self.conn2, sql, agent_id) print("Start account processing:", "ID:", self.account_id, "Email:", self.email) sql = "UPDATE account set action_computer=%s where id=%s" commit_sql(self.conn, sql, (self.hostname, self.account_id)) write_txt_time()
def main(): conn = pymysql.connect(host='localhost', port=3306, user='******', password='******', db='walmartmoneycard', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) step_flag = 1 get_info_success = 0 register_pp_mac = get_mac() current_time = (datetime.datetime.utcnow() + datetime.timedelta(hours=8)).strftime("%Y-%m-%d") sql = 'SELECT * from config' register_config = fetch_one_sql(conn, sql) if register_config: # 注册 paypal 账号类型 paypal_type = register_config['paypal_type'] # 是否添加卡信息 add_card = register_config['add_card'] # 是否添加银行信息 confirm_bank = register_config['confirm_bank'] # email 是否注册过卡信息 is_register_card_email = register_config['is_register_card_email'] # 账号注册程度: 1 仅注册激活 2 注册绑定银行卡 created_paypal_account_process = register_config[ 'created_paypal_account_process'] else: step_flag = 0 print('Missing configuration information!') if step_flag == 1: if created_paypal_account_process == 0: sql = 'SELECT * from email_info where id>7174 and emailIsUsed=%s and created_paypal_account=%s and register_pp_mac=%s' register_info = fetch_one_sql( conn, sql, (is_register_card_email, created_paypal_account_process, register_pp_mac)) if register_info: get_info_success = 1 email_id = register_info['id'] email = register_info['email'] print(email_id, email) else: if created_paypal_account_process == 0: sql = 'SELECT * from email_info where id>7174 and emailIsUsed=%s and created_paypal_account=%s and confirm_identity=0 and register_pp_mac="-" order by id desc limit 1' register_info = fetch_one_sql( conn, sql, (is_register_card_email, created_paypal_account_process)) if register_info: get_info_success = 1 email_id = register_info['id'] email = register_info['email'] print(email_id, email) with open('D:\\hostname.ini', 'r', encoding='utf-8') as fp: hostname = fp.read().strip() print(hostname) sql = 'UPDATE email_info set register_pp_mac=%s, register_machine=%s where email=%s' commit_sql(conn, sql, (register_pp_mac, hostname, email)) change_computer_info.verify() else: print('Not data!') if get_info_success == 1: email_pwd = register_info['email_pwd'] paypal_pwd = register_info['email_pwd'] + '@pp' recovery_email = register_info['recovery_email'] card_num = register_info['temporaryCardNumber'] expiration_date = register_info['expirationData'] card_csc = register_info['securityCode'] register_info_id = register_info['register_info_id'] confirm_identity_state = register_info['confirm_identity'] confirm_email = register_info['confirm_email'] created_flag = register_info['created_paypal_account'] if created_flag > 0: login_with_input_box = True else: login_with_input_box = False if is_register_card_email == 0: sql = 'SELECT * from register_info where id>34000 and userInfoIsUsed=0 and read_num<4 order by id limit 1' personal_info = fetch_one_sql(conn, sql) elif is_register_card_email == 1: sql = 'SELECT * from register_info where id=%s' personal_info = fetch_one_sql(conn, sql, register_info_id) if personal_info: register_info_id = personal_info['id'] print(register_info_id) try: firstname = personal_info['firstname'].capitalize() lastname = personal_info['lastname'].capitalize() name = firstname + ' ' + lastname except: name = ' ' birthdate = personal_info['birthdate'] address = personal_info['address'] city = personal_info['city'] state = personal_info['state'] sql = 'SELECT * from state_change where state_abb=%s' get_full_state = fetch_one_sql(conn, sql, state) if get_full_state: full_state = get_full_state['state_full'] zip_num = personal_info['zip'] ssn = personal_info['socialnumber'][-4:] phone_num = personal_info['mobilenumber'] if created_flag <= int( created_paypal_account_process ) or confirm_identity_state == 0 or confirm_email == 0: config_text = get_path_config() proxy_exe = config_text['proxy_exe'] client_exe = config_text['client_exe'] proxifier_path = config_text['proxifier_path'] proxifier_file = config_text['proxifier_file'] open_proxy_process(client_exe) driver = re_driver_and_choice_ip(paypal_type, state, city, proxy_exe, proxifier_path, proxifier_file) if paypal_type == 1: pass elif paypal_type == 2: if created_flag == 0: step_flag = paypal_here_page_one( driver, step_flag, firstname, lastname, email, paypal_pwd) if step_flag == 1: here_success = paypal_here_page_two( driver, name, address, city, full_state, zip_num, birthdate, phone_num, ssn) if here_success > -1 and is_register_card_email == 0: sql = sql = 'UPDATE register_info set userInfoIsUsed=1, email_id=%s, read_num=read_num+1 where id=%s' commit_sql(conn, sql, (email_id, register_info_id)) if here_success == 1: account_type = 2 elif here_success == 0: account_type = 3 if here_success > -1: sql = 'UPDATE email_info set account_type=3, paypal_pwd=%s, register_info_id=%s, created_paypal_time=%s, created_paypal_account=1' commit_sql(conn, sql, (account_type, paypal_pwd, register_info_id, current_time)) step_flag = 1 if confirm_email == 0 and step_flag == 1: # 需要进入登录框登录 if login_with_input_box: if paypal_type == 2: step_flag = paypal_here_page_one( driver, step_flag, firstname, lastname, email, paypal_pwd, True) login_paypal(driver, email, paypal_pwd) email_type = email.split('@')[-1] if email_type == 'gmail.com': print('Gmail!') login_gmail(driver, conn, email, email_pwd, paypal_pwd, recovery_email) elif email_type == 'yahoo.com': print('Yahoo!') step_flag = login_yahoo(driver, conn, email, email_pwd, paypal_pwd, step_flag, paypal_type) if step_flag == 1: sql = 'UPDATE email_info set confirm_email=1 where email=%s' commit_sql(conn, sql, email) time.sleep(3) # the_end() time.sleep(9999) else: print('Have already registered!')
def main(): hostname = socket.gethostname() while True: step_flag = 1 conn = pymysql.connect(host='localhost', port=3306, user='******', password='******', db='walmartmoneycard', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) conn1 = pymysql.connect(host='localhost', port=3306, user='******', password='******', db='vpn', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) sql = 'SELECT id, email, email_pwd from email_info where computer=%s and new_pwd is NULL order by id limit 1' result = fetch_one_sql(conn, sql, hostname) if result: email_id = result['id'] else: sql = 'SELECT id, email, email_pwd from email_info where computer="-" and new_pwd is NULL order by id limit 1' result = fetch_one_sql(conn, sql) if result: email_id = result['id'] sql = 'UPDATE email_info set computer=%s where id=%s' commit_sql(conn, sql, (hostname, email_id)) else: step_flag = 0 print('Not data!') break if step_flag == 1: email = result['email'] print(email) sql = 'SELECT account from vpn where id>2421 and id<4730 order by RAND() limit 1' vpn_result = fetch_one_sql(conn1, sql) if vpn_result: vpn = vpn_result['account'] connect_vpn(conn1, vpn) pwd = result['email_pwd'] options = webdriver.ChromeOptions() options.add_argument('disable-infobars') driver = webdriver.Chrome(chrome_options=options) driver.maximize_window() driver.get('https://mail.yahoo.com') time.sleep(3) if driver.page_source.find('This site can’t be reached') > -1: driver.quit() continue try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, 'login-username'))) element.send_keys(email) driver.find_element_by_id('login-signin').click() except Exception as e: step_flag = 0 if step_flag == 0: driver.quit() continue try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, 'login-passwd'))) element.send_keys(pwd) driver.find_element_by_id('login-signin').click() except Exception as e: step_flag = 0 if step_flag == 0: driver.quit() continue try: element = WebDriverWait(driver, 3).until( EC.presence_of_element_located((By.XPATH, '//button[@name="index"]'))) if element: print('Need verification, skip!') driver.quit() sql = 'UPDATE email_info set new_pwd="needVerification", computer="-" where id=%s' commit_sql(conn, sql, email_id) except Exception as e: pass try: driver.find_element_by_xpath('//span[text()="Done"]').click() except Exception as e: pass try: driver.find_element_by_xpath( '//button[@title="Maybe later"]').click() except Exception as e: pass try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.XPATH, '//label[@for="ybarAccountMenu"]'))) element.click() except Exception as e: step_flag = 0 if step_flag == 0: driver.quit() continue try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.XPATH, '//a[text()="Account Info"]'))) element.click() windows = driver.window_handles driver.switch_to.window(windows[1]) time.sleep(1) except Exception as e: pass try: element = WebDriverWait(driver, 10).until(EC.presence_of_element_located( (By.XPATH, '//span[text()="Account Security"]'))) element.click() except Exception as e: pass try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.XPATH, '//a[@class="cpw-link"]'))) element.click() except Exception as e: step_flag = 0 if step_flag == 0: driver.quit() continue new_pwd = pwd.strip() + 'print' try: element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, 'cpwd-password'))) element.send_keys(new_pwd) time.sleep(1) driver.find_element_by_id( 'cpwd-confirm-password').send_keys(new_pwd) time.sleep(1) driver.find_element_by_xpath( '//input[@value="Continue"]').click() sql = 'UPDATE email_info set new_pwd=%s, computer="-" where id=%s' commit_sql(conn, sql, (new_pwd, email_id)) print('Change password success!') except Exception as e: step_flag = 0 if step_flag == 0: driver.quit() continue time.sleep(3) driver.quit()
def green_dot_bank(driver, conn, register_id, firstname, lastname, address, city, zip_num, email, mobilenumber, socialnumber, birthdate, pinnumber, current_time, get_next_email=0): next_step = 1 input_first_name_XP = '//input[@id="FirstName"]' is_normal = explicit_wait(driver, "VOEL", [input_first_name_XP, "XPath"], 10, False) if is_normal: try: driver.find_element_by_xpath(input_first_name_XP).send_keys( firstname) time.sleep(1) driver.find_element_by_id('LastName').send_keys(lastname) time.sleep(1) driver.find_element_by_id('Street').send_keys(address) time.sleep(1) driver.find_element_by_id('Zip').send_keys(zip_num) time.sleep(1) driver.find_element_by_id('Email').send_keys(email) time.sleep(1) driver.find_element_by_id('Phone').send_keys(mobilenumber) time.sleep(1) driver.find_element_by_id('SSN').send_keys(socialnumber) time.sleep(1) driver.find_element_by_id('DateOfBirth').send_keys(birthdate) time.sleep(1) driver.find_element_by_id('AtmPin').send_keys(pinnumber) time.sleep(1) driver.find_element_by_id('IsAgreedToECA').click() time.sleep(1) driver.find_element_by_xpath( '//form[@id="main-form"]/section[2]/div/div/a').click() time.sleep(5) try: driver.find_element_by_xpath( '//button[@class="smallbutton"]').click() except: pass except: next_step = 0 else: sql = 'UPDATE register_info set userInfoIsUsed=0 where id=%s' commit_sql(conn, sql, register_id) next_step = 0 if next_step == 1: bankRoutingNumber_XP = '//tbody//tr[2]/td' bankRoutingNumber_result = explicit_wait( driver, "VOEL", [bankRoutingNumber_XP, "XPath"], 10, False) if bankRoutingNumber_result: try: bankRoutingNumber = driver.find_element_by_xpath( bankRoutingNumber_XP).text directDepositAccountNumber = driver.find_element_by_xpath( '//tbody//tr[3]/td').text print(bankRoutingNumber, directDepositAccountNumber) sql = 'UPDATE email_info set bankRoutingNumber=%s, directDepositAccountNumber=%s where email=%s' commit_sql( conn, sql, (bankRoutingNumber, directDepositAccountNumber, email)) driver.find_element_by_xpath( '//button[text()="CONTINUE"]').click() except: next_step = 0 else: next_step = 0 if next_step == 1: temporaryCardNumber_XP = '//main[@class="page-main"]//section[2]//p[1]' temporaryCardNumber_result = explicit_wait( driver, "VOEL", [temporaryCardNumber_XP, "XPath"], 10, False) if temporaryCardNumber_result: try: temporaryCardNumber = driver.find_element_by_xpath( temporaryCardNumber_XP).text if temporaryCardNumber: temporaryCardNumber = temporaryCardNumber.split( ':')[-1].strip().replace('-', ' ') expirationData = driver.find_element_by_xpath( '//main[@class="page-main"]//section[2]//p[2]').text expirationData_split = expirationData.split( ':')[-1].strip().split('/') expirationData = expirationData_split[ 0] + '/' + expirationData_split[-1][-2:] securityCode = driver.find_element_by_xpath( '//main[@class="page-main"]//section[2]//p[3]').text securityCode = securityCode.split(':')[-1].strip() print(temporaryCardNumber, expirationData, securityCode) sql = 'UPDATE email_info set temporaryCardNumber=%s, expirationData=%s, securityCode=%s where email=%s' commit_sql( conn, sql, (temporaryCardNumber, expirationData, securityCode, email)) driver.find_element_by_xpath( '//main[@class="page-main"]//section[2]//button').click() time.sleep(3) driver.find_element_by_xpath( '//div[@id="modal-info"]//a').click() except: next_step = 0 else: next_step = 0 if next_step == 1: input_id_XP = '//input[@id="TxtUserID"]' input_id_result = explicit_wait(driver, "VOEL", [input_id_XP, "XPath"], 15, False) if input_id_result: try: user_id = create_random_str() driver.find_element_by_xpath(input_id_XP).send_keys(user_id) time.sleep(1) user_pwd = create_pwd() driver.find_element_by_xpath( '//input[@id="TxtPassword"]').send_keys(user_pwd) time.sleep(1) driver.find_element_by_xpath( '//input[@id="TxtConfirmPassword"]').send_keys(user_pwd) time.sleep(1) answer_1 = question_answer() driver.find_element_by_xpath( '//input[@id="TxtAnswer1"]').send_keys(answer_1) time.sleep(1) driver.find_element_by_xpath( '//input[@id="TxtConfirmEmail"]').send_keys(email) time.sleep(1) driver.find_element_by_xpath( '//input[@id="btnContinue"]').click() last_submit_XP = '//input[@id="btnConfirm"]' explicit_wait(driver, "VOEL", [last_submit_XP, "XPath"]) last_submit = driver.find_element_by_xpath(last_submit_XP) (ActionChains(driver).move_to_element( last_submit).click().perform()) sql = 'UPDATE email_info set cardType=2, emailIsUsed=1, register_info_id=%s, user=%s, user_pwd=%s, answer_1=%s, create_time=%s, register_computer="-" where email=%s' commit_sql(conn, sql, (register_id, user_id, user_pwd, answer_1, current_time, email)) end_submit_XP = '//div[@class="btn-group"]//a[2]' explicit_wait(driver, "VOEL", [end_submit_XP, "XPath"]) end_submit = driver.find_element_by_xpath(end_submit_XP) (ActionChains(driver).move_to_element( end_submit).click().perform()) time.sleep(3) get_next_email = 1 except: pass try: driver.quit() except Exception as e: pass time.sleep(5) return get_next_email
def register_account(): p = subprocess.Popen( 'C:\\Users\\Administrator\\Desktop\\911S5 2018-05-23 fixed\\Client.exe', shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) time.sleep(8) try_time = 1 while True: win32api.keybd_event(13, 0, 0, 0) win32api.keybd_event(13, 0, win32con.KEYEVENTF_KEYUP, 0) time.sleep(1) dialog1 = win32gui.FindWindow('ThunderRT6FormDC', '911 S5 3.1') login = win32gui.FindWindowEx(dialog1, 0, 'ThunderRT6CommandButton', None) win32gui.SendMessage(dialog1, win32con.WM_COMMAND, 0, login) time.sleep(5) try_time += 1 if try_time > 5: break while True: flow_flag = 1 current_time = datetime.datetime.now().strftime("%Y-%m-%d") hostname = socket.gethostname() conn = pymysql.connect(host='localhost', port=3306, user='******', password='******', db='walmartmoneycard', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) sql = 'SELECT count(1) as allcount from email_info where emailIsUsed=1 and create_time=%s' all_count = fetch_one_sql(conn, sql, current_time)['allcount'] if all_count > 1000: print('Today is enough!') break # # Get email sql = 'SELECT * from email_info where id>7174 and emailIsUsed=0 and register_computer=%s and try_create_times<6 order by id limit 1' get_email = fetch_one_sql(conn, sql, hostname) if get_email: email_id = get_email['id'] email = get_email['email'] print(email) else: sql = 'SELECT * from email_info where id>7174 and emailIsUsed=0 and register_computer="-" and try_create_times<6 order by id limit 1' get_email = fetch_one_sql(conn, sql) if get_email: email_id = get_email['id'] email = get_email['email'] print(email) sql = 'UPDATE email_info set register_computer=%s where email=%s' commit_sql(conn, sql, (hostname, email)) else: flow_flag = 0 print('No email') break # Get register account message if flow_flag == 1: while True: get_msg_success = 0 sql = 'SELECT * from register_info where id>19661 and userInfoIsUsed=0 and email_id=%s and read_num<4 order by id limit 1' result = fetch_one_sql(conn, sql, email_id) if result: get_msg_success = 1 sql = 'SELECT * from email_info where id=%s' try_create_times = fetch_one_sql( conn, sql, email_id)['try_create_times'] print(int(try_create_times) + 1, 'times!') if int(try_create_times) > 5: break else: sql = 'SELECT * from register_info where id>19661 and userInfoIsUsed=0 and read_num<4 order by id limit 1' result = fetch_one_sql(conn, sql) if result: get_msg_success = 1 sql = 'SELECT * from email_info where id=%s' try_create_times = fetch_one_sql( conn, sql, email_id)['try_create_times'] print(int(try_create_times) + 1, 'times!') if int(try_create_times) > 5: break else: print('Not register info!') get_msg_success = 4 break if get_msg_success == 1: sql = 'UPDATE email_info set try_create_times=try_create_times+1 where id=%s' commit_sql(conn, sql, email_id) register_id = result['id'] print('Register ID:', register_id) sql = 'UPDATE register_info set userInfoIsUsed=1, email_id=%s, read_num=read_num+1 where id=%s' commit_sql(conn, sql, (email_id, register_id)) firstname = result['firstname'] lastname = result['lastname'] address = result['address'] city = result['city'] state = result['state'] zip_num = result['zip'] socialnumber = result['socialnumber'] birthdate = result['birthdate'] mobilenumber = result['mobilenumber'] pinnumber = result['pinnumber'] sql = 'SELECT cardType from config where id=1' cardType_r = fetch_one_sql(conn, sql) if cardType_r: cardType = cardType_r['cardType'] while True: p = subprocess.Popen( 'C:\\Users\\Administrator\\Desktop\\911S5 2018-05-23 fixed\\ProxyTool\\AutoProxyTool.exe -changeproxy/all/%s/%s -citynolimit' % (state, city), shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) p.wait() time.sleep(5) options = webdriver.ChromeOptions() options.add_argument('disable-infobars') driver = webdriver.Chrome(options=options) driver.maximize_window() if cardType == 1: driver.get( 'https://www.walmartmoneycard.com/getacardnow') time.sleep(5) elif cardType == 2: driver.get('https://secure.greendot.com/signup') time.sleep(5) if driver.page_source.find( 'This site can’t be reached') > -1: driver.quit() continue else: break if cardType == 1: get_next_email = walmart_card( driver, conn, register_id, firstname, lastname, address, city, zip_num, email, mobilenumber, socialnumber, birthdate, pinnumber, current_time) elif cardType == 2: get_next_email = green_dot_bank( driver, conn, register_id, firstname, lastname, address, city, zip_num, email, mobilenumber, socialnumber, birthdate, pinnumber, current_time) if get_next_email == 1: break if get_msg_success == 4: break conn.close()
def walmart_card(driver, conn, register_id, firstname, lastname, address, city, zip_num, email, mobilenumber, socialnumber, birthdate, pinnumber, current_time, get_next_email=0): next_step = 1 try: card_type = random.randint(1, 2) if card_type == 2: driver.find_element_by_xpath( '//label[@for="cardtype-mastercard"]').click() time.sleep(1) driver.find_element_by_id('FirstName').send_keys( firstname) # FirstName driver.find_element_by_id('LastName').send_keys(lastname) # LastName driver.find_element_by_id('Address1').send_keys( address) # Street Address driver.find_element_by_id('City').send_keys(city) # City Select( driver.find_element_by_id('State')).select_by_visible_text('' + state + '') driver.find_element_by_id('ZIP').send_keys(zip_num) driver.find_element_by_id('Email').send_keys(email) # Email driver.find_element_by_id('PhoneMobile').send_keys( mobilenumber) # PhoneMobile driver.find_element_by_id('SocialSecurityNumber').send_keys( socialnumber) # SocialSecurityNumber driver.find_element_by_id('BirthDate-Mirror').send_keys( birthdate) # BirthDate driver.find_element_by_id('CardPIN').send_keys(pinnumber) # CardPIN time.sleep(3) driver.find_element_by_id('lbl-for-eca2').click() time.sleep(3) driver.find_element_by_id('Continue').click() time.sleep(3) try: driver.find_element_by_id('btnSendMyCard').click() except: pass time.sleep(5) except Exception as e: next_step = 0 if next_step == 1: try: all_info_1 = driver.find_elements_by_xpath( '//span[@class="cardValue col3"]') time.sleep(2) bankRoutingNumber = all_info_1[0].text directDepositAccountNumber = all_info_1[1].text print(bankRoutingNumber, directDepositAccountNumber) sql = 'UPDATE email_info set bankRoutingNumber=%s, directDepositAccountNumber=%s where email=%s' commit_sql(conn, sql, (bankRoutingNumber, directDepositAccountNumber, email)) driver.find_element_by_xpath('//button[@id="btn-ctn"]').click() time.sleep(5) except Exception as e: next_step = 0 if next_step == 1: try: all_info_2 = driver.find_elements_by_xpath( '//span[@class="cardValue col3"]') time.sleep(2) temporaryCardNumber = all_info_2[0].text expirationData = all_info_2[1].text securityCode = all_info_2[2].text print(temporaryCardNumber, expirationData, securityCode) sql = 'UPDATE email_info set temporaryCardNumber=%s, expirationData=%s, securityCode=%s where email=%s' commit_sql( conn, sql, (temporaryCardNumber, expirationData, securityCode, email)) driver.find_element_by_id('dynamicData').click() time.sleep(3) driver.find_element_by_xpath('//div[@class="actions"]/a').click() time.sleep(2) except Exception as e: next_step = 0 if next_step == 1: try: user_id = create_random_str() driver.find_element_by_id('TxtUserID').send_keys(user_id) time.sleep(1) user_pwd = create_pwd() driver.find_element_by_id('TxtPassword').send_keys(user_pwd) time.sleep(1) driver.find_element_by_id('TxtConfirmPassword').send_keys(user_pwd) time.sleep(1) answer_1 = question_answer() answer_2 = question_answer() answer_3 = question_answer() driver.find_element_by_id('TxtAnswer1').send_keys(answer_1) time.sleep(2) driver.find_element_by_id('TxtAnswer2').send_keys(answer_2) time.sleep(2) driver.find_element_by_id('TxtAnswer3').send_keys(answer_3) time.sleep(2) driver.find_element_by_id('confirm-dynamic').click() time.sleep(5) driver.find_element_by_id('btnConfirm').click() time.sleep(3) sql = 'UPDATE email_info set cardType=1, emailIsUsed=1, register_info_id=%s, user=%s, user_pwd=%s, answer_1=%s, answer_2=%s, answer_3=%s, create_time=%s, register_computer="-" where email=%s' commit_sql(conn, sql, (register_id, user_id, user_pwd, answer_1, answer_2, answer_3, current_time, email)) driver.find_element_by_id('btn-osconfirmation-submit').click() time.sleep(3) get_next_email = 1 except Exception as e: pass try: driver.quit() except Exception as e: pass time.sleep(5) return get_next_email
def save_pic(self, board_name='like', belong=2, specific_pin_url='empty', specific_pin_pic_url='empty'): saved_flag = '' if specific_pin_url != 'empty': pin_url = specific_pin_url pin_pic_url = specific_pin_pic_url else: pin_url = self.driver.current_url time.sleep(1) pin_pic_url = self.driver.find_element_by_xpath( '//a[@class="imageLink"]//img').get_attribute('src') add_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") try: saved_flag = self.driver.find_elements_by_xpath( '//div[@data-test-id="saved-info"]/div/a/span').text except: pass if saved_flag == 'Saved to ': print('The picture has been saved.') else: if belong == 2: sql = 'SELECT * from other_pin_history where pin_pic_url=%s and account_id=%s' elif belong == 1: sql = 'SELECT * from pin_history where pin_pic_url=%s and account_id=%s' result = fetch_one_sql(self.conn, sql, (pin_pic_url, self.account_id)) if result: print('The picture has been saved.') else: time.sleep(3) try: self.driver.find_element_by_xpath( '//div[@data-test-id="boardSelectionDropdown"]').click( ) time.sleep(5) self.driver.find_element_by_xpath( "//input[@id='pickerSearchField']").send_keys( board_name) time.sleep(5) except Exception as e: pass try: board_selector = self.driver.find_elements_by_xpath( '//div[@data-test-id="board-picker-section"]//div[2]/div' ) board_selector_list = [] for board_selector_one in board_selector: board_text = board_selector_one.text if board_text == board_name: board_selector_list.append(board_selector_one) if len(board_selector_list) > 0: board_selector_list[0].click() time.sleep(2) else: raise Exception except: time.sleep(3) self.driver.find_element_by_xpath( '//div[@data-test-id="create-board"]/div').click() time.sleep(3) self.driver.find_element_by_name('boardName').clear() time.sleep(2) self.driver.find_element_by_name('boardName').send_keys( board_name) time.sleep(5) self.driver.find_element_by_xpath( "//form//button[@type='submit']").click() time.sleep(3) if belong == 2: sql = '''INSERT INTO other_pin_history (account_id, pin_url, pin_pic_url, add_time) values ( %s, %s, %s, %s)''' elif belong == 1: sql = '''INSERT INTO pin_history (account_id, pin_url, pin_pic_url, add_time) values ( %s, %s, %s, %s)''' commit_sql(self.conn, sql, (self.account_id, pin_url, pin_pic_url, add_time)) time.sleep(3) write_txt_time()
def upload_pic(self): upload_flag = 1 sql = 'SELECT * from domain where account_id=%s' id_result = fetch_one_sql(self.conn1, sql, self.account_id) if id_result: print('Today has been spread!') else: sql = 'SELECT * from domain where state=0 order by RAND() limit 1' result = fetch_one_sql(self.conn1, sql) if result: domain = result['domain'] complete_domain = 'https://www.' + domain upload_pic_num = random.randint(self.upload_pic_min_num, self.upload_pic_max_num) print('Upload number of picture processing:', upload_pic_num) sql = 'SELECT * from pin_upload where saved=0 and belong_web=%s order by RAND() limit %s' results = fetch_all_sql(self.conn1, sql, (complete_domain, upload_pic_num)) if results: sql = "UPDATE domain set state=1, account_id=%s where domain=%s" commit_sql(self.conn1, sql, (self.account_id, domain)) for rows in results: upload_pic_path = rows['savelink'] upload_pic_path = upload_pic_path.replace( 'http://guanli.lianstone.net', 'http://guanli2.lianstone.net') upload_pic_board = rows['saveboard'] upload_pic_id = rows['Id'] self.driver.get(upload_pic_path) time.sleep(5) try: self.driver.find_element_by_xpath( "//input[@id='pickerSearchField']").send_keys( upload_pic_board) time.sleep(2) except Exception as e: print('Image save failed, Element not found') upload_flag = 0 if upload_flag == 1: try: win32api.keybd_event(13, 0, 0, 0) win32api.keybd_event(13, 0, win32con.KEYEVENTF_KEYUP, 0) time.sleep(5) except Exception as e: pass if self.driver.page_source.find( 'Sorry! We blocked this link because it may lead to spam.' ) > -1: print('Domain name banned!') sql = "UPDATE domain set state=4 where domain=%s" commit_sql(self.conn1, sql, complete_domain) upload_flag = 0 break try: self.driver.find_element_by_xpath( "//div[@class='mainContainer']//div[1]/div/button" ).click() time.sleep(5) sql = "UPDATE pin_upload set saved=1 where id=%s" commit_sql(self.conn1, sql, upload_pic_id) write_txt_time() except Exception as e: pass time.sleep(3) else: sql = "UPDATE domain set state=9 where domain=%s" commit_sql(self.conn1, sql, complete_domain) else: print('No data in domain!') time.sleep(2)