def run(): Console.print_name() email = Console.ask_string('Futbin Email: ') Console.print_name() password = Console.ask_string('Futbin Password: '******'[yellow]Attempting login...[/yellow]') status = futbin.login(Proxy(None, None)) if status != ResponseType.SUCCESS: print(f'[red]Error logging in.[/red]') return print(f'[green]Successfully logged in![/green]') Console.print_name() print(f'[yellow]1 - PC[/yellow]') print(f'[yellow]2 - PS4[/yellow]') print(f'[yellow]3 - Xbox One[/yellow]') entry = Console.ask_integer('Please choose from the menu above.') platform = 'pc' if entry == 2: platform = 'ps4' elif entry == 3: platform = 'xone' print(f'[yellow]Attempting to pull your favorites...[/yellow]') players = futbin.pull_favorites() if players == ResponseType.BANNED: print(f'[red]Error pulling favorites.[/red]') return print(f'[green]Successfully pulled {len(players)} players![/green]') for player in players: player.pull_sales(Proxy(None, None), platform) print( f'[green]Successfully pulled sales record for {player.NAME}![/green]' ) filename = datetime.datetime.now().strftime("%m.%d.%Y.%H.%M") print(f'[green]Successfully saved to {filename}.csv![/green]') write_csv(players, filename)
def routes_restart(): # Rebuild chains Proxy.reset() Proxy.build_all(Data.get('proxies')) try: Proxy.prepare(Data.get('routes')) Proxy.exec() return bottle.redirect('/routes') except Exception as e: return bottle.redirect('/routes?{0}'.format(urlencode({'msg': str(e)})))
def __init__(self, inputs): # http could be replaced by getProtocol(url) self.proxies = Proxies(config.getProxiesFiles(), "http") self.proxy = Proxy(mapper.json2obj(self.proxies.GetRandom())) self.driver = web.getFirefoxDriver(self.proxy) self.inputs = inputs self.element = None self.elements = None self.results = None
def get_proxy(service): query = Proxy.select().where(Proxy.service == service, Proxy.created == date.today()) used_proxies = [p.ip for p in query] proxies = app.config['PROXY_LIST'] valid_proxies = list(filter(lambda p: p not in used_proxies, proxies)) if valid_proxies: return secrets.choice(valid_proxies) return None
def proxy_delete(proxy_name): new_proxies = Data.get('proxies').copy() new_proxies.pop(proxy_name) # Rebuild chains Proxy.reset() Proxy.build_all(new_proxies) try: Proxy.prepare(Data.get('routes')) Data.set('proxies', new_proxies) Data.save() Proxy.exec() return bottle.redirect('/proxy') except Exception as e: return bottle.redirect('/proxy?{0}'.format(urlencode({'msg': str(e)})))
def proxy_add(): if bottle.request.forms.get('name') is not None: proxy = {} proxy['type'] = bottle.request.forms.get('ptype') if proxy['type'] is None: return bottle.redirect('/proxy/add?{0}'.format(urlencode({'msg': 'Type field is mandatory'}))) proxy['host'] = bottle.request.forms.get('host') if proxy['host'] is None: return bottle.redirect('/proxy/add?{0}'.format(urlencode({'msg': 'Host field is mandatory'}))) proxy['port'] = bottle.request.forms.get('port') if proxy['host'] is None: return bottle.redirect('/proxy/add?{0}'.format(urlencode({'msg': 'Port field is mandatory'}))) user = bottle.request.forms.get('user') if user is None and proxy['type'] == 'ssh': return bottle.redirect('/proxy/add?{0}'.format(urlencode({'msg': 'User field is mandatory for SSH'}))) elif user is not None: proxy['user'] = user password = bottle.request.forms.get('password') if password is not None: proxy['password'] = password sshkey = bottle.request.forms.get('sshkey') if sshkey is not None: proxy['sshkey'] = sshkey if proxy['type'] == 'ssh' and password is None and sshkey is None: return bottle.redirect('/proxy/add?{0}'.format(urlencode({'msg': 'You must provide password or SSH key for SSH'}))) previous = bottle.request.forms.get('previous') if previous != 'None': proxy['proxy'] = previous hostkeys = bottle.request.forms.get('hostkeys') if len(hostkeys) > 0: proxy['hostkeys'] = hostkeys.split('\n') new_proxies = Data.get('proxies').copy() new_proxies[bottle.request.forms.get('name')] = proxy # Rebuild chains Proxy.reset() Proxy.build_all(new_proxies) try: Proxy.prepare(Data.get('routes')) Data.set('proxies', new_proxies) Data.save() Proxy.exec() return bottle.redirect('/proxy') except Exception as e: return bottle.redirect('/proxy?{0}'.format(urlencode({'msg': str(e)}))) return {"title": "DockerAnon | Proxy", "proxy": list(Data.get('proxies').keys()), "msg": bottle.request.query.msg}
def _load_proxies(self): proxy_type = self._proxy_type() if proxy_type is None: return [] while True: self.Console.print_name() file_path = self.Console.ask_string( 'Please drag in your proxy file').replace('"', '') loaded_file = read_list(file_path) if loaded_file is False: continue return [Proxy(proxy, proxy_type) for proxy in loaded_file]
def routes_add(): if bottle.request.forms.get('name') is not None: route = {} route['network'] = bottle.request.forms.get('network') if route['network'] is None: return bottle.redirect('/routes/add?{0}'.format(urlencode({'msg': 'Network field is mandatory'}))) route['proxy'] = bottle.request.forms.get('proxy') new_routes = Data.get('routes').copy() new_routes[bottle.request.forms.get('name')] = route # Rebuild chains Proxy.reset() Proxy.build_all(Data.get('proxies')) try: Proxy.prepare(new_routes) Data.set('routes', new_routes) Data.save() Proxy.exec() return bottle.redirect('/routes') except Exception as e: return bottle.redirect('/routes?{0}'.format(urlencode({'msg': str(e)}))) return {"title": "DockerAnon | Routes", "proxy": list(Data.get('proxies').keys()), "msg": bottle.request.query.msg}
async def _score_counter(self, pattern_str, proxy_str, valid): if pattern_str not in self.pattern_lock_map: self.pattern_lock_map[pattern_str] = asyncio.Lock() async with self.pattern_lock_map[pattern_str]: proxy_json = await self.redis.hget(pattern_str, proxy_str) if proxy_json is None: return proxy = Proxy.loads(proxy_json) if valid: if proxy.score < 0: proxy.score = 0 elif 0 <= proxy.score < 5: proxy.score += 1 else: existed_time = int(time.time()) - proxy.insert_time if existed_time > proxy.valid_time > 0: await self._del_proxy_in_pattern(pattern_str, proxy) else: proxy.score -= 1 proxy.used = True await self.redis.hset(pattern_str, proxy_str, proxy.dumps())
from models.data import Data from models.proxy import Proxy from models.dns import DNSServer, UDPRequestHandler Data.load() DNS_HOST = os.getenv('GATEWAY_IP') DNS_FORWARDER = '127.0.0.1' DNS_FORWARDER_PORT = 5353 DNS = DNSServer((DNS_HOST, 53), UDPRequestHandler) # Launch DNS DNS.load_zone() DNS.set_forwarder(DNS_FORWARDER, 5353) DNS.start() # Launch Proxy Proxy.reset() Proxy.build_all(Data.get('proxies')) Proxy.prepare(Data.get('routes')) Proxy.exec() @bottle.route('/static/<filename:path>') def server_static(filename): return bottle.static_file(filename, root='static') @bottle.route('/save') def download(): return bottle.static_file('gateway.yaml', root='/root/webui', download='gateway.yaml')
def Proxy(self): return Proxy(self)
def _random_proxy(self): if len(self.PROXIES) == 0: return Proxy(None, None) return random.choice(self.PROXIES)
def scrap_plate_number(vehicle): max_retries = 3 logger.info('\tStarting') logger.info('\tQuerying {}'.format(vehicle.id)) proxy_server = get_proxy(service='sunarp') if not proxy_server: logger.info('\tError: Out of proxies!') logger.info('\tFinished') return processed = False retries = 0 while not processed: if retries == max_retries: logger.info('\tGiving up!') # Update vechicle status record vehicle.status = 3 # Error vehicle.save() break try: logger.info('\tUsing proxy {}'.format(proxy_server)) driver = get_driver(proxy_server) record = scrap_and_recognize(driver, vehicle) if record['plate_number'] != vehicle.id: record['status'] = 2 # Invalid # Update vehicle fields vehicle.plate_number = record['plate_number'] vehicle.serial_number = record['serial_number'] vehicle.vin_number = record['vin_number'] vehicle.engine_number = record['engine_number'] vehicle.color = record['color'] vehicle.make = record['make'] vehicle.model = record['model'] vehicle.valid_plate_number = record['valid_plate_number'] vehicle.previous_plate_number = record['previous_plate_number'] vehicle.state = record['state'] vehicle.notes = record['notes'] vehicle.branch = record['branch'] vehicle.owners = record['owners'] vehicle.image_path = record['image_path'] vehicle.status = record['status'] vehicle.save() processed = True logger.info('\tProcessed') except NoSuchElementException: logger.info('\tError: Element not found') try: label = driver.find_element_by_xpath( '//span[contains(@id, "MainContent_lblWarning")]') if 'número máximo' in label.text: logger.info('\tError: Max queries reached for {}'.format( proxy_server)) # Save this invalid proxy in table and ask for another one Proxy.create(service='sunarp', ip=proxy_server) proxy_server = get_proxy(service='sunarp') if not proxy_server: logger.info('\tError: Out of proxies!') processed = True else: retries += 1 logger.info('\tRetrying...') except NoSuchElementException: logger.info('\tError: Scraping problem') vehicle.status = 3 # Error vehicle.save() processed = True else: retries += 1 logger.info('\tRetrying...') except JavascriptException: logger.info('\tError: Javascript') logger.info('\tRetrying...') retries += 1 except AttributeError: # Probably something wrong with the license image logger.info('\tError: Invalid image') logger.info('\tRetrying...') retries += 1 finally: try: driver.quit() except Exception: pass logger.info('\tFinished')