예제 #1
0
class ApiWrapper(object):
    BASE_URL = None
    DEFAULT_HEADERS = {
        'User-Agent':
        'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
    }

    def __init__(self, proxy_file_path=None):
        self.__initialize_session()
        self.proxy_manager = ProxyManager(proxy_file_path)

    def __initialize_session(self):
        self.session = requests.session()
        self.session.headers.update(self.DEFAULT_HEADERS)

    def get_random_proxy(self):
        return self.proxy_manager.random_proxy().get_dict()

    def make_url(self, endpoint):
        is_full_url = endpoint.startswith('http')
        if not is_full_url and not self.BASE_URL:
            raise ValueError('Must set BASE_URL')
        return endpoint if is_full_url else self.BASE_URL + str(endpoint)

    def request(self, method, url, **kwargs):
        proxy = kwargs.get('proxies', self.get_random_proxy())
        return self.session.request(method=method,
                                    url=self.make_url(url),
                                    proxies=proxy,
                                    **kwargs)

    def get(self, url, params=None, **kwargs):
        return self.request('get', url, params=params, **kwargs)

    def post(self, url, data=None, json=None, **kwargs):
        return self.request('post', url, data=data, json=json, **kwargs)

    def put(self, url, data=None, **kwargs):
        return self.request('put', url, data=data, **kwargs)

    def patch(self, url, data=None, **kwargs):
        return self.request('patch', url, **kwargs)

    def delete(self, url, **kwargs):
        return self.request('delete', url, **kwargs)
예제 #2
0
 def monitor(self, sleepTime=30):
     proxyManager = ProxyManager('proxies.txt')
     self._productsSeen = []
     self.getTopNProducts(
         1
     )  # publish the latest product seen at the start of the monitoring
     r = requests.get(self.apiLink)
     jsonObj = r.json()
     objects = jsonObj['objects']
     for obj in objects:
         slug, title, imgURL = self._parseProperties(obj)
         self._productsSeen.append(title)
     while (True):
         try:
             _flush('Looking for products')
             proxy = proxyManager.random_proxy()
             _flush('Using proxies %s' % proxy.get_dict())
             r = requests.get(self.apiLink, proxies=proxy.get_dict())
             jsonObj = r.json()
             objects = jsonObj['objects']
             for obj in objects:
                 slug, title, imgURL = self._parseProperties(obj)
                 if title in self._productsSeen:
                     continue
                 print('New product found :-D')
                 self._productsSeen.append(title)
                 product = self._getProduct(slug)
                 price, currency, sizes, method, releaseDate = self._getProductInfo(
                     product)
                 self.webhook.send(embed=self._createEmbed(
                     slug, title, imgURL, price, currency, sizes, method,
                     releaseDate))
                 _flush('Found new product!')
         except Exception as err:
             _flush('Encountered some exception')
             _flush(repr(err))
         finally:
             _flush('Sleeping for %ss, will query for products once done' %
                    sleepTime)
             time.sleep(sleepTime)
예제 #3
0
def generator():
    global session
    s = requests.Session()

    first = names.get_first_name(gender= 'male') # random first name
    last = names.get_last_name() # random last name
    catchall = '@gmail.com' # input your catchall
    password = '******' # input a password
    random_number = random.randint(1,10000)
    email = last+f'{random_number}'+catchall

    proxym = ProxyManager('proxies.txt') # create a proxies.txt file and paste in proxies
    proxyr = proxym.random_proxy()
    proxyf = proxyr.get_dict()

    info = {
    'form_type': 'create_customer',
    'utf8': '✓',
    'customer[first_name]': first,
    'customer[last_name]': last,
    'customer[email]': email,
    'customer[password]': password
    }

    submit_info = s.post(url, data=info, headers=headers, proxies=proxyf) # submits first request

    if submit_info.url == 'https://cncpts.com/': # if account was submitted then this will be the site after the request
        print('Successfully signed up!')
        print(f'{email}:{password}')

    else:
        print('Captcha needed, submitting now...') # otherwise you need a captcha
        url_cap = s.get('https://cncpts.com/challenge')
        soup = BeautifulSoup(url_cap.content, 'html.parser')
        auth_val = soup.findAll("input", {"name": "authenticity_token"}) # grabs hidden authenticity token from source
        auth_final = auth_val[0]["value"]

        api_key = '' # api key from anticaptcha
        site_key = '6LeoeSkTAAAAAA9rkZs5oS82l69OEYjKRZAiKdaF' # site key from concepts
        cap_url = submit_info.url

        client = AnticaptchaClient(api_key)
        task = NoCaptchaTaskProxylessTask(cap_url, site_key)
        job = client.createTask(task)
        job.join()
        response = job.get_solution_response() # grabs token from anticaptcha

        cap_info = {
        'utf8': '✓',
        'authenticity_token': auth_final,
        'g-recaptcha-response': response
        }

        cap_headers = {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Referer': 'https://cncpts.com/challenge',
        'Upgrade-Insecure-Requests': '1',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'
        }

        submit_captcha = s.post(url, data=cap_info, headers=cap_headers, proxies=proxyf) # submits second request with captcha

        if submit_captcha.url == 'https://cncpts.com/': # if account was submitted then this will be the site after the request
            print('Captcha successfully submitted!')
            print(f'{email}:{password}')

        else:
            print('Account signup unsuccessful, please try again.') # otherwise there was a problem with the captcha
