QIN2DIM / epic-awesome-gamer

🍷 Gracefully claim weekly free games and monthly content from Epic Store.
https://echosec.notion.site/Epic-7c74f1e29117420dbac5551e4b031f82?pvs=4
GNU General Public License v3.0
891 stars 368 forks source link

使用docker部署提示缺少xvfb运行失败 #143

Closed CNorato closed 1 year ago

CNorato commented 1 year ago

使用docker-compose启动后日志报错ERROR - Please use `xvfb` to empower the headful Chrome. 以下是完整日志

2022-09-27 02:40:35 | DEBUG - Downloading objects.yaml from https://raw.githubusercontent.com/QIN2DIM/hcaptcha-challenger/main/src/objects.yaml
2022-09-27 02:40:36 | DEBUG - Pulling AssetsObject from https://api.github.com/repos/qin2dim/hcaptcha-challenger/releases
2022-09-27 02:40:37 | DEBUG - Downloading yolov6n.onnx from https://github.com/QIN2DIM/hcaptcha-challenger/releases/download/model/yolov6n.onnx
2022-09-27 02:40:50 | INFO - >> STARTUP [AwesomeScheduler] SynergyTunnel Pattern: True
2022-09-27 02:40:51 | SUCCESS - >> MATCH [__Context__] 🎮 启动挑战者上下文 - ctx_session=False
[WDM] - Downloading: 100%|██████████| 6.98M/6.98M [00:03<00:00, 1.97MB/s]
2022-09-27 02:40:56 | WARNING - CMD: Xvfb -ac >/dev/null 2>&1 & python3 main.py claim
2022-09-27 02:40:56 | WARNING - Please use `xvfb` to empower the headful Chrome.
2022-09-27 02:40:56 | ERROR - Please use `xvfb` to empower the headful Chrome.
Traceback (most recent call last):
  File "/home/epic/main.py", line 11, in <module>
    Fire(Scaffold)
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/epic/services/scaffold.py", line 156, in unreal
    Scaffold.claim(silence=silence, ignore=ignore, unreal=True)
  File "/home/epic/services/scaffold.py", line 151, in claim
    claimer.run(silence=silence, log_ignore=ignore, unreal=unreal)
  File "/home/epic/apis/scaffold/claimer.py", line 25, in run
    ClaimerScheduler(silence=silence, unreal=unreal).job_loop_claim(log_ignore)
  File "/home/epic/services/deploy.py", line 106, in job_loop_claim
    with UnrealClaimerInstance(self.silence, log_ignore=log_ignore) as claimer:
> File "/home/epic/services/deploy.py", line 162, in __enter__
    if _manager.refresh_ctx_cookies(keep_live=True, silence=self.silence):
  File "/home/epic/services/bricklayer/core.py", line 1278, in refresh_ctx_cookies
    ctx = ctx_session or get_challenge_ctx(silence=silence)
  File "/home/epic/services/utils/toolbox.py", line 231, in get_challenge_ctx
    assert not silence, "Please use `xvfb` to empower the headful Chrome."
AssertionError: Please use `xvfb` to empower the headful Chrome.
2022-09-27 02:40:56 | ERROR - >> Notify [UnrealClaimer] 推送运行日志 - active_pusher=['PUSHER_TELEGRAM'] err=Please use `xvfb` to empower the headful Chrome.
QIN2DIM commented 1 year ago

用的是最新镜像吗,这句log是我主动抛出的,意在提醒玩家要使用 headful 模式启动 browser。你的启动指令是什么,如果只有 claim 而不带参数,默认是 headful,如果加了 --silence 并且是 linux 则会主动抛出这个异常中断运行。

CNorato commented 1 year ago

用的是最新镜像,启动指令只有claim

# /home/epic/docker-compose.yaml
version: "3.7"
services:

  daily_claim:
    container_name: epic_claim
    image: ech0sec/awesome-epic:daddy
    command: [ "python3","main.py","claim" ]
    volumes:
      - "/home/epic/database:/home/epic/database"
    environment:
      EPΙC_EMAΙL: 
      EPΙC_PASSWΟRD: 
      PUSHER_TELEGRAM: 
      PLAYER: 

  daily_unreal:
    container_name: unreal_claim
    image: ech0sec/awesome-epic:daddy
    command: [ "python3","main.py","unreal" ]
    volumes:
      - "/home/epic/database:/home/epic/database"
    environment:
      EPΙC_EMAΙL: 
      EPΙC_PASSWΟRD: 
      PUSHER_TELEGRAM: 
      PLAYER: 
