├── .github └── workflows │ └── build_xmrig.yml ├── .idea ├── .gitignore └── vcs.xml ├── LICENSE ├── README.md ├── README_CN.md ├── aminer.sh └── assets ├── miner.png └── screen.gif /.github/workflows/build_xmrig.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: Build XMRig 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the master branch 8 | schedule: 9 | - cron: "0 13 * * 1" 10 | 11 | # Allows you to run this workflow manually from the Actions tab 12 | workflow_dispatch: 13 | 14 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 15 | jobs: 16 | # This workflow contains a single job called "build" 17 | build: 18 | # The type of runner that the job will run on 19 | name: Build ${{ matrix.repo }} on ${{ matrix.platform }} 20 | runs-on: ubuntu-20.04 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | platform: ["linux/amd64", "linux/arm64", "linux/arm/v7"] 25 | repo: ["xmrig/xmrig", "C3Pool/xmrig-C3"] 26 | 27 | steps: 28 | - name: Checkout repo 29 | uses: actions/checkout@v2 30 | with: 31 | repository: ${{ matrix.repo }} 32 | 33 | - name: Set up QEMU 34 | id: qemu 35 | uses: docker/setup-qemu-action@v1 36 | 37 | - name: Run container 38 | run: | 39 | docker run --platform=${{ matrix.platform }} --name=builder -dit -v "$(pwd):/xmrig" alpine 40 | 41 | - name: Install dependent 42 | run: | 43 | docker exec builder /bin/sh -c " \ 44 | apk add git make cmake libstdc++ gcc g++ automake libtool autoconf linux-headers; \ 45 | " 46 | 47 | - name: Get information 48 | run: | 49 | echo "PLATFORM="`echo "${{ matrix.platform }}" | sed 's/\//_/g'` >> $GITHUB_ENV 50 | echo "PLATFORM="`echo "${{ matrix.platform }}" | sed 's/\//_/g'` 51 | echo "REPO="`echo "${{ matrix.repo }}" | sed 's/\//_/g'` >> $GITHUB_ENV 52 | echo "REPO="`echo "${{ matrix.repo }}" | sed 's/\//_/g'` 53 | echo "XMRIG_VERSION="`docker exec builder cat /xmrig/src/version.h | grep -Eo "APP_VERSION\s+\"(.+?)\"" | awk -F "\"" '{print $2}'` >> $GITHUB_ENV 54 | echo "XMRIG_VERSION="`docker exec builder cat /xmrig/src/version.h | grep -Eo "APP_VERSION\s+\"(.+?)\"" | awk -F "\"" '{print $2}'` 55 | 56 | - name: Build other 57 | if: ${{ matrix.platform != 'linux/arm64' && matrix.platform != 'linux/arm/v7' }} 58 | run: | 59 | docker exec builder /bin/sh -c " \ 60 | chmod -R 777 xmrig; \ 61 | mkdir xmrig/build; \ 62 | cd xmrig/scripts && ./build_deps.sh && cd ../build; \ 63 | cmake .. -DXMRIG_DEPS=scripts/deps -DBUILD_STATIC=ON; \ 64 | make -j1 65 | " 66 | 67 | - name: Build arm64 68 | if: matrix.platform == 'linux/arm64' 69 | run: | 70 | docker exec builder /bin/sh -c " \ 71 | chmod -R 777 xmrig; \ 72 | mkdir xmrig/build; \ 73 | cd xmrig/scripts && ./build_deps.sh && cd ../build; \ 74 | cmake .. -DXMRIG_DEPS=scripts/deps -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DARM_TARGET=8 -DWITH_OPENCL=OFF -DWITH_CUDA=OFF -DWITH_HWLOC=OFF; \ 75 | make -j1 76 | " 77 | 78 | - name: Build armv7 79 | if: matrix.platform == 'linux/arm/v7' 80 | run: | 81 | docker exec builder /bin/sh -c " \ 82 | chmod -R 777 xmrig; \ 83 | mkdir xmrig/build; \ 84 | cd xmrig/scripts && ./build_deps.sh && cd ../build; \ 85 | cmake .. -DXMRIG_DEPS=scripts/deps -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DARM_TARGET=7 -DWITH_OPENCL=OFF -DWITH_CUDA=OFF -DWITH_HWLOC=OFF; \ 86 | make -j1 87 | " 88 | 89 | - name: Copy to host 90 | run: | 91 | docker cp builder:/xmrig/build/xmrig xmrig 92 | 93 | - name: Upload artifact 94 | uses: actions/upload-artifact@v3 95 | with: 96 | name: ${{ env.REPO }}_${{ env.XMRIG_VERSION }}_${{ env.PLATFORM }} 97 | path: xmrig 98 | # - name: Checkout repo 99 | # uses: actions/checkout@v2 100 | # with: 101 | # repository: ${{ matrix.repo }} 102 | 103 | # - name: Echo XMRig version 104 | # run: | 105 | # echo "XMRIG_VERSION="`cat src/version.h | grep -Eo "APP_VERSION\s+\"(.+?)\"" | awk -F "\"" '{print $2}'` 106 | # echo "XMRIG_VERSION="`cat src/version.h | grep -Eo "APP_VERSION\s+\"(.+?)\"" | awk -F "\"" '{print $2}'` >> $GITHUB_ENV 107 | 108 | # - name: Setup environment 109 | # run: | 110 | # sudo apt update 111 | # sudo apt install build-essential cmake automake libtool autoconf 112 | 113 | # - name: Full static compile x86 114 | # if: matrix.arm_target == '0' 115 | # run: | 116 | # sudo su 117 | # mkdir build && cd scripts 118 | # ./build_deps.sh && cd ../build 119 | # cmake .. -DCMAKE_BUILD_TYPE=Release -DXMRIG_DEPS=scripts/deps 120 | # make -j$(nproc) 121 | 122 | # - name: Full static compile arm 123 | # if: matrix.arm_target != '0' 124 | # run: | 125 | # sudo su 126 | # mkdir build && cd scripts 127 | # ./build_deps.sh && cd ../build 128 | # cmake .. -DCMAKE_BUILD_TYPE=Release -DARM_TARGET=${{ matrix.arm_target }} -DWITH_OPENCL=OFF -DWITH_CUDA=OFF -DWITH_HWLOC=OFF -DWITH_ASM=OFF -DXMRIG_DEPS=scripts/deps 129 | # make -j$(nproc) 130 | 131 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /../../../../../../:\Users\zylnt\IdeaProjects\Aminer\.idea/dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021, Josh Zeng 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | Aminer 3 |

