Ejemplo n.º 1
0
def main(args):
    body_template = Template("""\
Hi $name,
    Salute fellow hacker! You're at our Python NETtalk for $date.

    Hacker Academy has booked $location for this 50 minute NETtalk \
starting promptly at $time, we hope you're enjoying the talk.

Wen and Alan
Hacker Academy
University of Toronto\
    """)

    sender = "*****@*****.**"
    pwd = getpass()

    subject_template = Template("HA string.Template & smtplib demo $date $time "
    "$location_short")

    exec("from " + os.path.splitext(args.input_file)[0] + " import info")

    body = body_template.substitute(info)
    subject = subject_template.substitute(info)

    test_email = args.test if args.test else "*****@*****.**"

    if args.send:
        raw_input("Watch out! Email about to be sent!")
        send_email(
            sender, pwd, info["email"], subject, body,
            cc=["*****@*****.**",
            "*****@*****.**"])
    else:
        send_email(sender, pwd, info["email"], subject, body, test=True)
Ejemplo n.º 2
0
 def selenium_scrape(self, finished_event):
     self.set_card_url()
     self.driver = get_browser(random_user_agent=False)
     self.driver.get(self.card_url if not self.dry_run else self.test)
     try:
         buy_link = WebDriverWait(self.driver, 5).until(
             EC.element_to_be_clickable((By.CSS_SELECTOR, self.add_to_cart_sel)))
     except TimeoutException:
         button = self.driver.find_elements_by_css_selector(self.add_to_cart_sel)
         if button and not ("sold out" in button[0].get_attribute('innerHTML').lower()
                        or "coming soon" in button[0].get_attribute('innerHTML').lower()):
             send_email(self.personal_info.email, f"Unsupported button",
                        f"Found unsupported button with text: "
                        f"{button[0].get_attribute('innerHTML').lower()}",
                        self.personal_info.botpw)
         if button and "please wait" in button[0].get_attribute('innerHTML').lower():
             self.wait_in_queue(finished_event)
         if button and button[0].is_displayed() and not button[0].is_enabled():
             no_stock("Best Buy", self.gpu)
         else:
             warn("Loading page took too long")
         self.driver.close()
         return
     if "add to cart" in buy_link.get_attribute('innerHTML').lower():
         self.add_to_cart(buy_link, finished_event)
     else:
         no_stock("Best Buy", self.gpu)
         self.driver.close()
         time.sleep(5)
         return
Ejemplo n.º 3
0
 def spam_add_to_cart(self):
     warn("Attempting to spam best buy with add to cart requests, unproven method...")
     send_email(self.personal_info.email, f"GET BACK TO YOUR COMPUTER",
                f"Error adding {self.gpu} to cart"
                f"Attempting to spam the add to cart link, get back to your computer to correct course need be",
                self.personal_info.botpw)
     # try refreshing page and reclicking a couple times then fallback to url spaming
     for x in range(0, 5):
         self.driver.get(self.card_url)
         try:
             buy_link = WebDriverWait(self.driver, 5).until(
                 EC.element_to_be_clickable((By.CSS_SELECTOR, self.add_to_cart_sel)))
             buy_link.click()
             cart_link = WebDriverWait(self.driver, 10).until(
                 EC.presence_of_element_located((By.CSS_SELECTOR, self.go_to_cart_sel)))
             cart_link.click()
             return
         except TimeoutException as e:
             warn(f"ATTEMPT:{x + 1} Buy Link not clickable...")
             pass
     for x in range(0, 50):
         self.driver.get(self.add_to_cart_url)
         try:
             WebDriverWait(self.driver, 4).until(
                 EC.element_to_be_clickable((By.CSS_SELECTOR, self.checkout_sel)))
             break
         except TimeoutException as e:
             warn(f"ATTEMPT:{x + 1} Add to cart url returned empty cart...")
             pass