CNorato commented 1 year ago

上面的是unreal的日志 我一开始以为是同一个问题,再看了一下发现日志好像不太一样 下面这里才是的是claim的日志

2022-09-27 04:34:39 | DEBUG - Downloading objects.yaml from https://raw.githubusercontent.com/QIN2DIM/hcaptcha-challenger/main/src/objects.yaml
2022-09-27 04:34:39 | DEBUG - Pulling AssetsObject from https://api.github.com/repos/qin2dim/hcaptcha-challenger/releases
2022-09-27 04:34:40 | DEBUG - Downloading yolov6n.onnx from https://github.com/QIN2DIM/hcaptcha-challenger/releases/download/model/yolov6n.onnx
2022-09-27 04:34:58 | INFO - >> STARTUP [AwesomeScheduler] SynergyTunnel Pattern: True
2022-09-27 04:34:58 | SUCCESS - >> MATCH [__Context__] 🎮 启动挑战者上下文 - ctx_session=False
[WDM] - Downloading: 100%|██████████| 6.98M/6.98M [00:09<00:00, 783kB/s]
2022-09-27 04:35:08 | WARNING - CMD: Xvfb -ac >/dev/null 2>&1 & python3 main.py claim
2022-09-27 04:35:08 | WARNING - Please use `xvfb` to empower the headful Chrome.
2022-09-27 04:36:09 | ERROR - Message: unknown error: cannot connect to chrome at 127.0.0.1:44229
from chrome not reachable
Stacktrace:
#0 0x560d48671693 <unknown>
#1 0x560d4846a9db <unknown>
#2 0x560d4845a81e <unknown>
#3 0x560d48493677 <unknown>
#4 0x560d4848ae9f <unknown>
#5 0x560d484c6953 <unknown>
#6 0x560d484c0743 <unknown>
#7 0x560d48496533 <unknown>
#8 0x560d48497715 <unknown>
#9 0x560d486c17bd <unknown>
#10 0x560d486c4bf9 <unknown>
#11 0x560d486a6f2e <unknown>
#12 0x560d486c59b3 <unknown>
#13 0x560d4869ae4f <unknown>
#14 0x560d486e4ea8 <unknown>
#15 0x560d486e5052 <unknown>
#16 0x560d486ff71f <unknown>
#17 0x7fbe1f4e7ea7 <unknown>

Traceback (most recent call last):
  File "/home/epic/main.py", line 11, in <module>
    Fire(Scaffold)
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/epic/services/scaffold.py", line 151, in claim
    claimer.run(silence=silence, log_ignore=ignore, unreal=unreal)
  File "/home/epic/apis/scaffold/claimer.py", line 25, in run
    ClaimerScheduler(silence=silence, unreal=unreal).job_loop_claim(log_ignore)
  File "/home/epic/services/deploy.py", line 109, in job_loop_claim
    with GameClaimerInstance(self.silence, log_ignore=log_ignore) as claimer:
> File "/home/epic/services/deploy.py", line 162, in __enter__
    if _manager.refresh_ctx_cookies(keep_live=True, silence=self.silence):
  File "/home/epic/services/bricklayer/core.py", line 1278, in refresh_ctx_cookies
    ctx = ctx_session or get_challenge_ctx(silence=silence)
  File "/home/epic/services/utils/toolbox.py", line 234, in get_challenge_ctx
    return Challenger(options=options, driver_executable_path=driver_wrapper.path)
  File "/usr/local/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 401, in __init__
    super(Chrome, self).__init__(
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 270, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 589, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 363, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 428, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:44229
from chrome not reachable
Stacktrace:
#0 0x560d48671693 <unknown>
#1 0x560d4846a9db <unknown>
#2 0x560d4845a81e <unknown>
#3 0x560d48493677 <unknown>
#4 0x560d4848ae9f <unknown>
#5 0x560d484c6953 <unknown>
#6 0x560d484c0743 <unknown>
#7 0x560d48496533 <unknown>
#8 0x560d48497715 <unknown>
#9 0x560d486c17bd <unknown>
#10 0x560d486c4bf9 <unknown>
#11 0x560d486a6f2e <unknown>
#12 0x560d486c59b3 <unknown>
#13 0x560d4869ae4f <unknown>
#14 0x560d486e4ea8 <unknown>
#15 0x560d486e5052 <unknown>
#16 0x560d486ff71f <unknown>
#17 0x7fbe1f4e7ea7 <unknown>

2022-09-27 04:36:09 | ERROR - >> Notify [GameClaimer] 推送运行日志 - active_pusher=['PUSHER_TELEGRAM'] err=Message: unknown error: cannot connect to chrome at 127.0.0.1:44229
from chrome not reachable
Stacktrace:
#0 0x560d48671693 <unknown>
#1 0x560d4846a9db <unknown>
#2 0x560d4845a81e <unknown>
#3 0x560d48493677 <unknown>
#4 0x560d4848ae9f <unknown>
#5 0x560d484c6953 <unknown>
#6 0x560d484c0743 <unknown>
#7 0x560d48496533 <unknown>
#8 0x560d48497715 <unknown>
#9 0x560d486c17bd <unknown>
#10 0x560d486c4bf9 <unknown>
#11 0x560d486a6f2e <unknown>
#12 0x560d486c59b3 <unknown>
#13 0x560d4869ae4f <unknown>
#14 0x560d486e4ea8 <unknown>
#15 0x560d486e5052 <unknown>
#16 0x560d486ff71f <unknown>
#17 0x7fbe1f4e7ea7 <unknown>
QIN2DIM commented 1 year ago

对,这才是预期结果:)

在容器中启动 xvfb 还需要一些其他步骤,还未兼容。

unreal 接口还没测试。这些接口的可用性我会逐一排查。

CNorato commented 1 year ago

好的,麻烦作者了

QIN2DIM commented 1 year ago

(games-claimer)应该是没多大问题的,不需要更新镜像,直接修改配置文件即可

CNorato commented 1 year ago

(games-claimer)应该是没多大问题的,不需要更新镜像,直接修改配置文件即可

我按照教程中修改了我原来的docker-compose.yaml中的initcommand两个字段,然后启动报这两个错误

  1. [进程退出] 账号信息未配置或相关变量不合法

  2. xvfb-run: error: Xvfb failed to start

有时报第一个,有时报第二个。除了initcommand两个字段还有其他字段有更改吗?

下面是我当前的配置文件(environment中的变量都是有配置的)

# /home/epic/docker-compose.yaml
version: "3.7"
services:

  daily_claim:
    container_name: epic_claim
    init: true
    image: ech0sec/awesome-epic:daddy
    command: [ "xvfb-run","python3","main.py","claim" ]
    volumes:
      - "/home/epic/database:/home/epic/database"
    environment:
      EPΙC_EMAΙL:
      EPΙC_PASSWΟRD:
      PUSHER_TELEGRAM:
      PLAYER:

  daily_unreal:
    container_name: unreal_claim
    image: ech0sec/awesome-epic:daddy
    init: true
    command: [ "xvfb-run","python3","main.py","unreal" ]
    volumes:
      - "/home/epic/database:/home/epic/database"
    environment:
      EPΙC_EMAΙL:
      EPΙC_PASSWΟRD:
      PUSHER_TELEGRAM:
      PLAYER:
QIN2DIM commented 1 year ago

笑死,我把 EPIC_EMAIL 和 EPIC_PASSWORD 的指纹锁卸了。从配置文件重新复制进来吧,或者手敲这两个变量。

QIN2DIM commented 1 year ago
print("EPΙC_EMAΙL" == "EPIC_EMAIL") # False
CNorato commented 1 year ago

艹,可以了

QIN2DIM commented 1 year ago

学到了吗 (/▽\)

print("EPΙC_EMAΙL" == "EPIC_EMAIL") # False
CNorato commented 1 year ago

学到了(>▽<)

shadow6336 commented 1 year ago

学到了吗 (/▽\)

print("EPΙC_EMAΙL" == "EPIC_EMAIL") # False

我草,我说为啥Beyond Compare显示两个不一样!!!

QIN2DIM commented 1 year ago

我愿称之为海克斯科技,这种损招我也是在一些前沿的反爬虫服务里悟到的。