Aminer

4 | Mining with Android devices 5 |
6 | 7 |

8 | GitHub last commit 9 | visitor badge 10 | GitHub file size in bytes 11 | GitHub 12 |

13 | 14 |
Aminer is an open source script that makes it easy to deploy XMRig on Android devices to mine a variety of cryptocurrencies, mainly Monroe Coin.
15 | 16 | --- 17 | 18 | [简体中文版](/README_CN.md) 19 | 20 | --- 21 | 22 | ## Screenshots ✨ 23 | 24 |
25 | screen 26 |
27 | 28 | ## Earnings 💰 29 | 30 | **For reference only and represents only the situation at the time of publication** 31 | 32 | - Snapdragon 865 in c3-pool, converted hash speed is 1.5KH/s, gain is about ¥0.8 per 24h 33 | 34 | - Snapdragon 625 in c3-pool, converted hash rate is 1KH/s, gain is about ¥0.5 per 24h 35 | 36 | ## Compatibility 📱 37 | 38 | Theoretical support for 64-bit devices with Android 4.4+ (arm64, x86-x64) 39 | 40 | ✔️ **The following are the tested devices, welcome issue to add** 41 | 42 | - Redmi note 2 (Android 5.0/Termux 0.73) 43 | - Redmi 5 plus (Android 7.0/Termux 0.108) 44 | - Redmi k30 pro (Android 11/Termux 0.108) 45 | 46 | ## Quick Start 🚀 47 | 48 | ### Install Termux 49 | 50 | - For Android 7 and above devices, please install the latest version of Termux 51 | 52 | - For Android 6 and below, please install Termux version v0.73 53 | 54 | ### Installing and compiling software 55 | 56 | Run the script in Termux terminal 57 | 58 | ```bash 59 | bash <(curl -fsSL git.io/aminer) -u username 60 | ``` 61 | 62 | **For Android 6 and below devices you may also need to run** `pkg update -y && pkg install curl -y` 63 | 64 | Default is to use the c3-pool, donate 1% to XMRig software developers (not me), you can adjust it according to the instructions 65 | 66 | All required dependencies will be installed automatically, please make sure you have a good network connection, your confirmation may be required when installing some dependencies 67 | 68 | Installation takes about 20 minutes (depending on your network) 69 | 70 | Once the installation is complete, you will see the blue tips `##### Please restart Termux to run XMRIG #####` 71 | 72 | At this point, restart the Termux software to start mining automatically 73 | 74 | ## Usage ⌨️ 75 | 76 | ```bash 77 | bash <(curl -fsSL git.io/aminer) [options...] 78 | ``` 79 | 80 | - -y Auto mode, ignore risks warning 81 | - -u Pool's user, the arguments like `username` 82 | - -p Pool's password, the arguments like `password` 83 | - -o Pool's url, the arguments like `mine.pool.example:1234` 84 | - -d Donate level to XMRIG's developers (not me),the arguments like `1` 85 | - -g Setup sshd with Github name, the arguments like `githubUsername` 86 | 87 | ## Feature 👍 88 | 89 | - [x] daemon (automatic restart for unexpected exit) 90 | - [x] Autostart (open APP to start itself) 91 | - [ ] Boot self-start (no clue yet) 92 | 93 | 94 | 95 | - [x] Customize mining pool (not limited to c3-pool anymore) 96 | - [x] Auto-get device name (for Android, c3-pool) 97 | 98 | 99 | 100 | - [x] Ubuntu container domestic mirror (USTC source) 101 | - [ ] Termux software source domestic mirror (Tsinghua source does not seem to support older versions) 102 | - [ ] Ubuntu software source domestic mirror (lazy) 103 | 104 | 105 | 106 | - [x] One-click setup SSH server (use P3TERX's script) 107 | 108 | 109 | ## Thanks 💐 110 | 111 | The following items are referenced or cited: 112 | 113 | - [SSH Key Installer](https://github.com/P3TERX/SSH_Key_Installer) 114 | 115 | - [ubuntu-in-termux](https://github.com/MFDGaming/ubuntu-in-termux) 116 | 117 | 118 | 119 | --- 120 | 121 | 🏵 **Aminer** ©Josh Zeng. Released under the BSD-3-Clause License. 122 | 123 | Authored and maintained by Josh Zeng. 124 | 125 | [@Blog](https://linkyou.top/) · [@GitHub](https://github.com/cornjosh) -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 |
2 | Aminer 3 |

Aminer

4 | 使用 Android 设备来挖矿 5 |
6 | 7 |

8 | GitHub last commit 9 | visitor badge 10 | GitHub file size in bytes 11 | GitHub 12 |

13 | 14 |
Aminer 是一个开源脚本,可以方便的在 Android 设备上部署 XMRIG,用来挖取以 门罗币 为主的多种加密货币。
15 | 16 | --- 17 | 18 | [English Version](README.md) 19 | 20 | --- 21 | 22 | ## 演示 ✨ 23 | 24 |
25 | screen 26 |
27 | 28 | ## 收益 💰 29 | 30 | **仅供参考,仅代表发布时的情况** 31 | 32 | - 骁龙 865 在 c3-pool 中,换算哈希速度为 1.5KH/s,每 24h 收益约 ¥0.8 33 | 34 | - 骁龙 625 在 c3-pool 中,换算哈希速度为 1KH/s,每 24h 收益约 ¥0.5 35 | 36 | ## 兼容性 📱 37 | 38 | 理论支持 Android 4.4 + 的 64 位设备(arm64、x86 39 | -x64) 40 | 41 | ✔️ **以下为经过测试的设备,欢迎提 issue 添加** 42 | 43 | - Redmi note 2 (Android 5.0/Termux 0.73) 44 | - Redmi 5 plus (Android 7.0/Termux 0.108) 45 | - Redmi k30 pro (Android 11/Termux 0.108) 46 | 47 | ## 快速开始 🚀 48 | 49 | ### 安装 Termux 50 | 51 | - Android 7 及以上的设备请安装最新版本的 Termux 52 | 53 | - Android 6 及以下的设备请安装 v0.73 版本的 Termux 54 | 55 | ### 安装、编译软件 56 | 57 | 在 Termux 终端窗口中输入 58 | 59 | ```bash 60 | bash <(curl -fsSL git.io/aminer) -u username 61 | ``` 62 | 63 | **对于 Android 6 及以下的设备可能还需要先运行** `pkg update -y && pkg install curl -y` 64 | 65 | 默认使用 c3-pool 矿池, 捐赠 1% 给 XMRIG 软件开发者 ( 不是我 ), 可以参考使用说明进行调整 66 | 67 | 所有需要的依赖程序将会被自动安装,请确保网络畅通,在安装一些依赖时可能需要您的确认 68 | 69 | 安装需要约 20 分钟(取决于您的网络) 70 | 71 | 安装完成后,将会看到蓝色的 `##### Please restart Termux to run XMRIG #####` 72 | 73 | 此时重启 Termux 软件即可自动开始挖矿 74 | 75 | ## 使用 ⌨️ 76 | 77 | ```bash 78 | bash <(curl -fsSL git.io/aminer) [选项...] <参数> 79 | ``` 80 | 81 | - -y 自动模式, 跳过风险提示 82 | - -u 矿池的用户名, 参数如同 `username` 83 | - -p 矿池的密码, 参数如同 `password` 84 | - -o 矿池的 URL, 参数如同 `mine.pool.example:1234` 85 | - -d 捐赠给 XMRIG 开发者的算力百分比(不是给我的), 参数如同 `1` 86 | - -g 安装 SSH 服务并使用 Github 上的公钥, 参数如同 `githubUsername` 87 | 88 | ## 功能 👍 89 | 90 | - [x] 守护程序(意外退出自动重启) 91 | - [x] 自动启动(打开 APP 自启) 92 | - [ ] 开机自启(暂无头绪) 93 | 94 | 95 | 96 | - [x] 自定义矿池(不局限于猫池啦) 97 | - [x] 自动获取设备名(适用于 Android、猫池) 98 | 99 | 100 | 101 | - [x] Ubuntu 容器国内镜像(中科大源) 102 | - [ ] Termux 软件源国内镜像(清华源似乎不支持老版本) 103 | - [ ] Ubuntu 软件源国内镜像(懒得) 104 | 105 | 106 | 107 | - [x] 一键设置 SSH 服务器(调用大佬脚本) 108 | 109 | 110 | ## 致谢 💐 111 | 112 | 参考或引用了以下项目: 113 | 114 | - [SSH Key Installer](https://github.com/P3TERX/SSH_Key_Installer) 115 | 116 | - [ubuntu-in-termux](https://github.com/MFDGaming/ubuntu-in-termux) 117 | 118 | 119 | 120 | --- 121 | 122 | 🏵 **Aminer** ©Josh Zeng. Released under the BSD-3-Clause License. 123 | 124 | Authored and maintained by Josh Zeng. 125 | 126 | [@Blog](https://linkyou.top/) · [@GitHub](https://github.com/cornjosh) -------------------------------------------------------------------------------- /aminer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #============================================================= 3 | # https://github.com/cornjosh/Aminer 4 | # A script that help you install miner software XMRIG on Android device 5 | # Version: 1.0 6 | # Author: cornjosh 7 | # Blog: https://linkyou.top 8 | #============================================================= 9 | 10 | USER="12345" 11 | PASS='' 12 | MIMING_URL="mine.c3pool.com:13333" 13 | 14 | VERSION=1.0 15 | TOS='' 16 | UBUNTU_VERSION=20.04.1 17 | DONATE=1 18 | RED_FONT_PREFIX="\033[31m" 19 | LIGHT_GREEN_FONT_PREFIX="\033[1;32m" 20 | LIGHT_BLUE_FONT_PREFIX="\033[1;34m" 21 | FONT_COLOR_SUFFIX="\033[0m" 22 | 23 | 24 | INFO(){ 25 | echo -e "[${LIGHT_GREEN_FONT_PREFIX}INFO${FONT_COLOR_SUFFIX}] $1" 26 | } 27 | ERROR(){ 28 | echo -e "[${RED_FONT_PREFIX}ERROR${FONT_COLOR_SUFFIX}] $1" 29 | } 30 | HEAD(){ 31 | echo -e "${LIGHT_BLUE_FONT_PREFIX}##### $1 #####${FONT_COLOR_SUFFIX}" 32 | } 33 | 34 | 35 | HELLO(){ 36 | HEAD "Aminer" 37 | echo "Aminer is a script that help you install miner software XMRIG on Android device. @v$VERSION 38 | You can find the source code from https://github.com/cornjosh/Aminer 39 | " 40 | [ "$TOS" == '' ] && read -e -p "You are already understand the risks of the script.(Y/n)" TOS 41 | [ "$TOS" == 'n' ] || [ "$TOS" == 'N' ] && ERROR "Canceled by user" && exit 0 42 | } 43 | USAGE(){ 44 | echo "Aminer - A script that help you install miner software XMRIG on Android device @v$VERSION 45 | 46 | Usage: 47 | bash <(curl -fsSL git.io/aminer) [options...] 48 | Options: 49 | -y Auto mode, ignore risks warning 50 | -u Pool's user, the arguments like [username] 51 | -p Pool's password, the arguments like [password] 52 | -o Pool's url, the arguments like [mine.pool.example:1234] 53 | -d Donate level to XMRIG's developers (not me),the arguments like [1] 54 | -g Setup sshd with Github name, the arguments like [cornjosh]" 55 | 56 | # -o Overwrite mode, this option is valid at the top 57 | # -g Get the public key from GitHub, the arguments is the GitHub ID 58 | # -u Get the public key from the URL, the arguments is the URL 59 | # -f Get the public key from the local file, the arguments is the local file path 60 | # -p Change SSH port, the arguments is port number 61 | # -d Disable password login 62 | } 63 | 64 | GET_PASS(){ 65 | [ "$PASS" == '' ] && PASS="Aminer-$(getprop ro.product.vendor.model|sed s/[[:space:]]//g)" 66 | } 67 | 68 | 69 | UBUNTU(){ 70 | INFO "Upgrading packages" && pkg update && pkg upgrade -y 71 | INFO "Installing dependency" && pkg install wget proot -y 72 | cd "$HOME" || exit 73 | mkdir ubuntu-in-termux && INFO "Create $HOME/ubuntu-in-termux" 74 | UBUNTU_DOWNLOAD 75 | UBUNTU_INSTALL 76 | INFO "Ubuntu setup complete" 77 | } 78 | 79 | UBUNTU_DOWNLOAD(){ 80 | HEAD "Download Ubuntu" 81 | cd "$HOME/ubuntu-in-termux" || exit 82 | [ -f "ubuntu.tar.gz" ] && rm -rf ubuntu.tar.gz && INFO "Remove old ubuntu image" 83 | local ARCHITECTURE=$(dpkg --print-architecture) 84 | case "$ARCHITECTURE" in 85 | aarch64) 86 | ARCHITECTURE=arm64 87 | ;; 88 | arm) 89 | ARCHITECTURE=armhf 90 | ;; 91 | amd64|x86_64) 92 | ARCHITECTURE=amd64 93 | ;; 94 | *) 95 | ERROR "Unsupported architecture :- $ARCHITECTURE" && exit 1 96 | ;; 97 | esac 98 | INFO "Device architecture :- $ARCHITECTURE" 99 | INFO "Downloading Ubuntu image" 100 | wget https://mirrors.ustc.edu.cn/ubuntu-cdimage/ubuntu-base/releases/${UBUNTU_VERSION}/release/ubuntu-base-${UBUNTU_VERSION}-base-${ARCHITECTURE}.tar.gz -O ubuntu.tar.gz 101 | } 102 | 103 | UBUNTU_INSTALL(){ 104 | HEAD "Install Ubuntu" 105 | local directory=ubuntu-fs 106 | cd "$HOME/ubuntu-in-termux" || exit 107 | local cur=$(pwd) 108 | mkdir -p $directory && INFO "Create $HOME/ubuntu-in-termux/$directory" 109 | cd $directory || exit 110 | INFO "Decompressing the ubuntu rootfs" && tar -zxf "$cur/ubuntu.tar.gz" --exclude='dev' && INFO "The ubuntu rootfs have been successfully decompressed" 111 | printf "nameserver 8.8.8.8\nnameserver 8.8.4.4\n" > etc/resolv.conf && INFO "Fixing the resolv.conf" 112 | stubs=() 113 | stubs+=('usr/bin/groups') 114 | for f in "${stubs[@]}";do 115 | INFO "Writing stubs" 116 | echo -e "#!/bin/sh\nexit" > "$f" 117 | done 118 | INFO "Successfully wrote stubs" 119 | cd "$cur" || exit 120 | mkdir -p ubuntu-binds 121 | local bin=startubuntu.sh 122 | INFO "Creating the start script" 123 | cat > $bin <<- EOM 124 | #!/bin/bash 125 | cd \$(dirname \$0) 126 | ## unset LD_PRELOAD in case termux-exec is installed 127 | unset LD_PRELOAD 128 | command="proot" 129 | ## uncomment following line if you are having FATAL: kernel too old message. 130 | #command+=" -k 4.14.81" 131 | command+=" --link2symlink" 132 | command+=" -0" 133 | command+=" -r $directory" 134 | if [ -n "\$(ls -A ubuntu-binds)" ]; then 135 | for f in ubuntu-binds/* ;do 136 | . \$f 137 | done 138 | fi 139 | command+=" -b /dev" 140 | command+=" -b /proc" 141 | command+=" -b /sys" 142 | command+=" -b ubuntu-fs/tmp:/dev/shm" 143 | command+=" -b /data/data/com.termux" 144 | command+=" -b /:/host-rootfs" 145 | command+=" -b /sdcard" 146 | command+=" -b /storage" 147 | command+=" -b /mnt" 148 | command+=" -w /root" 149 | command+=" /usr/bin/env -i" 150 | command+=" HOME=/root" 151 | command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 152 | command+=" TERM=\$TERM" 153 | command+=" LANG=C.UTF-8" 154 | command+=" /bin/bash --login" 155 | com="\$@" 156 | if [ -z "\$1" ];then 157 | exec \$command 158 | else 159 | \$command -c "\$com" 160 | fi 161 | EOM 162 | termux-fix-shebang $bin 163 | chmod +x $bin 164 | rm ubuntu.tar.gz -rf && INFO "Delete Ubuntu image" 165 | INFO "Ubuntu $UBUNTU_VERSION install complete" 166 | } 167 | 168 | #install_ubuntu(){ 169 | # pkg update && pkg upgrade -y 170 | # pkg install wget proot -y 171 | # cd "$HOME" || exit 172 | # mkdir ubuntu-in-termux 173 | # cd ubuntu-in-termux || exit 174 | # install1 175 | # cd "$HOME" || exit 176 | #} 177 | # 178 | #install1 () { 179 | #time1="$( date +"%r" )" 180 | #directory=ubuntu-fs 181 | #UBUNTU_VERSION=20.04.1 182 | #if [ -d "$directory" ];then 183 | #first=1 184 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;227m[WARNING]:\e[0m \x1b[38;5;87m Skipping the download and the extraction\n" 185 | #elif [ -z "$(command -v proot)" ];then 186 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;203m[ERROR]:\e[0m \x1b[38;5;87m Please install proot.\n" 187 | #printf "\e[0m" 188 | #exit 1 189 | #elif [ -z "$(command -v wget)" ];then 190 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;203m[ERROR]:\e[0m \x1b[38;5;87m Please install wget.\n" 191 | #printf "\e[0m" 192 | #exit 1 193 | #fi 194 | #if [ "$first" != 1 ];then 195 | #if [ -f "ubuntu.tar.gz" ];then 196 | #rm -rf ubuntu.tar.gz 197 | #fi 198 | #if [ ! -f "ubuntu.tar.gz" ];then 199 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Downloading the ubuntu rootfs, please wait...\n" 200 | #ARCHITECTURE=$(dpkg --print-architecture) 201 | #case "$ARCHITECTURE" in 202 | #aarch64) ARCHITECTURE=arm64;; 203 | #arm) ARCHITECTURE=armhf;; 204 | #amd64|x86_64) ARCHITECTURE=amd64;; 205 | #*) 206 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;203m[ERROR]:\e[0m \x1b[38;5;87m Unknown architecture :- $ARCHITECTURE" 207 | #exit 1 208 | #;; 209 | # 210 | #esac 211 | # 212 | #wget https://mirrors.ustc.edu.cn/ubuntu-cdimage/ubuntu-base/releases/${UBUNTU_VERSION}/release/ubuntu-base-${UBUNTU_VERSION}-base-${ARCHITECTURE}.tar.gz -O ubuntu.tar.gz 213 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Download complete!\n" 214 | # 215 | #fi 216 | # 217 | #cur=`pwd` 218 | #mkdir -p $directory 219 | #cd $directory 220 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Decompressing the ubuntu rootfs, please wait...\n" 221 | #tar -zxf $cur/ubuntu.tar.gz --exclude='dev'||: 222 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m The ubuntu rootfs have been successfully decompressed!\n" 223 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Fixing the resolv.conf, so that you have access to the internet\n" 224 | #printf "nameserver 8.8.8.8\nnameserver 8.8.4.4\n" > etc/resolv.conf 225 | #stubs=() 226 | #stubs+=('usr/bin/groups') 227 | #for f in ${stubs[@]};do 228 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Writing stubs, please wait...\n" 229 | #echo -e "#!/bin/sh\nexit" > "$f" 230 | #done 231 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Successfully wrote stubs!\n" 232 | #cd $cur 233 | # 234 | #fi 235 | # 236 | #mkdir -p ubuntu-binds 237 | #bin=startubuntu.sh 238 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Creating the start script, please wait...\n" 239 | #cat > $bin <<- EOM 240 | ##!/bin/bash 241 | #cd \$(dirname \$0) 242 | ### unset LD_PRELOAD in case termux-exec is installed 243 | #unset LD_PRELOAD 244 | #command="proot" 245 | ### uncomment following line if you are having FATAL: kernel too old message. 246 | ##command+=" -k 4.14.81" 247 | #command+=" --link2symlink" 248 | #command+=" -0" 249 | #command+=" -r $directory" 250 | #if [ -n "\$(ls -A ubuntu-binds)" ]; then 251 | # for f in ubuntu-binds/* ;do 252 | # . \$f 253 | # done 254 | #fi 255 | #command+=" -b /dev" 256 | #command+=" -b /proc" 257 | #command+=" -b /sys" 258 | #command+=" -b ubuntu-fs/tmp:/dev/shm" 259 | #command+=" -b /data/data/com.termux" 260 | #command+=" -b /:/host-rootfs" 261 | #command+=" -b /sdcard" 262 | #command+=" -b /storage" 263 | #command+=" -b /mnt" 264 | #command+=" -w /root" 265 | #command+=" /usr/bin/env -i" 266 | #command+=" HOME=/root" 267 | #command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 268 | #command+=" TERM=\$TERM" 269 | #command+=" LANG=C.UTF-8" 270 | #command+=" /bin/bash --login" 271 | #com="\$@" 272 | #if [ -z "\$1" ];then 273 | # exec \$command 274 | #else 275 | # \$command -c "\$com" 276 | #fi 277 | #EOM 278 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m The start script has been successfully created!\n" 279 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Fixing shebang of startubuntu.sh, please wait...\n" 280 | #termux-fix-shebang $bin 281 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Successfully fixed shebang of startubuntu.sh! \n" 282 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Making startubuntu.sh executable please wait...\n" 283 | #chmod +x $bin 284 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Successfully made startubuntu.sh executable\n" 285 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Cleaning up please wait...\n" 286 | #rm ubuntu.tar.gz -rf 287 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m Successfully cleaned up!\n" 288 | #printf "\x1b[38;5;214m[${time1}]\e[0m \x1b[38;5;83m[Installer thread/INFO]:\e[0m \x1b[38;5;87m The installation has been completed! You can now launch Ubuntu with ./startubuntu.sh\n" 289 | #printf "\e[0m" 290 | # 291 | #} 292 | 293 | UBUNTU_START(){ 294 | INFO "Start up Ubuntu..." && bash "$HOME/ubuntu-in-termux/startubuntu.sh" 295 | } 296 | 297 | TERMUX_BASHRC(){ 298 | INFO "Setting termux's .bashrc" 299 | echo "bash $HOME/ubuntu-in-termux/startubuntu.sh" >> "$HOME/.bashrc" 300 | } 301 | 302 | UBUNTU_INSTALL_BASHRC(){ 303 | INFO "Setting Ubuntu's .bashrc and install.sh" 304 | local bin="$HOME/ubuntu-in-termux/ubuntu-fs/root/install.sh" 305 | cat > "$bin" <<- EOM 306 | #!/bin/bash 307 | RED_FONT_PREFIX="\033[31m" 308 | BLUE_FONT_PREFIX="\033[34m" 309 | LIGHT_GREEN_FONT_PREFIX="\033[1;32m" 310 | LIGHT_BLUE_FONT_PREFIX="\033[1;34m" 311 | FONT_COLOR_SUFFIX="\033[0m" 312 | INFO(){ 313 | echo -e "[\${LIGHT_GREEN_FONT_PREFIX}INFO\${FONT_COLOR_SUFFIX}]\$1" 314 | } 315 | ERROR(){ 316 | echo -e "[\${RED_FONT_PREFIX}ERROR\${FONT_COLOR_SUFFIX}]\$1" 317 | } 318 | HEAD(){ 319 | echo -e "\${LIGHT_BLUE_FONT_PREFIX}##### \$1 #####\${FONT_COLOR_SUFFIX}" 320 | } 321 | 322 | HEAD "Upgrading packages" 323 | apt-get update && apt-get upgrade -y 324 | HEAD "Installing dependency" 325 | apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev -y 326 | INFO "Getting xmrig source code" 327 | git clone https://github.com/C3Pool/xmrig-C3.git 328 | INFO "Changing donate level to $DONATE %" 329 | sed -i 's/kDefaultDonateLevel = 1/kDefaultDonateLevel = $DONATE/g' ./xmrig-C3/src/donate.h 330 | sed -i 's/kMinimumDonateLevel = 1/kMinimumDonateLevel = $DONATE/g' ./xmrig-C3/src/donate.h 331 | mkdir xmrig-C3/build && cd xmrig-C3/build && cmake .. && make -j\$(nproc) && mv xmrig \$HOME && cd \$HOME && rm -rf xmrig-C3 332 | INFO "XMRIG create success" 333 | HEAD "Please restart Termux App to run XMRIG" 334 | EOM 335 | echo "[ ! -e ./xmrig ] && bash ./install.sh" >> "$HOME/ubuntu-in-termux/ubuntu-fs/root/.bashrc" 336 | } 337 | 338 | 339 | UBUNTU_SERVICE_BASHRC(){ 340 | INFO "Setting Ubuntu's .bashrc and service.sh" 341 | local bin="$HOME/ubuntu-in-termux/ubuntu-fs/root/service.sh" 342 | cat > "$bin" <<- EOM 343 | #!/bin/bash 344 | RED_FONT_PREFIX="\033[31m" 345 | BLUE_FONT_PREFIX="\033[34m" 346 | LIGHT_GREEN_FONT_PREFIX="\033[1;32m" 347 | LIGHT_BLUE_FONT_PREFIX="\033[1;34m" 348 | FONT_COLOR_SUFFIX="\033[0m" 349 | INFO(){ 350 | echo -e "[\${LIGHT_GREEN_FONT_PREFIX}INFO\${FONT_COLOR_SUFFIX}]\$1" 351 | } 352 | ERROR(){ 353 | echo -e "[\${RED_FONT_PREFIX}ERROR\${FONT_COLOR_SUFFIX}]\$1" 354 | } 355 | HEAD(){ 356 | echo -e "\${LIGHT_BLUE_FONT_PREFIX}##### \$1 #####\${FONT_COLOR_SUFFIX}" 357 | } 358 | 359 | 360 | HEAD "Aminer is starting" 361 | cd "\$HOME" 362 | INFO "Killing other Aminer" 363 | ps -ef|grep service.sh|grep -v grep|grep -v \$\$|cut -c 9-15|xargs kill -s 9 364 | ps -ef|grep xmrig|grep -v grep|cut -c 9-15|xargs kill -s 9 365 | 366 | while true 367 | do 368 | PID_COUNT=\$(ps aux|grep ./xmrig |grep -v grep|wc -l) 369 | if [ \$PID_COUNT -eq 0 ] 370 | then 371 | [ ! -e ./xmrig ] && ERROR "XMRIG is not found, exiting" && exit 1 372 | INFO "XMRIG doesn't running, restarting..." && ./xmrig --randomx-mode=light --no-huge-pages -u $USER -p $PASS -o $MIMING_URL 373 | fi 374 | sleep 15 375 | done 376 | 377 | EOM 378 | 379 | echo "bash ./service.sh" >> "$HOME/ubuntu-in-termux/ubuntu-fs/root/.bashrc" 380 | } 381 | 382 | 383 | SSH_INSTALL(){ 384 | HEAD "Install and setup SSH" 385 | INFO "Installing dependency" && pkg update && pkg install openssh -y 386 | INFO "Running SSH_Key_Installer" && bash <(curl -fsSL git.io/key.sh) -g "$1" 387 | INFO "Setting termux's .bashrc" && echo "sshd" >> "$HOME/.bashrc" 388 | INFO "Starting sshd..." && sshd 389 | HEAD "Finish" 390 | local IP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d '/') 391 | INFO "SSH server running at: $IP:8022" 392 | INFO "Login with any username and your private key" 393 | } 394 | 395 | 396 | while getopts "yu:p:o:d:g:" OPT; do 397 | case $OPT in 398 | y) 399 | TOS="y" 400 | ;; 401 | u) 402 | USER=$OPTARG 403 | ;; 404 | p) 405 | PASS=$OPTARG 406 | ;; 407 | o) 408 | MIMING_URL=$OPTARG 409 | ;; 410 | d) 411 | DONATE=$OPTARG 412 | ;; 413 | g) 414 | GITHUB_USER=$OPTARG 415 | HELLO 416 | SSH_INSTALL "$GITHUB_USER" 417 | exit 0 418 | ;; 419 | *) 420 | USAGE 421 | exit 1 422 | ;; 423 | esac 424 | done 425 | 426 | HELLO 427 | GET_PASS 428 | [ ! -e "$HOME/ubuntu-in-termux/ubuntu-fs/root/service.sh" ] && UBUNTU && TERMUX_BASHRC && UBUNTU_SERVICE_BASHRC && UBUNTU_INSTALL_BASHRC 429 | UBUNTU_START 430 | -------------------------------------------------------------------------------- /assets/miner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornjosh/Aminer/3d598789c093b6481738424b52c1d58878b28006/assets/miner.png -------------------------------------------------------------------------------- /assets/screen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cornjosh/Aminer/3d598789c093b6481738424b52c1d58878b28006/assets/screen.gif --------------------------------------------------------------------------------