Ejemplo n.º 4
0
    def buy_card(self, finished_event):
        try:
            self.found_card = True
            self.checkout_sign_in()
        except TimeoutException as e:
            print("Couldn't click on guest checkout trying to manually load checkout page...")
            self.driver.get(self.checkout_url)
            self.checkout_sign_in()
        WebDriverWait(self.driver, 60).until(
            EC.element_to_be_clickable((By.CSS_SELECTOR, self.payment_continue_sel))).click()
        WebDriverWait(self.driver, 60).until(
            EC.element_to_be_clickable((By.CSS_SELECTOR, self.credit_card_sel)))
        fill_out_textbox(self.driver, self.credit_card_sel, self.personal_info.creditcard)
        WebDriverWait(self.driver, 10).until(
            EC.element_to_be_clickable((By.CSS_SELECTOR, self.exp_mo_sel)))
        pick_dropdown(self.driver, self.exp_mo_sel, self.personal_info.expirationmonth)
        pick_dropdown(self.driver, self.exp_yr_sel, self.personal_info.expirationyear)
        fill_out_textbox(self.driver, self.ccv_sel, self.personal_info.ccv)

        print(f"Form filled out successfully, about to buy {self.gpu}.")
        send_email(self.personal_info.email, f"ATTENTION: About to buy...",
                   f"BE READY TO CHECK COMPUTER!!!!! Form filled out successfully, about to buy {self.gpu}. "
                   f" {self.gpu}",
                   self.personal_info.botpw)
        FINAL_BUY_BUTTON = WebDriverWait(self.driver, 60).until(
            EC.element_to_be_clickable((By.CSS_SELECTOR, self.FINAL_BUTTON_SEL)))

        if not self.dry_run:
            FINAL_BUY_BUTTON.click()
            finished_event.set()
        else:
            print("dry_run is enabled, will not proceed with checking out")
            finished_event.set()
Ejemplo n.º 5
0
def special():
    # 启动appium服务器
    os.system('startAppiumServer.bat')
    Dingding.Ma()
    i = datetime.datetime.now().strftime("%p")
    S = "PM"
    if i == S:
        send_email("【  下班打卡  】 ")
    else:
        send_email("【  上班打卡  】")
Ejemplo n.º 6
0
 def start(self, finished_event):
     try:
         self.start_scraping(finished_event)
     except Exception as e:
         send_email(self.personal_info.email, f"GPU scraper encountered an exception",
                    f"Exception listed below: "
                    f"{e}",
                    self.personal_info.botpw)
         raise
     finally:
         save_network_reqs(self.driver, self.card)
Ejemplo n.º 7
0
def contact_me():
    name = request.form.get('name')

    email = request.form.get('email')

    message = request.form.get('message')

    # receipents=[Configuration.MAIL_DEFAULT_SENDER]
    send_email(subject='Your Blog Notice-' + name + 'E-mail: ' + email,
               sender=request.form.get('email'),
               recipients=['*****@*****.**'],
               text_body=message)
    return redirect(url_for('contact_mail.show_page'))
