Bonjour
j'ai installer python sur mon serveur au aussi selenium et chromedriver, en executant mon script, je recoit des erreurs que j'ai chercher mais un un peu en detresse car pas de solution
j'ai ajouter un screen : https://ibb.co/8xg57Vy
merci
Bonjour @SemD ,
Il semblerait que ce soit lier à un défaut de permission:
* Exécutez vous le script en tant que root ?
* Pouvez-vous nous partager le fonctionnement de votre script ?
Pouvez vous faire:
* `cd /home/fretax003/public_html/;ls -l`
Je vois aussi que votre dossier est nommé "public_html":
* Avez-vous un serveur web qui tourne ? Si oui, lequel ?
* Est-ce au travers d'une page web que vous lancez le script ?
Prenez en considération que les processus qui fonctionnent entre le port 1 et le port 1024 sont réservés à l'utilisateur root.
Bien à vous.
oui Bonjour mon cher,<br /> si j'ai un serveur qui tourne, un virtuel serveur centos 7, ram 2 cores 1<br /><br />bien sur que oui je suis en ROOT, c'est sur l'image que j'ai ajouter dans mon message precedant.<br /><br />non pas autravers d'une page web en effent comme c'est un script python je prevois le lancer regulièrement chaque une heure, mais je ne sais pas encore comment le faire. et aussi il faut que je regle le probleme pour que ça marche.<br /><br /><br />------<br />Prenez en considération que les processus qui fonctionnent entre le port 1 et le port 1024 sont réservés à l'utilisateur root.<br />-------- UN SCRIPT PYTON SE LANCE SUR QUEL PORT, vue qu'il va demarre chrome en amont je prense que c'est du 80? n'es pas?<br /><br /><br />mon script:<br /><br /> """<br /> @author: Maxime.<br /><br /> Github: https://github.com/maximedrn<br /> Demonstration website: https://maximedrn.github.io/hcaptcha-test/<br /> Version: 1.1<br /> """<br /> import selenium<br /> from webdriver_manager.chrome import ChromeDriverManager<br /> # Colorama module: pip install colorama<br /> from colorama import init, Fore, Style<br /> from selenium import webdriver<br /> from selenium.common.exceptions import TimeoutException as TE<br /> from selenium.webdriver.support import expected_conditions as EC<br /> from selenium.webdriver.support.ui import WebDriverWait as WDW<br /> from selenium.webdriver.common.by import By<br /> from pyvirtualdisplay import Display<br /> from selenium.webdriver.common.action_chains import ActionChains<br /> import json<br /> import requests<br /> import pprint<br /> import time<br /> from selenium.webdriver.common.proxy import Proxy, ProxyType<br /> from selenium.webdriver.common.action_chains import ActionChains<br /> from selenium.webdriver.support.ui import WebDriverWait<br /> from selenium.webdriver.chrome.options import Options<br /> from selenium.webdriver.common.desired_capabilities import DesiredCapabilities<br /> from selenium.webdriver.common.keys import Keys<br /> from marionette_driver.marionette import Marionette<br /> # Python default import.<br /> import sys<br /> import os<br /> from apscheduler.schedulers.blocking import BlockingScheduler<br /> from selenium.webdriver.chrome.service import Service<br /><br /> """Colorama module constants."""<br /> init(convert=True) # Init colorama module.<br /> red = Fore.RED # Red color.<br /> green = Fore.GREEN # Green color.<br /> yellow = Fore.YELLOW # Yellow color.<br /> reset = Style.RESET_ALL # Reset color attribute.<br /><br /> cookiesliste = [<br /> {<br /> "domain": ".freebitco.in",<br /> "expirationDate": 1712436112,<br /> "hostOnly": False,<br /> "httpOnly": False,<br /> "name": "_ga",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": False,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "GA1.2.387161331.1649359492",<br /> "id": 1<br /> },<br /> {<br /> "domain": ".freebitco.in",<br /> "expirationDate": 1649364172,<br /> "hostOnly": False,<br /> "httpOnly": False,<br /> "name": "_gat_gtag_UA_44778688_1",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": False,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "1",<br /> "id": 2<br /> },<br /> {<br /> "domain": ".freebitco.in",<br /> "expirationDate": 1649450512,<br /> "hostOnly": False,<br /> "httpOnly": False,<br /> "name": "_gid",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": False,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "GA1.2.2076165761.1649359492",<br /> "id": 3<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "expirationDate": 1964724112,<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "btc_address",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": True,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "1NDtSTk9rKKH75Hxzre1TuLGELADGwnPpm",<br /> "id": 4<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "csrf_token",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": False,<br /> "session": True,<br /> "storeId": "0",<br /> "value": "bbG1fVIc2aW8",<br /> "id": 5<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "expirationDate": 1964724112,<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "fbtc_session",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": True,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "XdKhdNHhmmPC4Nn9rJrCQ719",<br /> "id": 6<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "expirationDate": 1964724112,<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "fbtc_userid",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": True,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "49255588",<br /> "id": 7<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "expirationDate": 1964724112,<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "have_account",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": True,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "1",<br /> "id": 8<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "expirationDate": 1649533408,<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "hide_push_msg",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": True,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "1",<br /> "id": 9<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "expirationDate": 1964720621,<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "last_play",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": True,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "1649360624",<br /> "id": 10<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "expirationDate": 1964724112,<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "login_auth",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": True,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "ZvqcmnICaqXeZSesY4J9w3Ak",<br /> "id": 11<br /> },<br /> {<br /> "domain": "freebitco.in",<br /> "expirationDate": 1964724112,<br /> "hostOnly": True,<br /> "httpOnly": False,<br /> "name": "password",<br /> "path": "/",<br /> "sameSite": "unspecified",<br /> "secure": True,<br /> "session": False,<br /> "storeId": "0",<br /> "value": "06536a3c8b1a918ebdae5191822d2156c7d921adde60438b7597c039ee629c31",<br /> "id": 12<br /> }<br /> ]<br /><br /> class hCaptcha:<br /> """Main class of the hCaptcha solver."""<br /><br /> def __init__(self) -> None:<br /> <br /><br /> """Set path of used file and start webdriver."""<br /> self.webdriver_path = '/usr/local/bin/chromedriver'<br /> self.extension_path = 'Tampermonkey.crx'<br /> self.driver = self.webdriver() # Start new webdriver.<br /> #options = webdriver.ChromeOptions() <br /> #options.add_experimental_option("excludeSwitches", ["enable-logging"])<br /> #self.driver = self.webdriver.chrome.webdriver.WebDriver(executable_path='assets/chromedriver.exe')<br /> #self.driver = self.webdriver.Chrome(options=options, executable_path=ChromeDriverManager().install())<br /><br /> def webdriver(self):<br /> """Start webdriver and return state of it."""<br /> PROXY = "46.4.73.88:2000" # IP:PORT or HOST:PORT<br /> <br /> <br /> #chrome = webdriver.Chrome(options=chrome_options)<br /> options = webdriver.ChromeOptions() # Configure options for Chrome.<br /> options.add_argument('--proxy-server=%s' % PROXY)<br /> options.add_argument("user-agent=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0")<br /> options.add_argument("--disable-blink-features=AutomationControlled")<br /> options.add_extension('/home/fretax003/freebitco/EditThisCookie.crx')<br /> options.add_extension(self.extension_path) # Add extension.<br /> options.add_argument("--lang=en-US") # Set webdriver language<br /> options.add_experimental_option( # to English. - 2 methods.<br /> 'prefs', {'intl.accept_languages': 'en,en_US'})<br /> # options.add_argument("headless") # Headless ChromeDriver.<br /> options.add_argument('log-level=3') # No logs is printed.<br /> options.add_argument('--mute-audio') # Audio is muted.<br /> options.add_argument("--enable-webgl-draft-extensions")<br /> options.add_argument("--ignore-gpu-blocklist")<br /> self.driver = webdriver.Chrome(self.webdriver_path, options=options)<br /> #driver.maximize_window() # Maximize window to reach all elements.<br /> return self.driver<br /><br /> def element_clickable(self, element: str) -> None:<br /> """Click on element if it's clickable using Selenium."""<br /> WDW(self.driver, 5).until(EC.element_to_be_clickable(<br /> (By.XPATH, element))).click()<br /><br /> def element_visible(self, element: str):<br /> """Check if element is visible using Selenium."""<br /> return WDW(self.driver, 20).until(EC.visibility_of_element_located(<br /> (By.XPATH, element)))<br /><br /> def window_handles(self, window_number: int) -> None:<br /> """Check for window handles and wait until a specific tab is opened."""<br /> WDW(self.driver, 30).until(lambda _: len(<br /> self.driver.window_handles) == window_number + 1)<br /> # Switch to asked tab.<br /> self.driver.switch_to.window(self.driver.window_handles[window_number])<br /><br /> def download_userscript(self) -> None:<br /> """Download the hCaptcha solver userscript."""<br /> try:<br /> print('Installing the hCaptcha solver userscript.', end=' ')<br /> self.window_handles(1) # Wait that Tampermonkey tab loads.<br /> self.driver.get('https://greasyfork.org/en/scripts/425854-hcaptcha'<br /> '-solver-automatically-solves-hcaptcha-in-browser')<br /> #self.driver.refresh()<br /> # Click on "Install" Greasy Fork button.<br /> self.element_clickable('//*[@id="install-area"]/a[1]')<br /> # Click on "Install" Tampermonkey button.<br /> self.window_handles(2) # Switch on Tampermonkey install tab.<br /> self.element_clickable('//*[@value="Install"]')<br /> self.window_handles(1) # Switch to Greasy Fork tab.<br /> self.driver.close() # Close this tab.<br /> self.window_handles(0) # Switch to main tab.<br /> print(f'{green}Installed.{reset}')<br /> except TE:<br /> sys.exit(f'{red}Failed.{reset}')<br /><br /> def demonstration(self) -> None:<br /> """Demonstration of the hCaptcha solver."""<br /> try:<br /> print('Solving hCaptcha.', end=' ')<br /> # hCaptcha solver URL test.<br /> self.driver.get(<br /> 'chrome-extension://fngmhnnpilhplaeedifhccceomclgfbg/popup.html?url=https://freebitco.in/?op=home&id=828&incognito=false')<br /> #self.driver.refresh()<br /> self.element_clickable('//*[@id="pasteButton"]')<br /> element = self.element_visible('//*[@id="pasteCookie"]/div/div/textarea')<br /> sorted_string = json.dumps(cookiesliste, indent=4, sort_keys=True)<br /> element.send_keys(sorted_string)<br /> self.element_clickable('//*[@id="submitButton"]')<br /> self.driver.get('https://freebitco.in/signup/?op=s')<br /> self.driver.refresh()<br /> self.element_clickable('//*[@id="push_notification_modal"]/div[1]/div[2]/div/div[1]')<br /> <br /> # Check if lenght of "data-hcaptcha-response" attribute is not<br /> # null. If it's not null, hCaptcha is solved.<br /> WDW(self.driver, 96600).until(lambda _: len(self.element_visible(<br /> '//div[@class="h-captcha"]/iframe').get_attribute(<br /> 'data-hcaptcha-response')) > 0)<br /> print(f'{green}Solved.{reset}', <br /> self.element_clickable('//*[@id="free_play_form_button"]'))<br /> except TE:<br /> print(f'{red}Failed.{reset}')<br /><br /><br /> def cls() -> None:<br /> """Clear console function."""<br /> # Clear console for Windows using 'cls' and Linux & Mac using 'clear'.<br /> os.system('cls' if os.name == 'nt' else 'clear')<br /><br /><br /> if __name__ == '__main__':<br /><br /> cls() # Clear console.<br /><br /> print(f'{green}Made by Maxime. '<br /> f'\n@Github: https://github.com/maximedrn{reset}')<br /><br /> hcaptcha = hCaptcha() # Init hCaptcha class.<br /> hcaptcha.download_userscript() # Download the hCaptcha solver userscript.<br /> hcaptcha.demonstration() # Demonstrate the hCaptcha solver.
Bonjour @SemD,
Pour lancer le script toutes les heures, il vous suffira d'utiliser les taches Cron linux. Pour cela, suivez ce guide:
https://www.digitalocean.com/community/tutorials/how-to-use-cron-to-automate-tasks-centos-8-fr
Concernant votre script, nous allons essayer de reproduire cela en interne sur une machine virtuelle. Dès que nous aurons plus d'informations à ce sujet, nous reviendrons vers vous.
Bien à vous.
merci
svp? JE recoit depuis quelque jour des message de mon cpanel, disant que ma rame est utilier et il n'est reste que 448 Mo
voici le message:
Journal de démarrage Pas de journal de démarrage
Informations sur la mémoire
Utilisé 1,31 Go
Disponible 448 Mo
installée 1,75 Go
je cherche à rendre disponible le reste qui es utiliser, comment je m'y prend concrètement?