├── .github └── workflows │ └── ci.yaml ├── .gitignore ├── Dockerfile ├── README.md ├── cleanup.sh ├── docker-compose.web.yaml ├── docker-compose.yaml ├── entrypoint.sh ├── profiles ├── comwechat │ ├── QQ_War.keyword_reply │ │ └── config.yaml │ ├── QQ_War.message_merge │ │ └── config.yaml │ ├── blueset.telegram │ │ └── config.yaml │ ├── catbaron.mp_instantview │ │ └── config.yaml │ ├── config.yaml │ ├── honus.comwechat │ │ └── config.yaml │ └── jiz4oh.keyword_replace │ │ └── config.yaml ├── comwechat2 │ ├── QQ_War.keyword_reply │ │ └── config.yaml │ ├── QQ_War.message_merge │ │ └── config.yaml │ ├── blueset.telegram │ │ └── config.yaml │ ├── catbaron.mp_instantview │ │ └── config.yaml │ ├── config.yaml │ ├── honus.comwechat │ │ └── config.yaml │ └── jiz4oh.keyword_replace │ │ └── config.yaml └── default │ ├── blueset.telegram │ └── config.yaml │ ├── blueset.wechat │ └── config.yaml │ └── config.yaml └── run2.py /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - master 8 | tags: [ 'v*.*.*' ] 9 | 10 | jobs: 11 | deploy: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | with: 16 | submodules: true 17 | fetch-depth: 0 18 | 19 | # https://github.com/actions/checkout/issues/290#issuecomment-680260080 20 | - name: Extract Docker Info 21 | id: docker 22 | run: | 23 | git fetch --tags --force # Retrieve annotated tags. THIS TRICK REALLY HELPS 24 | # https://github.com/community/community/discussions/4924 25 | # git release do not create annotated tags, so we need use --tags 26 | tag=$(git describe --always --tags --abbrev=8 HEAD) 27 | version=$tag 28 | echo "version=$version" >> $GITHUB_ENV 29 | 30 | - name: Login to ghcr.io 31 | uses: docker/login-action@v3 32 | with: 33 | registry: ghcr.io 34 | username: ${{ github.repository_owner }} 35 | password: ${{ secrets.GITHUB_TOKEN }} 36 | 37 | - name: Set up QEMU 38 | uses: docker/setup-qemu-action@v3 39 | 40 | - name: Set up Docker Buildx 41 | uses: docker/setup-buildx-action@v3 42 | 43 | - name: Build and push Docker 44 | uses: docker/build-push-action@v6 45 | with: 46 | cache-from: | 47 | type=gha 48 | type=gha,stage=builder 49 | cache-to: | 50 | type=gha,mode=max,stage=builder 51 | type=gha,mode=max 52 | file: 'Dockerfile' 53 | platforms: linux/amd64,linux/arm64 54 | context: ./ 55 | push: true 56 | tags: | 57 | ghcr.io/jiz4oh/efb:latest 58 | ghcr.io/jiz4oh/efb:${{ env.version }} 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | tgdata.db* 2 | WeChat/ 3 | /comwechat/ 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Stage 1: Builder stage - Install build dependencies and Python packages 2 | FROM python:3.11-alpine AS builder 3 | 4 | ENV LANG C.UTF-8 5 | ENV TZ 'Asia/Shanghai' 6 | 7 | # Install build-time dependencies for apk packages and pip packages 8 | RUN set -ex; \ 9 | apk add --no-cache --update \ 10 | python3-dev \ 11 | py3-pillow \ 12 | py3-ruamel.yaml \ 13 | git \ 14 | gcc \ 15 | musl-dev \ 16 | zlib-dev \ 17 | jpeg-dev \ 18 | libffi-dev \ 19 | openssl-dev \ 20 | libwebp-dev \ 21 | zbar-dev; 22 | # Install python packages using pip with --no-cache-dir 23 | RUN pip3 install --no-cache-dir urllib3==1.26.15; \ 24 | # Install/reinstall rich and Pillow from pip (as per original Dockerfile intent) 25 | # Note: Pillow might be installed via apk (py3-pillow) and pip, pip version will likely take precedence. 26 | pip3 install --no-cache-dir --no-deps --force-reinstall rich Pillow; \ 27 | # Install TgCrypto, ignoring any pre-installed PyYAML 28 | pip3 install --no-cache-dir --ignore-installed PyYAML TgCrypto; 29 | 30 | # Install other Python dependencies from git and PyPI 31 | RUN pip3 install --no-cache-dir ehforwarderbot python-telegram-bot pyqrcode; \ 32 | pip3 install --no-cache-dir git+https://github.com/jiz4oh/efb-mp-instantview-middleware.git@e7772cc2c5acc5b776f4bc0bc7562ea5b893eab9; \ 33 | pip3 install --no-cache-dir git+https://github.com/jiz4oh/efb-keyword-replace.git@ede3f2ede8092017d7005f9b2150d6325076c852; \ 34 | pip3 install --no-cache-dir git+https://github.com/jiz4oh/efb-telegram-master.git@4e808681fa6e9148058918acee9b12b4fe228131; \ 35 | pip3 install --no-cache-dir git+https://github.com/0honus0/python-comwechatrobot-http.git@50e509f4ec3e11df7e4e5ab252a26ffef9a4470a; \ 36 | pip3 install --no-cache-dir git+https://github.com/jiz4oh/efb-wechat-comwechat-slave.git@87c07fe9e9cf55b3ecbe04381c2a5c05fde12d3c; \ 37 | pip3 install --no-cache-dir git+https://github.com/QQ-War/efb-keyword-reply.git@c7dfef513e85d6647ad78c70b4e3353ab8804977; \ 38 | pip3 install --no-cache-dir git+https://github.com/QQ-War/efb_message_merge.git@946837e5508bf9325060f15f2a725525baf368ff; 39 | 40 | # Stage 2: Final stage - Install only runtime dependencies and copy artifacts 41 | FROM python:3.11-alpine 42 | 43 | ENV LANG C.UTF-8 44 | ENV TZ 'Asia/Shanghai' 45 | ENV EFB_DATA_PATH /data/ 46 | ENV EFB_PARAMS "" 47 | ENV EFB_PROFILE "default" 48 | ENV HTTPS_PROXY "" 49 | 50 | # Set timezone 51 | RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ 52 | && echo "Asia/Shanghai" > /etc/timezone; 53 | 54 | # Install runtime C-library dependencies including cron and necessary libs for python packages 55 | RUN set -ex; \ 56 | apk add --no-cache --update \ 57 | libmagic \ 58 | ffmpeg \ 59 | zlib \ 60 | jpeg \ 61 | libffi \ 62 | py3-pillow \ 63 | zbar \ 64 | openssl \ 65 | libwebp \ 66 | cronie \ 67 | py3-ruamel.yaml; \ 68 | # Clean up apk cache 69 | rm -rf /var/cache/apk/*; 70 | 71 | # Explicitly tell the dynamic linker where to find shared libraries like libzbar.so 72 | ENV LD_LIBRARY_PATH="/usr/lib:${LD_LIBRARY_PATH}" 73 | 74 | # Copy installed python packages from builder stage's site-packages 75 | COPY --from=builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/ 76 | # Copy executables installed by pip packages 77 | COPY --from=builder /usr/local/bin/ehforwarderbot /usr/local/bin/ehforwarderbot 78 | 79 | # Patch pyzbar to directly load the library from the known path in Alpine 80 | # This avoids issues with find_library in minimal environments 81 | RUN sed -i "s|path = find_library('zbar')|path = '/usr/lib/libzbar.so.0' # find_library('zbar')|" \ 82 | /usr/local/lib/python3.11/site-packages/pyzbar/zbar_library.py 83 | 84 | # Copy entrypoint script and make it executable 85 | COPY entrypoint.sh /entrypoint.sh 86 | RUN chmod +x /entrypoint.sh 87 | 88 | ENTRYPOINT ["/entrypoint.sh"] 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ehforwarderbot 2 | 3 | 参见 https://jiz4oh.com/2023/01/run-efb-in-docker 4 | -------------------------------------------------------------------------------- /cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 查找当前目录下修改时间超过1天的文件(不包括目录)并删除 4 | # -maxdepth 1: 只查找当前目录,不递归子目录 5 | # -type f: 只查找文件 6 | # -mtime +0: 查找修改时间在24小时之前的文件 (0表示整天,+0表示超过1天) 7 | # -delete: 删除找到的文件 8 | 9 | find /comwechat/Files/wxid_* -maxdepth 1 -type f -mtime +0 -delete 10 | find /comwechat/Files/wxid_*/FileStorage/Cache -type f -mtime +0 -delete 11 | find /comwechat/Files/wxid_*/FileStorage/Sns/Cache -type f -mtime +0 -delete 12 | -------------------------------------------------------------------------------- /docker-compose.web.yaml: -------------------------------------------------------------------------------- 1 | version: "3.3" 2 | 3 | services: 4 | efb: 5 | image: ghcr.io/jiz4oh/efb:v1.0 6 | container_name: efb 7 | network_mode: host 8 | volumes: 9 | - .:/data 10 | restart: unless-stopped 11 | logging: 12 | driver: json-file 13 | options: 14 | max-size: 1m 15 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3.3" 2 | 3 | services: 4 | efb: 5 | image: ghcr.io/jiz4oh/efb 6 | volumes: 7 | - .:/data 8 | - "./comwechat/Files/:/comwechat/Files/" 9 | - "./cleanup.sh:/etc/periodic/daily/cleanup.sh" 10 | restart: unless-stopped 11 | network_mode: "service:comwechat" 12 | environment: 13 | - EFB_PROFILE=comwechat 14 | logging: 15 | driver: json-file 16 | options: 17 | max-size: 1m 18 | 19 | comwechat: 20 | environment: 21 | - VNCPASS=jiz4oh 22 | - COMWECHAT=https://github.com/ljc545w/ComWeChatRobot/releases/download/3.7.0.30-0.1.0-pre/3.7.0.30-0.1.0-pre.zip 23 | volumes: 24 | - "./comwechat/Files/:/home/user/.wine/drive_c/users/user/My Documents/WeChat Files/" 25 | # - "./comwechat/Data/:/home/user/.wine/drive_c/users/user/Application Data/" 26 | - ./run2.py:/run2.py 27 | command: /run2.py 28 | privileged: true 29 | network_mode: bridge 30 | restart: unless-stopped 31 | image: tomsnow1999/docker-com_wechat_robot:latest 32 | 33 | efb2: 34 | image: ghcr.io/jiz4oh/efb 35 | volumes: 36 | - .:/data 37 | - "./comwechat/efb2/Files/:/comwechat/Files/" 38 | - "./cleanup.sh:/etc/periodic/daily/cleanup.sh" 39 | restart: unless-stopped 40 | network_mode: "service:comwechat2" 41 | environment: 42 | - EFB_PROFILE=comwechat2 43 | logging: 44 | driver: json-file 45 | options: 46 | max-size: 1m 47 | 48 | comwechat2: 49 | environment: 50 | - VNCPASS=jiz4oh 51 | - COMWECHAT=https://github.com/ljc545w/ComWeChatRobot/releases/download/3.7.0.30-0.1.0-pre/3.7.0.30-0.1.0-pre.zip 52 | volumes: 53 | - "./comwechat/efb2/Files/:/home/user/.wine/drive_c/users/user/My Documents/WeChat Files/" 54 | # - "./comwechat/Data/:/home/user/.wine/drive_c/users/user/Application Data/" 55 | - ./run2.py:/run2.py 56 | command: /run2.py 57 | privileged: true 58 | network_mode: bridge 59 | restart: unless-stopped 60 | image: tomsnow1999/docker-com_wechat_robot:latest 61 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 启动 crond 服务 4 | crond 5 | 6 | PARAMS= 7 | 8 | if [ -n "$EFB_PROFILE" ]; then 9 | PARAMS="$PARAMS -p $EFB_PROFILE" 10 | fi 11 | 12 | PARAMS="$PARAMS $EFB_PARAMS" 13 | 14 | eval "ehforwarderbot $PARAMS" 15 | -------------------------------------------------------------------------------- /profiles/comwechat/QQ_War.keyword_reply/config.yaml: -------------------------------------------------------------------------------- 1 | # https://github.com/QQ-War/efb-keyword-reply 2 | keywords: 3 | 关键字1: 回复词1 4 | -------------------------------------------------------------------------------- /profiles/comwechat/QQ_War.message_merge/config.yaml: -------------------------------------------------------------------------------- 1 | # https://github.com/QQ-War/efb_message_merge 2 | mastersendback: False 3 | 4 | messagekeeptime: 120 5 | #此处单位是分钟,不配置的话,默认时间5分钟。 6 | 7 | samemessagegroup: 8 | - "收到/取消 群语音邀请" 9 | - "收到" 10 | samemessageprivate: 11 | - "语音/视频聊天\n - - - - - - - - - - - - - - - \n不支持的消息类型, 请在微信端查看" 12 | 13 | comwechatretrive: True 14 | #此处为True是处理,主要针对comwechat端,其他端可以改成False。 15 | -------------------------------------------------------------------------------- /profiles/comwechat/blueset.telegram/config.yaml: -------------------------------------------------------------------------------- 1 | token: "机器人的 TOKEN" # 必须修改,可参考 https://winamp.eu.org/266.html 2 | admins: 3 | - 你自己的 Userid # 必须修改,可参考 https://winamp.eu.org/266.html 4 | flags: # 可选 flag,详见 https://github.com/ehForwarderBot/efb-telegram-master?tab=readme-ov-file#experimental-flags 5 | retry_on_error: true 6 | # 关闭自动语言设置,使用 systemd 启动时默认中文 7 | auto_locale: false 8 | animated_stickers: true 9 | # topic_group: -100xxxxxx # 开启 topic_group 所用,参考 https://www.jiz4oh.com/2025/04/set-topic-in-efb 10 | -------------------------------------------------------------------------------- /profiles/comwechat/catbaron.mp_instantview/config.yaml: -------------------------------------------------------------------------------- 1 | # Token of telegraph 2 | telegraph_token: 必填 # 参考 https://telegra.ph/api#createAccount 3 | 4 | # Optional. Proxy url. 5 | # Example: 6 | # proxy_url: socks5://:@: 7 | # proxy_url: socks5://: 8 | # proxy_url: http://: 9 | # proxy_url: PROXY_URL 10 | -------------------------------------------------------------------------------- /profiles/comwechat/config.yaml: -------------------------------------------------------------------------------- 1 | master_channel: "blueset.telegram" 2 | slave_channels: 3 | - "honus.comwechat" 4 | middlewares: 5 | - QQ_War.keyword_reply 6 | - QQ_War.message_merge 7 | - jiz4oh.keyword_replace 8 | # - catbaron.mp_instantview 9 | -------------------------------------------------------------------------------- /profiles/comwechat/honus.comwechat/config.yaml: -------------------------------------------------------------------------------- 1 | dir: "/comwechat/Files/" 2 | qrcode_timeout: 10 3 | -------------------------------------------------------------------------------- /profiles/comwechat/jiz4oh.keyword_replace/config.yaml: -------------------------------------------------------------------------------- 1 | keywords: 2 | https://x.com: https://fxtwitter.com 3 | https://twitter.com: https://fxtwitter.com 4 | https://instagram.com: https://ddinstagram.com 5 | -------------------------------------------------------------------------------- /profiles/comwechat2/QQ_War.keyword_reply/config.yaml: -------------------------------------------------------------------------------- 1 | # https://github.com/QQ-War/efb-keyword-reply 2 | keywords: 3 | 关键字1: 回复词1 4 | -------------------------------------------------------------------------------- /profiles/comwechat2/QQ_War.message_merge/config.yaml: -------------------------------------------------------------------------------- 1 | # https://github.com/QQ-War/efb_message_merge 2 | mastersendback: False 3 | 4 | messagekeeptime: 120 5 | #此处单位是分钟,不配置的话,默认时间5分钟。 6 | 7 | samemessagegroup: 8 | - "收到/取消 群语音邀请" 9 | - "收到" 10 | samemessageprivate: 11 | - "语音/视频聊天\n - - - - - - - - - - - - - - - \n不支持的消息类型, 请在微信端查看" 12 | 13 | comwechatretrive: True 14 | #此处为True是处理,主要针对comwechat端,其他端可以改成False。 15 | -------------------------------------------------------------------------------- /profiles/comwechat2/blueset.telegram/config.yaml: -------------------------------------------------------------------------------- 1 | token: "机器人的 TOKEN" # 必须修改,可参考 https://winamp.eu.org/266.html 2 | admins: 3 | - 你自己的 Userid # 必须修改,可参考 https://winamp.eu.org/266.html 4 | flags: # 可选 flag,详见 https://github.com/ehForwarderBot/efb-telegram-master?tab=readme-ov-file#experimental-flags 5 | retry_on_error: true 6 | # 关闭自动语言设置,使用 systemd 启动时默认中文 7 | auto_locale: false 8 | animated_stickers: true 9 | # topic_group: -100xxxxxx # 开启 topic_group 所用,参考 https://www.jiz4oh.com/2025/04/set-topic-in-efb 10 | -------------------------------------------------------------------------------- /profiles/comwechat2/catbaron.mp_instantview/config.yaml: -------------------------------------------------------------------------------- 1 | # Token of telegraph 2 | telegraph_token: 必填 # 参考 https://telegra.ph/api#createAccount 3 | 4 | # Optional. Proxy url. 5 | # Example: 6 | # proxy_url: socks5://:@: 7 | # proxy_url: socks5://: 8 | # proxy_url: http://: 9 | # proxy_url: PROXY_URL 10 | -------------------------------------------------------------------------------- /profiles/comwechat2/config.yaml: -------------------------------------------------------------------------------- 1 | master_channel: "blueset.telegram" 2 | slave_channels: 3 | - "honus.comwechat" 4 | middlewares: 5 | - QQ_War.keyword_reply 6 | - QQ_War.message_merge 7 | - jiz4oh.keyword_replace 8 | # - catbaron.mp_instantview 9 | -------------------------------------------------------------------------------- /profiles/comwechat2/honus.comwechat/config.yaml: -------------------------------------------------------------------------------- 1 | dir: "/comwechat/Files/" 2 | qrcode_timeout: 10 3 | -------------------------------------------------------------------------------- /profiles/comwechat2/jiz4oh.keyword_replace/config.yaml: -------------------------------------------------------------------------------- 1 | keywords: 2 | https://x.com: https://fxtwitter.com 3 | https://twitter.com: https://fxtwitter.com 4 | https://instagram.com: https://ddinstagram.com 5 | -------------------------------------------------------------------------------- /profiles/default/blueset.telegram/config.yaml: -------------------------------------------------------------------------------- 1 | token: "机器人的 TOKEN" 2 | admins: 3 | - 你自己的 Userid 4 | flags: 5 | # 关闭自动语言设置,使用 systemd 启动时默认中文 6 | auto_locale: false 7 | animated_stickers: true 8 | -------------------------------------------------------------------------------- /profiles/default/blueset.wechat/config.yaml: -------------------------------------------------------------------------------- 1 | flags: 2 | # tg 端编辑消息时以撤回并重新发送的方式发送到微信 3 | delete_on_edit: true 4 | # 每当请求会话列表时,强制刷新会话列表 5 | refresh_friends: true 6 | # 使用 iTerm2 图像协议 显示二维码。本功能只适用于 iTerm2 用户 7 | # imgcat_qr: true 8 | # 在收到第三方合作应用分享给微信的链接时,其附带的预览图将缩略图上传到 sm.ms 9 | app_shared_link_mode: upload 10 | -------------------------------------------------------------------------------- /profiles/default/config.yaml: -------------------------------------------------------------------------------- 1 | master_channel: "blueset.telegram" 2 | slave_channels: 3 | - "blueset.wechat" 4 | -------------------------------------------------------------------------------- /run2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | import subprocess, os, signal, datetime, time, json, sys 3 | 4 | version = os.environ.get('COMWECHAT_VERSION', '3.9.12.16') 5 | 6 | class DockerWechatHook: 7 | def __init__(self): 8 | signal.signal(signal.SIGINT, self.now_exit) 9 | signal.signal(signal.SIGHUP, self.now_exit) 10 | signal.signal(signal.SIGTERM, self.now_exit) 11 | 12 | def now_exit(self, signum, frame): 13 | self.exit_container() 14 | 15 | def prepare(self): 16 | # if not os.path.exists("/comwechat/http/SWeChatRobot.dll"): 17 | if not os.path.exists("/dll_downloaded.txt"): 18 | COMWECHAT = os.environ['COMWECHAT'] 19 | # NOTE: 当 ComWeChatRobot 的仓库地址变动的话需要修改 20 | if not COMWECHAT.startswith("https://github.com/ljc545w/ComWeChatRobot/releases/download/"): 21 | print("你提供的地址不是 COMWECHAT 仓库的 Release 下载地址,程序将自动退出!", flush=True) 22 | self.exit_container() 23 | self.prepare = subprocess.run(['wget', COMWECHAT, '-O', 'comwechat.zip']) 24 | self.prepare = subprocess.run(['unzip', '-d', 'comwechat', 'comwechat.zip']) 25 | self.prepare = subprocess.run(['mv', '/WeChatHook.exe', '/comwechat/http/WeChatHook.exe']) 26 | with open("/dll_downloaded.txt", "w") as f: 27 | f.write("True\n") 28 | 29 | def run_vnc(self): 30 | # 根据 VNCPASS 环境变量生成 vncpasswd 文件 31 | os.makedirs('/root/.vnc', mode=755, exist_ok=True) 32 | passwd_output = subprocess.run(['/usr/bin/vncpasswd','-f'],input=os.environ['VNCPASS'].encode(),capture_output=True) 33 | with open('/root/.vnc/passwd', 'wb') as f: 34 | f.write(passwd_output.stdout) 35 | os.chmod('/root/.vnc/passwd', 0o700) 36 | self.vnc = subprocess.Popen(['/usr/bin/vncserver','-localhost', 37 | 'no', '-xstartup', '/usr/bin/openbox' ,':5']) 38 | 39 | def run_wechat(self): 40 | # if not os.path.exists("/wechat_installed.txt"): 41 | # self.wechat = subprocess.run(['wine','WeChatSetup.exe']) 42 | # with open("/wechat_installed.txt", "w") as f: 43 | # f.write("True\n") 44 | # self.wechat = subprocess.run(['wine', 'explorer.exe']) 45 | self.wechat = subprocess.Popen(['wine','/home/user/.wine/drive_c/Program Files/Tencent/WeChat/WeChat.exe']) 46 | # self.wechat = subprocess.run(['wine','/home/user/.wine/drive_c/Program Files/Tencent/WeChat/WeChat.exe']) 47 | 48 | def run_hook(self): 49 | print("等待 5 秒再 hook", flush=True) 50 | time.sleep(5) 51 | self.reg_hook = subprocess.Popen(['wine','/comwechat/http/WeChatHook.exe']) 52 | # self.reg_hook = subprocess.run(['wine', 'explorer.exe']) 53 | 54 | def change_version(self): 55 | time.sleep(5) 56 | result = subprocess.run(['curl', '-X', 'POST', 'http://127.0.0.1:18888/api/?type=35', '-H', 'Content-Type: application/json', '-d', json.dumps({"path": "/comwechat/http/WeChatHook.exe", "version": version})], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 57 | if result.returncode != 0: 58 | print(f"Curl command failed with error: {result.stderr.decode()}", flush=True) 59 | print("版本修改失败", flush=True) 60 | self.exit_container() 61 | sys.exit(1) 62 | else: 63 | print("版本已经修改", flush=True) 64 | 65 | def exit_container(self): 66 | print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 正在退出容器...', flush=True) 67 | try: 68 | print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 退出微信...', flush=True) 69 | os.kill(self.wechat.pid, signal.SIGTERM) 70 | except: 71 | pass 72 | try: 73 | print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 退出Hook程序...', flush=True) 74 | os.kill(self.reg_hook.pid, signal.SIGTERM) 75 | except: 76 | pass 77 | try: 78 | print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 退出VNC...', flush=True) 79 | os.kill(self.vnc.pid, signal.SIGTERM) 80 | except: 81 | pass 82 | 83 | def run_all_in_one(self): 84 | print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 启动容器中...', flush=True) 85 | self.prepare() 86 | self.run_vnc() 87 | self.run_wechat() 88 | self.run_hook() 89 | self.change_version() 90 | while True: 91 | time.sleep(1) 92 | print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 感谢使用.', flush=True) 93 | 94 | 95 | if __name__ == '__main__' : 96 | print('---All in one 微信 ComRobot 容器---', flush=True) 97 | hook = DockerWechatHook() 98 | hook.run_all_in_one() 99 | --------------------------------------------------------------------------------