Ejemplo n.º 8
0
def start_bot(email, firstname, lastname, phonenumber, billingaddress, billingcity,
              billingstate, billingzip, creditcard, expirationmonth, expirationyear,
              ccv, shippingaddress, shippingcity, shippingstate, shippingzip, botpw,
              scrape3070, scrape3080, scrape3080aib, scrape3090, bestbuyemail, bestbuypw, bestbuyapikey,
              dryrun):
    info = make_info(email, firstname, lastname, phonenumber, billingaddress, billingcity,
                     billingstate, billingzip, creditcard, expirationmonth, expirationyear,
                     ccv, shippingaddress, shippingcity, shippingstate, shippingzip, botpw,
                     bestbuyemail, bestbuypw, bestbuyapikey)
    try:
        scrapers = []
        #Nvidia no longer selling on their site :(
        #Nvidia = NvidiaScraper(info, dryrun)
        #scrapers.append(Nvidia)
        if scrape3070:
            Best_Buy = BestBuyScraper(info, "3070", dryrun)
            scrapers.append(Best_Buy)
        if scrape3080:
            Best_Buy = BestBuyScraper(info, "3080 FE", dryrun)
            scrapers.append(Best_Buy)
        if scrape3080aib:
            Best_Buy = BestBuyScraper(info, "3080 aib", dryrun)
            scrapers.append(Best_Buy)
        if scrape3090:
            Best_Buy = BestBuyScraper(info, "3090", dryrun)
            scrapers.append(Best_Buy)
        a_stop_event = threading.Event()
        if not scrapers:
            warn("You must scrape one card, please use --scrape3070, --scrape3080, and or --scrape3090")
            a_stop_event.set()
        for scrape in scrapers:
            x = threading.Thread(target=scrape.start, args=[a_stop_event], daemon=True)
            x.start()
        while not a_stop_event.is_set():
            # wait for an event
            time.sleep(0.1)
        #used to suspend selenium to keep the browser alive, so the user can double check that it succeeded
        print("It appears the script has ran successfully \n"
              "Please check the browser session for a confirmation page\n"
              "After doing so enter input below")
        end_input = input("WARNING THIS WILL CLOSE BROWSER, press any key followed by enter:")
    except Exception as e:
        send_email(info.email, f"GPU scraper encountered an exception",
                   f"Exception listed below: "
                   f"{e}",
                   info.botpw)

        raise
Ejemplo n.º 9
0
 def wait_in_queue(self, finished_event):
     in_queue = True
     notification_count = 0
     while in_queue:
         good_info(f"Waiting in Queue for {self.gpu}...")
         button = self.driver.find_elements_by_css_selector(self.add_to_cart_sel)
         if button and "please wait" not in button[0].get_attribute('innerHTML').lower():
             self.add_to_cart(button[0], finished_event)
             in_queue = False
         elif notification_count == 0:
             send_email(self.personal_info.email, f"Found {self.gpu} in stock!",
                        f"Waiting in queue for {self.gpu}. "
                        f"Lookout for another email of the success or failure of buying the {self.gpu}"
                        f"USE THIS LINK TO TRY ON PHONE:\n"
                        f"{self.add_to_cart_url}"
                        "\n\n\n\n\n if that doesn't work click here:\n"
                        f"{self.card_url}",
                        self.personal_info.botpw)
             notification_count = 1
def signup_admin_post():
    email = request.form.get('email')
    username = request.form.get('username')
    password=request.form.get('password')
    user=User.find_user_by_email(email=email)
    
    if user:
        flash('Email address already exist')
       
        return redirect(url_for('admin.login_admin'))
    #fetching user data from the login form
    new_user= User(username,email,password)
    new_user.save_data 
    token=new_user.get_reset_password_token(600)
    #send user a confirmation email to confirmed account.
    send_email('Pheme Confirmation Email', sender=Configuration.MAIL_DEFAULT_SENDER,recipients=[new_user.email],
                text_body=render_template('/confirm.txt',title ='Account Confirmation Email',user=new_user,token=token),
                html_body= render_template('/confirm.html',title='Account Confirmation Email',user=new_user,token=token))
    flash('Check your signup mail to confirmation your account!')
    return redirect(url_for('admin.login_admin'))
def main(args):
    body_template = Template("""\
Hi $name,
    Salute fellow hacker! You're at our Python NETtalk for $date.

    Hacker Academy has booked $location for this 50 minute NETtalk \
starting promptly at $time, we hope you're enjoying the talk.

Wen and Alan
Hacker Academy
University of Toronto\
    """)

    sender = "*****@*****.**"
    pwd = getpass()

    subject_template = Template(
        "HA string.Template & smtplib demo $date $time "
        "$location_short")

    exec("from " + os.path.splitext(args.input_file)[0] + " import info")

    body = body_template.substitute(info)
    subject = subject_template.substitute(info)

    test_email = args.test if args.test else "*****@*****.**"

    if args.send:
        raw_input("Watch out! Email about to be sent!")
        send_email(sender,
                   pwd,
                   info["email"],
                   subject,
                   body,
                   cc=[
                       "*****@*****.**",
                       "*****@*****.**"
                   ])
    else:
        send_email(sender, pwd, info["email"], subject, body, test=True)
