Guest User

Untitled

a guest
May 27th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.common.by import By
  3. from selenium.webdriver.support.ui import WebDriverWait,Select
  4. from selenium.webdriver.support import expected_conditions as EC
  5. from selenium.webdriver.common.keys import Keys
  6. from os import system
  7. import sys
  8. import json
  9. import time
  10.  
  11. komparify_email = 'ahbhalgami20@gmail.com'
  12. komparify_password = '##whitehat'
  13. komparify_number = '8306106925' ## Don't put Telenor number
  14. keyword = 'abhi'
  15. amazon_password = 'abc@123'
  16. website = 'rhyta.com'
  17. global driver
  18. global amount
  19. komparify_status = 0
  20. number = (sys.argv[1])
  21. email = keyword+str(number)+'@'+website
  22.  
  23. num1 = str(number)[-1:]
  24. posix = 500*(int(num1)-1)
  25. posiy = 0
  26. if int(num1) > 3:
  27. posiy = 500
  28. posix = 500*(int(num1)-4)
  29.  
  30.  
  31.  
  32.  
  33. def amazon(email):
  34. global amount
  35. global driver
  36. driver = webdriver.Chrome()
  37. driver.set_window_size(500,500)
  38. driver.set_window_position(posix, posiy)
  39.  
  40. usernameStr = email
  41. passwordStr = amazon_password
  42.  
  43. driver.get('https://www.amazon.in/gp/payment/statement')
  44.  
  45. username = driver.find_element_by_id('ap_email')
  46. username.send_keys(usernameStr)
  47.  
  48. nextButton = driver.find_element_by_id('continue')
  49. nextButton.click()
  50.  
  51. password = WebDriverWait(driver, 10).until(
  52. EC.presence_of_element_located((By.ID, 'ap_password')))
  53. password.send_keys(passwordStr)
  54.  
  55. signInButton = driver.find_element_by_id('signInSubmit')
  56. signInButton.click()
  57.  
  58. balance = WebDriverWait(driver, 10).until(
  59. EC.presence_of_element_located((By.CSS_SELECTOR, 'span.a-size-medium.gc-balance.a-text-bold')))
  60. balance = str(balance.text)
  61. balance = balance.split('.')
  62. balance = int(balance[0][0:])
  63. amount = str(balance)
  64. f = open('log.txt','w')
  65. f.write('\n\n')
  66. f.write(str(number)+' : '+str(amount))
  67.  
  68. def komparify():
  69. global driver
  70. global amount
  71. WebDriverWait(driver, 10)
  72. driver.get('https://www.komparify.com/recharge?utm_source=top_bar#type=mobile')
  73.  
  74. number = driver.find_element_by_id('recharge_param_number')
  75. #number.clear()
  76. number.send_keys(komparify_number)
  77. time.sleep(1)
  78.  
  79. operator = Select(driver.find_element_by_xpath("//select[@name='recharge_param[operator]']"))
  80. operator.select_by_value('4')
  81.  
  82. value = driver.find_element_by_id('recharge_param_value')
  83.  
  84. if int(amount) < 34:
  85. value.send_keys(int(amount))
  86. else :
  87. value.send_keys(str(int(amount)-1))
  88.  
  89. recharge_button = WebDriverWait(driver, 10).until(
  90. EC.visibility_of_element_located((By.CLASS_NAME, 'sort-recharge')))
  91. time.sleep(2)
  92. recharge_button.click()
  93.  
  94. login_link = WebDriverWait(driver, 10).until(
  95. EC.visibility_of_element_located((By.XPATH, "//a[contains(text(),'Login')]")))
  96. login_link.click()
  97.  
  98. email = WebDriverWait(driver, 10).until(
  99. EC.visibility_of_element_located((By.ID, 'user_email')))
  100. email.send_keys(komparify_email)
  101.  
  102. password = WebDriverWait(driver, 10).until(
  103. EC.visibility_of_element_located((By.ID, 'login_user_password')))
  104. password.send_keys(komparify_password)
  105.  
  106. signin =WebDriverWait(driver, 10).until(
  107. EC.visibility_of_element_located((By.XPATH, "//input[@name='commit'][@value='Log In']")))
  108. signin.click()
  109.  
  110. abutton = WebDriverWait(driver, 10).until(
  111. EC.visibility_of_element_located((By.XPATH, "//a[@href='#'][@class='payment_type paymentoption amazonpay ']")))
  112. time.sleep(1)
  113. abutton.click()
  114.  
  115. pay = WebDriverWait(driver, 10).until(
  116. EC.visibility_of_element_located((By.XPATH, "//button[@id='gotopayubutton'][@class='neworangebutton']")))
  117. pay.click()
  118.  
  119. time.sleep(3)
  120. driver.execute_script("document.forms[0].submit()")
  121. time.sleep(7)
  122. driver.get('https://www.komparify.com/wallet')
  123. f = open('log.txt','w')
  124. f.write('\t --> komparify ')
  125. driver.close()
  126.  
  127.  
  128. def main(email):
  129. amazon(email)
  130. if int(amount) == 0:
  131. print('\n\n\t\t\t [!] Oops Thats Account is empty')
  132. else:
  133. komparify()
  134.  
  135. main(email)
  136. exit()
Add Comment
Please, Sign In to add comment