示例#1
0
class TempEmail(object):
    def __init__(self):
        self.tm = TempMail()
        self.email = self.tm.get_email_address()

    # this method will wait the needed for us email
    # if you send number_of_email=3 , this method will
    # wait a third email and return link from it
    def get_link_from_email_by_number(self, number_of_email, number_of_link=1):
        delay = 5
        start_time = time.time()
        while True:
            time.sleep(delay)
            mail = self.tm.get_mailbox(self.email)
            current_time = time.time()
            end_time = current_time - start_time
            # if the letter doesnt come in 10 minutes function will return None
            if end_time > 600:
                print('Message hasn`t came more than 10 minutes')
                return None
            if isinstance(mail, list) and len(mail) == number_of_email:
                mail = self.tm.get_mailbox(self.email)[number_of_email - 1]
                html = mail.get('mail_text_only')
                parser = MyHTMLParser()
                parser.feed(html)
                return parser.result[number_of_link]
示例#2
0
class TempEmail(object):
    def __init__(self):
        self.tm = TempMail()
        self.email = self.tm.get_email_address()

    def get_email_by_number(self, number_of_email):
        """
        interval of function checking mail
        if the interval will be to fast(small) like 0.5 seconds
        the server will return 429 error
        """
        delay = 5
        start_time = time.time()
        while True:
            time.sleep(delay)
            mail = self.tm.get_mailbox(self.email)
            current_time = time.time()
            end_time = current_time - start_time
            # if the letter doesnt come in 10 minutes function will return None
            if end_time > 600:
                print('Message hasn`t came more than 10 minutes')
                return None
            if isinstance(mail, list) and len(mail) == number_of_email:
                return mail[number_of_email - 1]
示例#3
0
class YourserverBuyer(VPSBuyer):
    """
    This class orders a VPS from yourserver.se
    """
    def __init__(self, email="", password=""):
        """
        Initializes an YourserverBuyer with the given email and password.
        email -- The email address to use.
        password -- The password to use for creating an account.
        """
        self.tm = TempMail()
        if email == "":
            email = self.tm.get_email_address()
        super(YourserverBuyer, self).__init__(email, password, "root", BogusFormBuilder().getRNString(30))


    def buy(self):
        """
        Walks through the entire process of buying a VPS from Yourserver.
        Returns True if it succeeded, returns False otherwise.
        """
        succeeded = self.placeOrder() # places the order
        if not succeeded:
            return False
        time.sleep(30) # Wait for half a minute so Yourserver can process the payment
        succeeded = self.getSSHInfo(self.SSHPassword)
        return succeeded

    def placeOrder(self):
        """Places an order on Yourserver for a new VPS."""
        try:
            self.spawnBrowser()
            self.driver.get("https://www.yourserver.se/cart.php?a=confproduct&i=0")
            self.driver.find_element_by_css_selector('.ordernow').click()
            self.driver.implicitly_wait(5)
            self.chooseSelectElement("configoption[2]", "Ubuntu 14.04")

            self.driver.find_element_by_css_selector('.checkout').click()
            self.driver.implicitly_wait(10)
            time.sleep(5)
            self._fill_in_form()
            self.driver.find_element_by_css_selector('.ordernow').click()
            
            print("Email used: " + self.email)
            print("Password used: " + self.password)
            print("SSHPassword to be used: " + self.SSHPassword)
            print("SSHUsername to be used: " + self.SSHUsername)
            
            try:
                self.driver.find_element_by_css_selector('input[value="Pay Now"]').click()
            except Exception as e:
                print("Warning: Pay now button not found")

            paymentSucceeded = self._pay()
            if not paymentSucceeded:
                return False

            # Wait for the transaction to be accepted
            wait = ui.WebDriverWait(self.driver, 666)
            wait.until(lambda driver: driver.find_element_by_css_selector('.payment--paid'))

            time.sleep(60)

            emails = self.tm.get_mailbox(self.email)
            mails_html = emails[0][u'mail_html'] + emails[1][u'mail_html']
            #print(mails_html)

            verify_url = mails_html.split('clicking the link below:<br>\n<a href=\'')[1].split('\'')[0]
            print("verify URL: " +verify_url)

            password = mails_html.split('Password: '******'\n')[0]
            self.password = password[:-2] # Split off the last two characters of the password, those are empty characters that aren't part of the password
            print("password used: " + self.password)

            self.driver.get(verify_url)

            time.sleep(10)
            self.closeBrowser()


        except Exception as e:
            print("Could not complete the transaction because an error occurred:")
            print(e)
            self.closeBrowser()
            return False
            #raise # Raise the exception that brought you here

        return True


    def _fill_in_form(self):
        """Fills the form with values."""
        print(self.generator.getFirstName())
        self.fillInElement('firstname', self.generator.getFirstName())
        self.fillInElement('lastname', self.generator.getSurname())
        self.fillInElement('email', self.email)

    def _pay(self):
        bitcoinAmount = self.driver.find_element_by_css_selector(".ng-binding.payment__details__instruction__btc-amount").text
        toWallet = self.driver.find_element_by_css_selector(".payment__details__instruction__btc-address.ng-binding").text
        print("amount: " + bitcoinAmount)
        print("to wallet: " + toWallet)
        wallet = Wallet()
        return wallet.payToAutomatically(toWallet, bitcoinAmount)

    def getSSHInfo(self, SSHPassword=''):
        """
        Retrieves the SSH login information for our bought VPS.
        SSHPassword -- The password to use for sshconnections. (Default is '')
        """
        if SSHPassword != '':
            self.SSHPassword = SSHPassword
        try:
            self.spawnBrowser()
            self.driver.get("https://www.yourserver.se/portal/clientarea.php")
            self._login()
            self.driver.get("https://www.yourserver.se/portal/clientarea.php?action=emails")


            action = self.driver.find_element_by_css_selector('.btn.btn-info').get_attribute('onclick')
            email_url = "https://www.yourserver.se/portal/viewemail.php?id=" + action.split('?id=')[1].split('\'')[0]
            self.driver.get(email_url)

            self._extract_information()
            self.closeBrowser()
        except Exception as e:
            print("Could not complete the transaction because an error occurred:")
            print(e)
            #raise # Raise the exception that brought you here
            self.closeBrowser()
            return False
        return True

    def _login(self):
        """login on the website of Yourserver."""
        self.fillInElement('username', self.email)
        self.fillInElement('password', self.password)
        self.driver.find_elements_by_name('rememberme').pop().click()
        self.driver.find_element_by_id('login').click()

    def _extract_information(self):
        """
        Extract the IP address and SSH Password.
        The values can then be found in self.SSHPassword and self.IP.
        """
        email = self.driver.find_element_by_css_selector(".popupcontainer").text
        lines = email.split('\n')
        self.IP = lines[4].split(': ')[1]
        self.SSHPassword = lines[7].split(': ')[1]