Ejemplo n.º 12
0
 def add_to_cart(self, add_to_cart_button, finished_event):
     in_stock("Best Buy", self.gpu)
     print("Attempting to Send Notification to " + self.personal_info.email)
     send_email(self.personal_info.email, f"Found {self.gpu} in stock!",
                f"Attempting to buy {self.gpu}. "
                f"Lookout for another email of the success or failure of buying the {self.gpu}"
                f"USE THIS LINK TO TRY ON PHONE:\n"
                f"{self.add_to_cart_url}"
                "\n\n\n\n\n if that doesn't work click here:\n"
                f"{self.card_url}",
                self.personal_info.botpw)
     good_info("Proceeding to buy...")
     try:
         add_to_cart_button.click()
         cart_link = WebDriverWait(self.driver, 10).until(
             EC.presence_of_element_located((By.CSS_SELECTOR, self.go_to_cart_sel)))
         cart_link.click()
     except TimeoutException as e:
         if "please wait" in add_to_cart_button.get_attribute('innerHTML').lower():
             self.wait_in_queue(finished_event)
         else:
             self.spam_add_to_cart()
     self.buy_card(finished_event)
def confirm_user(token):
    user = User.verify_reset_password_token(token)
    print(token)
    print(user)
    if user:
        return redirect(url_for('admin.login_admin', token=token))
    else:
        #send user a confirmation email to confirmed account.
        send_email(
            'Pheme Confirmation Email',
            sender=Configuration.MAIL_DEFAULT_SENDER,
            recipients=[user.email],
            text_body=render_template('/confirm.txt',
                                      title='Account Confirmation Email',
                                      user=user,
                                      token=token),
            html_body=render_template('/confirm.html',
                                      title='Account Confirmation Email',
                                      user=user,
                                      token=token))
        flash(
            'Confirmation expired,Another confirmation message has been sent to your email address'
        )
        return redirect(url_for('admin.login_admin'))
def forget_password_post():

    email = request.form.get('email')

    user = User.find_user_by_email(email=email)

    if user:
        token = user.get_reset_password_token(600)

        send_email('Pheme Account Reset',
                   sender=Configuration.MAIL_DEFAULT_SENDER,
                   recipients=[user.email],
                   text_body=render_template('/reset_password.txt',
                                             user=user,
                                             token=token),
                   html_body=render_template('/message.html',
                                             title='Email',
                                             user=user,
                                             token=token))
        return redirect(url_for('admin.login_admin'))

    else:
        flash('Wrong email address')
        return redirect(url_for('email.forget_password'))