예제 #4
0
def create():
    global session

    useProxies = config['useproxies']

    proxy_manager = ProxyManager('proxies.txt')

    if useProxies:
        random_proxy = proxy_manager.random_proxy()
        proxee = random_proxy.get_dict()
    else:
        proxee = None

    if config['userealname']:
        fName = config['firstname']
        lName = config['lastname']
    else:
        fName = names.get_first_name()
        lName = names.get_last_name()

    email = names.get_first_name() + names.get_last_name() + config['catchall']

    url = 'https://undefeated.com/account'

    payload = {
        'form_type': 'create_customer',
        'utf8': '✓',
        'customer[first_name]': fName,
        'customer[last_name]': lName,
        'customer[email]': email,
        'customer[password]': config['password']
    }

    headers = {
        'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36',
        'Upgrade-Insecure-Requests': '1'
    }

    with logger.printLock:
        print(
            time.strftime("[%H:%M:%S]") + Fore.CYAN +
            'Grabbing cookies from home page')
    session.get('https://undefeated.com', proxies=proxee, headers=headers)

    with logger.printLock:
        print(time.strftime("[%H:%M:%S]") + Fore.YELLOW + 'Signing up')
    req = session.post(url,
                       data=payload,
                       headers=headers,
                       proxies=proxee,
                       allow_redirects=False)

    if req.text == '<html><body>You are being <a href="https://undefeated.com/challenge">redirected</a>.</body></html>':
        with logger.printLock:
            print(
                time.strftime("[%H:%M:%S]") + Fore.RED +
                'Error creating account, possibly captcha')
    else:
        with logger.printLock:
            print(
                time.strftime("[%H:%M:%S]") + Fore.GREEN +
                "Successful account creation using %s" % (email))
            with open("undefeatedaccts.txt", "a+") as f:
                f.write(email + ':' + config['password'] + "\n")
print("{}Config Loaded".format(getCurrentTime()))

account_creation_link = 'https://undefeated.com/account/'

# Debug logging
#http.client.HTTPConnection.debuglevel = 1
#logging.basicConfig()
#logging.getLogger().setLevel(logging.DEBUG)
#req_log = logging.getLogger('requests.packages.urllib3')
#req_log.setLevel(logging.DEBUG)
#req_log.propagate = True

for x in range(10):
    RGmail = "{}+{}_{}{}".format(beggmail, (randint(0, 99)), (randint(0, 99)),
                                 gmail)
    random_proxy = proxy_manager.random_proxy()
    proxies = random_proxy.get_dict()
    print(proxies)
    session = requests.Session()
    #	session.headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36'}
    session.headers = {'User-Agent': ua.random}
    print(ua.random)
    #session.config['keep_alive'] = False

    payload1 = {
        "form_type": "create_customer",
        "utf8": "&#10004",
        "customer[first_name]": first_name,
        "customer[last_name]": last_name,
        "customer[email]": RGmail,
        "customer[password]": password
예제 #6
0
if len(sys.argv) != 3:
    print("format: python nakedcph_acct_gen.py <emails> <proxies>")
    sys.exit(1)
p = ProxyManager(sys.argv[2])
if len(p.proxies) == 0:
    p = ProxyManager()


while len(emails) > 0:
    email = emails[0]
    if len(email) == 0:
        emails.remove(email)
        continue
    s.cookies.clear()
    print("Creating account for {}".format(email))
    proxy = p.random_proxy().get_dict()

    url = 'https://www.nakedcph.com'
    h = headers
    try:    
        response = s.get(url, headers=h, proxies=proxy)
        print("igenom cloudflare...")
        url = 'https://www.nakedcph.com/auth/view?op=register'
       
            if result['StatusCode'] == 500 and result['Status'] == 'fel':
                print("error: {}".format(result['Status']))
                print("retrying {}...".format(email))
            else:
                print("du har redan acc {}, skippar".format(email))
                emails.remove(email)
        except json.decoder.JSONDecodeError as e: