Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.common.keys import Keys
  3. import json
  4. from time import sleep, strftime
  5. from selenium.common.exceptions import NoSuchElementException
  6. from selenium.webdriver.support.wait import WebDriverWait
  7. from selenium.webdriver.support import expected_conditions as EC
  8. from selenium.webdriver.common.by import By
  9. from selenium.common.exceptions import TimeoutException
  10. from selenium.webdriver.common.action_chains import ActionChains
  11. import os
  12.  
  13. USE_PROXY = True
  14.  
  15. def readLogins():
  16. try:
  17. with open("logins.txt") as data:
  18. logins = data.readlines()
  19. except EnvironmentError:
  20. print 'Error reading the logins.txt file. Please make sure the logins.txt file is present in the same directory as this file.'
  21. quit()
  22.  
  23. return logins
  24.  
  25. def readProxies():
  26. try:
  27. with open("proxies.txt") as data:
  28. proxies = data.readlines()
  29. except EnvironmentError:
  30. print 'Error reading the proxies.txt file. Please make sure the proxies.txt file is present in the same directory as this file.'
  31. quit()
  32.  
  33. return proxies
  34.  
  35. def getOptions():
  36. user_options = dict()
  37. user_options["link"] = raw_input("https://www.roblox.com/games/292439477/Phantom-Forces-Beta")
  38. user_options["comment"] = raw_input("hurry go to roblox.tf its great for free ro bux.")
  39. return user_options
  40.  
  41. def time():
  42. return strftime("%Y-%m-%d %H:%M:%S")
  43.  
  44. def main():
  45. logins = readLogins()
  46. proxies = readProxies()
  47. user_options = getOptions()
  48.  
  49. for count, login in enumerate(logins):
  50. temp_login = login.strip().split(":")
  51. username = temp_login[0]
  52. password = temp_login[1]
  53.  
  54. chrome_options = webdriver.ChromeOptions()
  55. if(USE_PROXY == True):
  56. if(len(proxies) < len(logins)):
  57. print "%s [ERROR] Number of proxies less than number of logins." % time()
  58. quit()
  59. print "%s [LOG] Using proxies." % time()
  60. print "%s [LOG] Using: %s" % (time(), proxies[count])
  61. chrome_options.add_argument("--proxy-server=%s" % proxies[count])
  62. else:
  63. print "%s [LOG] Not using proxies." % time()
  64. browser = webdriver.Chrome(chrome_options = chrome_options)
  65. browser.set_page_load_timeout(120)
  66.  
  67. try:
  68. browser.get("https://www.roblox.com")
  69. except TimeoutException:
  70. print "%s [LOG] Page taking too long to load, bad proxy probably." % time()
  71. continue
  72.  
  73. try:
  74.  
  75. browser.find_element_by_xpath(".//*[@id='LoginUsername']").send_keys(username)
  76. browser.find_element_by_xpath(".//*[@id='LoginPassword']").send_keys(password)
  77.  
  78. browser.find_element_by_xpath(".//*[@id='LoginButton']").click()
  79. except:
  80. print "%s [LOG] Bad proxy. Skipping." % time()
  81. browser.quit()
  82. continue
  83.  
  84.  
  85. if "Login to ROBLOX" in browser.page_source:
  86. print "%s [LOG] %s is not a valid login. Skipping." % (time(), temp_login)
  87. browser.quit()
  88. continue
  89. elif "We need to make sure you're not a robot!" in browser.page_source:
  90. print "%s [LOG] Captcha found. Proxy is probably blacklisted. Skipping." % time()
  91. browser.quit()
  92. continue
  93. elif "Reviewed" in browser.page_source:
  94. print "%s [LOG] %s is probably banned. Skipping." % (time(), temp_login)
  95. browser.quit()
  96. continue
  97. elif "Logout" in browser.page_source:
  98. print "%s [LOG] Successfully logged in with: %s" % (time(), temp_login)
  99.  
  100. try:
  101. browser.get(user_options["link"])
  102. browser.find_element_by_css_selector("textarea[placeholder='Write a comment!']").send_keys(user_options["comment"])
  103. browser.find_element_by_css_selector("button[class='btn-secondary-md rbx-post-comment']").click()
  104. print "%s [LOG] Successfully commented." % time()
  105. browser.quit()
  106. except:
  107. print "%s [LOG] Can't comment with %s. Skipping." % (time(), temp_login)
  108. browser.quit()
  109.  
  110.  
  111. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement