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 connect_vpn(conn, vpn): sql = "SELECT account, pwd, server, ip from vpn where account=%s" result = fetch_one_sql(conn, sql, vpn) if result: vpn = result['account'] vpn_pwd = result['pwd'] vpn_ip = result['ip'] vpn_server = result['server'].replace('.lianstone.net', '') with open("F:\\uploadPinterestPic\\boot\\vpn.txt", "w", encoding='utf-8') as fp: print(vpn_server + "," + vpn + "," + vpn_pwd) fp.write(vpn_server + "," + vpn + "," + vpn_pwd) else: print( 'No corresponding VPN account has been detected and the system is being shut down...' ) time.sleep(600) os.system('Shutdown -s -t 0') print('Disconnect the original VPN connection') rasphone_vpn() write_txt_time() print('Handling new VPN...') check_vpn() net_ip = get_out_ip() write_txt_time() while True: if net_ip == vpn_ip: print('VPN connection IP is correct!') break else: check_vpn() write_txt_time() time.sleep(10) net_ip = get_out_ip()
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 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 get_config(self): print('Run configuration:', self.config_id) sql = 'SELECT * from configuration where priority=%s' result = fetch_one_sql(self.conn, sql, self.config_id) # choice_config_sorted = sorted(results, key=lambda priority: priority['priority']) if result: self.random_browsing_control = result['random_browsing_control'] self.browsing_pic_min_num = result['browsing_pic_min_num'] self.browsing_pic_max_num = result['browsing_pic_max_num'] self.access_home_page_control = result['access_home_page_control'] self.save_pic_control = result['save_pic_control'] self.follow_num = result['follow_num'] self.pin_self_count = result['pin_self_count'] self.create_board_num = result['create_board_num'] self.search_words_count = result['search_words_count'] self.scroll_num = result['scroll_num'] self.save_pic_from_homepage_control = result[ 'save_pic_from_homepage_control'] self.click_specific_pin_control = result[ 'click_specific_pin_control'] self.upload_pic_control = result['upload_pic_control'] self.upload_pic_min_num = result['upload_pic_min_num'] self.upload_pic_max_num = result['upload_pic_max_num']
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 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 save_pic_from_homepage(self): sql = "SELECT * from follow_url where for_config=10 and account_group=%s" result = fetch_one_sql(self.conn2, sql, self.account_group) if result: http_in_sql = result['web_url'] home_url = result['home_url'] try: self.driver.find_element_by_xpath( '//div[@aria-label="Pins from people you follow"]/a/div' ).click() time.sleep(5) self.driver.find_element_by_xpath( '//button[@aria-label="Find new people to follow"]').click() except: self.driver.find_element_by_xpath( '//div[@data-test-id="button-container"]/div[2]').click() time.sleep(5) all_following = self.driver.find_elements_by_xpath( '//div[@data-grid-item="true"]') for one_following in all_following: following_homepage = one_following.find_element_by_xpath( './div/div/div/a').get_attribute('href') if following_homepage == home_url: one_following.click() time.sleep(5) break windows = self.driver.window_handles self.driver.switch_to.window(windows[1]) self.driver.execute_script('window.scrollTo(1, 500)') time.sleep(5) try: web_pin_arr = self.driver.find_elements_by_xpath( "//div[@data-grid-item='true']") except: time.sleep(3) web_pin_arr = self.driver.find_elements_by_xpath( "//div[@data-grid-item='true']") pin_count = 0 for web_pin_one in web_pin_arr: try: ActionChains( self.driver).move_to_element(web_pin_one).perform() time.sleep(3) except: pass try: web_pin = self.driver.find_element_by_xpath( "//a[@class='navigateLink']//div[2]/div") time.sleep(2) web_pin_url = web_pin.text if web_pin_url == http_in_sql: time.sleep(1) specific_pin_url = web_pin_one.find_element_by_xpath( './/div[@class="pinWrapper"]/div/a').get_attribute( 'href') time.sleep(1) specific_pin_pic_url = web_pin_one.find_element_by_xpath( './/div[@class="pinWrapper"]//img').get_attribute( 'src') board_name = 'dress' self.save_pic(board_name=board_name, belong=1, specific_pin_url=specific_pin_url, specific_pin_pic_url=specific_pin_pic_url) time.sleep(3) sql = "SELECT count(-1) as allnum from pin_history where account_id=%s and add_time>=%s" pin_count = fetch_one_sql( self.conn, sql, (self.account_id, self.current_time))['allnum'] except Exception as e: pass if pin_count >= int(self.pin_self_count): break write_txt_time()
def click_specific_pin(self): print('Start searching for our company images') sql = "SELECT count(-1) as allnum from pin_history where account_id=%s and add_time>=%s" pin_count = fetch_one_sql( self.conn, sql, (self.account_id, self.current_time))['allnum'] if pin_count < int(self.pin_self_count): sql = "SELECT web_url from follow_url" results = fetch_all_sql(self.conn2, sql) http_in_sql_list = [] for res in results: http_in_sql = res['web_url'] http_in_sql_list.append(http_in_sql) sql = "SELECT * from search_words where us=1 order by RAND() limit %s" key_wrods = fetch_all_sql(self.conn2, sql, self.search_words_count) if key_wrods: for key_wrod in key_wrods: search_key_words = key_wrod['word'] board_name = key_wrod['boards'] # belong = result['us'] try: self.driver.find_element_by_name('q').click() time.sleep(1) self.driver.find_element_by_name('q').clear() time.sleep(1) self.driver.find_element_by_name('q').send_keys( search_key_words) time.sleep(1) win32api.keybd_event(13, 0, 0, 0) win32api.keybd_event(13, 0, win32con.KEYEVENTF_KEYUP, 0) except: pass try: self.driver.find_element_by_name( "searchBoxInput").click() time.sleep(1) self.driver.find_element_by_name( "searchBoxInput").clear() time.sleep(1) self.driver.find_element_by_name( "searchBoxInput").send_keys(search_key_words) time.sleep(1) win32api.keybd_event(13, 0, 0, 0) win32api.keybd_event(13, 0, win32con.KEYEVENTF_KEYUP, 0) except: pass time.sleep(8) for _ in range(self.scroll_num): try: web_pin_arr = self.driver.find_elements_by_xpath( "//div[@data-grid-item='true']") # print(len(web_pin_arr)) except: time.sleep(3) web_pin_arr = self.driver.find_elements_by_xpath( "//div[@data-grid-item='true']") for web_pin_one in web_pin_arr: try: ActionChains(self.driver).move_to_element( web_pin_one).perform() time.sleep(3) write_txt_time() except: pass try: web_pin = self.driver.find_element_by_xpath( '//a[@rel="nofollow"]//div[2]/div') time.sleep(2) web_pin_url = web_pin.text # print(web_pin_url) if web_pin_url in http_in_sql_list: time.sleep(1) specific_pin_url = web_pin_one.find_element_by_xpath( './/div[@class="pinWrapper"]/div/a' ).get_attribute('href') time.sleep(1) specific_pin_pic_url = web_pin_one.find_element_by_xpath( './/div[@class="pinWrapper"]//img' ).get_attribute('src') self.save_pic( board_name=board_name, belong=1, specific_pin_url=specific_pin_url, specific_pin_pic_url= specific_pin_pic_url) sql = "SELECT count(-1) as allnum from pin_history where account_id=%s and add_time>=%s" pin_count = fetch_one_sql( self.conn, sql, (self.account_id, self.current_time))['allnum'] except Exception as e: # self.logs.error('This is an error message!', exc_info=True) pass if pin_count >= int(self.pin_self_count): break if pin_count >= int(self.pin_self_count): break else: win32api.keybd_event(35, 0, 0, 0) win32api.keybd_event(35, 0, win32con.KEYEVENTF_KEYUP, 0) time.sleep(5) if pin_count >= int(self.pin_self_count): break else: print('Saved enough!')
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)