def nessus_activation():
    tmp = TempMail()
    email = tmp.get_email_address()
    print("Your Temp mail address is successfully created!")
    print("Email Address: " + email)
    # print tmp.get_mailbox(email)
    #Nessus Registeration Form
    print("\033[1;32;10mNessus Registeration Form \033[1;32;0m")
    ht = requests.get("https://www.tenable.com/products/nessus-home")
    bs = BeautifulSoup(ht.text, 'html.parser')
    for link in bs.findAll("input", {"name": "token"}):
        if 'name' in link.attrs:
            tkn = link.attrs['value']
        else:
            print("not found")
    fname = raw_input("First Name:")
    lname = raw_input("Last Name:")
    # nes_email=raw_input("Email:")
    params = {
        "first_name": fname,
        "last_name": lname,
        "email": email,
        "country": "IN",
        "Accept": "Agree",
        "robot": "human",
        "type": "homefeed",
        "token": tkn,
        "submit": "Register"
    }
    r = requests.post("https://www.tenable.com/products/nessus-home",
                      data=params)
    if r.status_code == 200:
        bs = BeautifulSoup(r.text, 'html.parser')
        keyword = bs.find("title").get_text()
        success = keyword.split('|')
        if str(success[0]
               [:-1]) == 'Thank You for Registering for Nessus Home!':
            print('\033[1;32;10m' + str(success[0][:-1]) + '\033[1;32;0m')
            while True:
                if tmp.get_mailbox(email):
                    for emails in tmp.get_mailbox(email):
                        if emails[
                                'mail_subject'] == 'Tenable Nessus Home Activation Code':
                            message = emails['mail_text']
                            receive = raw_input(
                                "To check for Nessus Activation Code in Inbox, press enter"
                            )
                            regex = r"\w{4}(?:-\w{4}){4}"
                            activation_code = re.search(regex, message)
                            print(
                                '\033[1;32;10mNessus Activation Code is:\033[1;32;0m'
                                + activation_code.group())
                            sys.exit()
                else:
                    print('There are no emails yet....')

        elif bs.find('span', {"style": "color:#FF0000;"}).get_text():
            os.system('clear')
            # print('\033[1;31;10m'+bs.find('span',{"style":"color:#FF0000;"}).get_text()+'\033[1;31;0m')
            print(
                '\033[1;31;10m Sorry, This Email Address is already Registered for Nessus Activation Code\033[1;31;0m'
            )
            print("Wait..Regenerating new Temp email address")
            nessus_activation()
    else:
        print("something went wrong with the request")
        sys.exit()
示例#5
0
from tempmail import TempMail

tm = TempMail()
email = tm.get_email_address()
print(email)
示例#6
0
def newmail(m):
    #initialize Temp-Male and making a new Email.
    tm = TempMail()
    email = tm.get_email_address()
    r.set('email:{}:mail'.format(str(m.from_user.id)), email)
    bot.send_message(m.chat.id, '📧Your new Email: ' + email)
	# first part of email, also used for username currently
	if randompostfix:
		postfix = str(random.randint(0, 999)).zfill(3)
	else:
		postfix = str(i).zfill(3)
	
	emailprefix = accountprefix + postfix
	
	print "email prefix is " + emailprefix

	tm = TempMail(login=emailprefix)
	
	# full email
	try:
		email = tm.get_email_address()
	except scanner.JSONDecodeError:
		# this generally doesn't fall through unless you try and get the email before
		# the TempMail call finishes...
		time.sleep(2)
		email = tm.get_email_address()
		print "get email address failed"

	print "%s : %s - %s %s - %s - %s" % (email, password, fname, lname, '-'.join(dob), rand_country[0])

	highload = True

	tries = 1
	secondsuccess = False
	while not secondsuccess and tries <= 3:
		sess = requests.Session()
示例#8
0
def get_mail():
    tm = TempMail()
    email = tm.get_email_address()  # [email protected]  создаем почту
    key = tm.get_mailbox(email)  # list of emails получаем письма из почты