Ejemplo n.º 15
0
async def basvuru(ctx, email=None, *, major=None):
    await ctx.channel.purge(limit=1)

    channel = client.get_channel(SERVER_LOG_CHANNEL_ID)

    user_id = ctx.message.author.id
    user_email = email
    is_university_email = check_if_university(user_email)
    user_major = major

    if user_email is None:
        embed = create_embed()
        embed.add_field(
            name=":x: İşlem başarısız.",
            value=f"{ctx.author.mention} | Lütfen bir mail adresi girin.",
            inline=False)
        embed.add_field(name="İyi eğlenceler dileriz.",
                        value="CS Türkiye Yönetimi",
                        inline=True)
        await ctx.send(embed=embed)
        return

    if user_major is None:
        embed = create_embed()
        embed.add_field(
            name=":x: İşlem başarısız.",
            value=
            f"{ctx.author.mention} | Lütfen başvuru yaparken bölümünüzü belirtin.",
            inline=False)
        embed.add_field(name="İyi eğlenceler dileriz.",
                        value="CS Türkiye Yönetimi",
                        inline=True)
        await ctx.send(embed=embed)
        return

    if not is_university_email:
        embed = create_embed()
        embed.add_field(
            name=":x: İşlem başarısız.",
            value=
            f"{ctx.author.mention} | Girdiğiniz mail adresi bir üniversiteye ait değildir, lütfen"
            f" bir üniversite mail adresi giriniz.",
            inline=False)
        embed.add_field(name="İyi eğlenceler dileriz.",
                        value="CS Türkiye Yönetimi",
                        inline=True)
        await ctx.send(embed=embed)
        return

    if user_id in email_dict:
        embed = create_embed()
        embed.add_field(
            name=":warning: İşlem başarısız.",
            value=
            f"{ctx.author.mention} | Başvurunuz mevcut, lütfen .onayla komutu ile kendinizi"
            f" onaylayınız.",
            inline=False)
        embed.add_field(name="İyi eğlenceler dileriz.",
                        value="CS Türkiye Yönetimi",
                        inline=True)
        await ctx.send(embed=embed)
        return

    user_n = ctx.message.author.name
    user_key = send_email(user_n, email)

    if user_key is None:
        embed = create_embed()
        embed.add_field(
            name=":warning: Hata",
            value=
            f"{ctx.author.mention} | Bir şeyler yanlış gitti, lütfen bir yetkiliye bu durumu bildiriniz.",
            inline=False)
        embed.add_field(name="İyi eğlenceler dileriz.",
                        value="CS Türkiye Yönetimi",
                        inline=True)
        await ctx.send(embed=embed)
        return

    email_dict[user_id] = (user_n, int(user_key), user_email, user_major)

    embed = create_embed()
    embed.add_field(
        name=":white_check_mark: İşlem Başarılı.",
        value=
        f"{ctx.author.mention} | Üniversite başvurunuz alınmıştır, lütfen mailinizi kontrol ediniz.",
        inline=False)
    embed.add_field(name="İyi eğlenceler dileriz.",
                    value="CS Türkiye Yönetimi",
                    inline=True)
    await ctx.send(embed=embed)

    embed = create_embed()
    embed.add_field(
        name="Üniversite Rolü Başvurusu Alındı.",
        value=
        f"{ctx.author.mention} isimli üyenin bölümü {user_major} olup üniversite rolü başvurusu alınmıştır."
        f" Lütfen onaylanma mesajını bekleyiniz.",
        inline=False)
    embed.add_field(name="İyi eğlenceler dileriz.",
                    value="CS Türkiye Yönetimi",
                    inline=True)
    await channel.send(embed=embed)
Ejemplo n.º 16
0
    except:  
        pass
    print get_time()+'pojie_zip error'
def get_zip(zip_path,date):
	url = 'https://iiio.io/download/'+str(date)+'/Windows系列跟苹果系列.zip'
	content=urllib.urlopen(url)
	if content.getcode()==200:
		urllib.urlretrieve(url, zip_path)
		print get_time()+' get zip done'
		return 1
	else:
		print get_time()+' Not Update.'
		return 0

def get_pwd(url):
	tags = BeautifulSoup(urllib2.urlopen(url).read(),"lxml").find_all('span',style="color: #3366ff;")
	for tag in tags:
		pwd = tag.string.split('密码:'.decode('utf-8'))[1]
		print get_time()+'get password: '******'__main__':
	print get_time()+'go on ...'
	if cf.sended_date != cf.date:
		if get_zip(cf.zip_path,str(cf.date)):
			pwd = get_pwd(cf.hosts_url)
			pojie_zip(cf.zip_path,cf.pwd)
			send_email(cf.receivers,cf.mail_content,cf.mail_title,cf.mail_attach)
			cf.sended_date = cf.date
	else:
		print get_time()+'sended today'