def __run(config): report = list() doSleep = False for key, account in config.accounts.iteritems(): if account.disabled: continue # sleep between two accounts logins if doSleep: extra = config.general.betweenAccountsInterval + random.uniform( 0, config.general.betweenAccountsSalt) if verbose: print("\nPausing between accounts for {0} seconds".format( int(extra))) time.sleep(extra) reportItem = BingRewardsReportItem() reportItem.accountType = account.accountType reportItem.accountLogin = account.accountLogin agents = bingCommon.UserAgents.generate(account) httpHeaders = bingCommon.HEADERS httpHeaders["User-Agent"] = agents.pc __processAccount(config, httpHeaders, agents, reportItem, account.password) report.append(reportItem) doSleep = True # # trigger full report if needed # if showFullReport or totalPoints > 0 and len(report) > 1: print print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= FINAL REPORT =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" print print " Account | Before | After | Earned | Lifetime | Retries " print "------------------------------+--------+--------+--------+------------+---------" for r in report: print " %-28s | %6d | %6d | %6d | %10d | %7d" % ( __stringifyAccount(r, 28), r.oldPoints, r.newPoints, r.pointsEarnedRetrying, r.lifetimeCredits, r.retries) print # # print footer # print "Total points earned: %d" % totalPoints print print "%s - script ended" % helpers.getLoggingTime() EventsProcessor.onScriptComplete(config)
def __process_account(account, cfg): print "__processAccount(): ", account.getRef(), cfg # generate report item for later use reportItem = BingRewardsReportItem(account.getRef()) reportItem.accountType = account.accountType reportItem.accountLogin = account.accountLogin # generate headers for http requests (including spoofed agent string) httpHeaders = __generate_headers() # #$REFACTOR_HTTP$# #earn the rewards earnRewards(httpHeaders, reportItem, account.password, cfg) #if the earning was not successful, sleep and recurse if reportItem.error is not None: # we have to keep retry count; and other things, correct... print "__process_acount(): process failure, ", reportItem.retries, \ " attempts made" reportItem.retries += 1 reportItem.accountStatus = 1 else: reportItem.accountStatus = 0 return reportItem
def __run(config): report = list() doSleep = False for key, account in config.accounts.iteritems(): if account.disabled: continue # sleep between two accounts logins if doSleep: extra = config.general.betweenAccountsInterval + random.uniform(0, config.general.betweenAccountsSalt) if verbose: print("\nPausing between accounts for {0} seconds".format(int(extra))) time.sleep(extra) reportItem = BingRewardsReportItem() reportItem.accountType = account.accountType reportItem.accountLogin = account.accountLogin agents = bingCommon.UserAgents.generate(account) httpHeaders = bingCommon.HEADERS httpHeaders["User-Agent"] = agents.pc __processAccount(config, httpHeaders, agents, reportItem, account.password) report.append(reportItem) doSleep = True # # trigger full report if needed # if showFullReport or totalPoints > 0 and len(report) > 1: print print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= FINAL REPORT =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" print print " Account | Before | After | Earned | Lifetime | Retries " print "------------------------------+--------+--------+--------+------------+---------" for r in report: print " %-28s | %6d | %6d | %6d | %10d | %7d" % (__stringifyAccount(r, 28), r.oldPoints, r.newPoints, r.pointsEarnedRetrying, r.lifetimeCredits, r.retries) print # # print footer # print "Total points earned: %d" % totalPoints print print "%s - script ended" % helpers.getLoggingTime() EventsProcessor.onScriptComplete(config)
def __run(config): report = list() accountIndex = 0 for key, account in config.accounts.iteritems(): if account.disabled: continue # sleep between two accounts logins if accountIndex > 0: isFirstAccount = False extra = config.general.betweenAccountsInterval + random.uniform(0, config.general.betweenAccountsSalt) time.sleep(extra) reportItem = BingRewardsReportItem() reportItem.accountType = account.accountType reportItem.accountLogin = account.accountLogin __processAccount(config, reportItem, account.password) report.append(reportItem) accountIndex += 1 EventsProcessor.onScriptComplete(config) # # trigger full report if needed # if showFullReport or totalPoints > 0 and len(report) > 1: print print " -=-=-=-=-=-=-=-=-=-=--=-=- FULL REPORT -=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=" print print " Account | Before | After | Earned | Retries | Lifetime Credits" print "---------------------------+--------+--------+--------+---------+-----------------" for r in report: print " %25s | %6d | %6d | %6d | %7d | %16d" % (__stringifyAccount(r, 25), r.oldPoints, r.newPoints, r.pointsEarnedRetrying, r.retries, r.lifetimeCredits) print # # print footer # print "Total points earned: %d" % totalPoints print print "%s - script ended" % helpers.getLoggingTime()
def __processAccountUserAgent(config, account, userAgents, doSleep): # sleep between two accounts logins if doSleep: extra = config.general.betweenAccountsInterval + random.uniform(0, config.general.betweenAccountsSalt) time.sleep(extra) reportItem = BingRewardsReportItem() reportItem.accountType = account.accountType reportItem.accountLogin = account.accountLogin httpHeaders = bingCommon.HEADERS httpHeaders["User-Agent"] = userAgents[ random.randint(0, len(userAgents) - 1) ] __processAccount(config, httpHeaders, reportItem, account.password) return reportItem
def __processAccountUserAgent(config, account, userAgents, doSleep): # sleep between two accounts logins if doSleep: extra = config.general.betweenAccountsInterval + random.uniform(0, config.general.betweenAccountsSalt) time.sleep(extra) reportItem = BingRewardsReportItem() reportItem.accountType = account.accountType reportItem.accountLogin = account.accountLogin agents = bingCommon.UserAgents.generate() httpHeaders = bingCommon.HEADERS httpHeaders["User-Agent"] = userAgents[ random.randint(0, len(userAgents) - 1) ] __processAccount(config, httpHeaders, agents, reportItem, account.password) return reportItem
def __processAccountUserAgent(config, account, userAgents, doSleep): # sleep between two accounts logins if doSleep: extra = config.general.betweenAccountsInterval + random.uniform(0, config.general.betweenAccountsSalt) if verbose: print print("Pausing between accounts for {0} seconds".format(int(extra))) time.sleep(extra) reportItem = BingRewardsReportItem() reportItem.accountType = account.accountType reportItem.accountLogin = account.accountLogin agents = bingCommon.UserAgents.generate(account) httpHeaders = bingCommon.HEADERS httpHeaders["User-Agent"] = agents.pc __processAccount(config, httpHeaders, agents, reportItem, account.password) return reportItem