├── .github └── workflows │ ├── build-v2ray.yml │ ├── build-xray-min.yml │ ├── build-xray.yml │ ├── build_MeIsReallyBa_kernal4.4_padavan.yml │ ├── build_asuswrt_modx.yml │ ├── build_hanwckf_kernal3.x_padavan.yml │ ├── build_hanwckf_kernal4.4_padavan.yml │ ├── build_padavan_toolchain.yml │ ├── build_plan_b.yml │ ├── build_tsl0922_kernal4.4_padavan.yml │ ├── build_vb1980_kernal4.4_padavan.yml │ ├── build_vb1980_kernal4.4_padavan_multi_targets.yml │ └── delete_legacy_workflow_runs.yml ├── README.md ├── a040wq └── bell_asus_logo.png ├── bashScripts ├── asuswrt_build.sh ├── setaccount.sh ├── setlanip.sh └── setwifi.sh ├── e8820s └── zte_asus_logo.png ├── formlogin ├── Login.asp ├── Logout.asp ├── favicon.png ├── httpd.c └── login.css ├── msg1500 └── raisecom_asus_logo.png └── toolchain ├── mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz ├── mipsel-linux-uclibc-gcc10.tar.xz └── mipsel-linux-uclibc.tar.xz /.github/workflows/build-v2ray.yml: -------------------------------------------------------------------------------- 1 | name: Build v2ray 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | uploadanon: 7 | type: boolean 8 | description: 'whether to upload to anonfiles' 9 | default: 'false' 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | env: 14 | v2raydir: ./v2ray 15 | if: github.event.repository.owner.id == github.event.sender.id 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: actions/setup-go@v5 20 | with: 21 | go-version: '1.21' 22 | check-latest: true 23 | cache-dependency-path: '**/go.sum' 24 | 25 | - name: Initialization environment 26 | run: | 27 | sudo apt-get update 28 | sudo apt install bzip2 make curl upx -y 29 | 30 | - name: Build v2ray 31 | run: | 32 | cp -f ${{env.v2raydir}}/v2ray_Makefile ./Makefile 33 | sudo chmod +x ./Makefile 34 | make 35 | 36 | - name: Upx v2ray 37 | run: | 38 | cd ./bin 39 | upx -9 v2ray 40 | shopt -s extglob 41 | rm -vrf !("v2ray") 42 | echo "v2ray=$(pwd)" >> $GITHUB_ENV 43 | echo "STATUS=success" >> $GITHUB_ENV 44 | 45 | - name : Upload packages 46 | uses: actions/upload-artifact@main 47 | if: env.STATUS == 'success' 48 | with: 49 | name: v2ray-packages 50 | path: ${{ env.v2ray }} 51 | 52 | - name: Upload v2ray bin to anonfiles 53 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 54 | run: | 55 | curl -fsSL git.io/file-transfer | sh 56 | ./transfer anon --no-progress ${v2ray} 2>&1 | tee anonfile.log 57 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 58 | 59 | - name: Remove obsolete v2ray(s) on artifacts 60 | uses: Bonnie2980/gha-remove-artifacts@master 61 | if: env.STATUS == 'success' 62 | with: 63 | age: '1 day' 64 | skip-recent: 5 -------------------------------------------------------------------------------- /.github/workflows/build-xray-min.yml: -------------------------------------------------------------------------------- 1 | name: Build Xray Min 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | uploadanon: 7 | type: boolean 8 | description: 'whether to upload to anonfiles' 9 | default: 'false' 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | if: github.event.repository.owner.id == github.event.sender.id 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: actions/setup-go@v5 18 | with: 19 | go-version: '1.21' 20 | check-latest: true 21 | cache-dependency-path: '**/go.sum' 22 | 23 | - name: Initialization environment 24 | run: | 25 | sudo apt-get update 26 | sudo apt install upx git -y 27 | 28 | - name: Clone&Build source code 29 | id: build 30 | run: | 31 | git clone --depth=1 https://github.com/wangz-code/xray-core-min xray-core 32 | cd xray-core 33 | mkdir -p xraybin 34 | GOOS=linux GOARCH=mipsle go build -o ./xraybin/xray -trimpath -ldflags "-s -w -buildid=" ./main.go 35 | cd ./xraybin 36 | upx -9 xray 37 | shopt -s extglob 38 | rm -vrf !("xray") 39 | echo "xray=$PWD" >> $GITHUB_ENV 40 | echo "STATUS=success" >> $GITHUB_ENV 41 | 42 | - name : Upload packages 43 | uses: actions/upload-artifact@main 44 | if: env.STATUS == 'success' 45 | with: 46 | name: xray-packages 47 | path: ${{ env.xray }} 48 | 49 | - name: Upload xray bin to anonfiles 50 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 51 | run: | 52 | curl -fsSL git.io/file-transfer | sh 53 | ./transfer anon --no-progress ${v2ray} 2>&1 | tee anonfile.log 54 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 55 | 56 | - name: Remove obsolete xray(s) on artifacts 57 | uses: Bonnie2980/gha-remove-artifacts@master 58 | if: env.STATUS == 'success' 59 | with: 60 | age: '1 day' 61 | skip-recent: 5 62 | -------------------------------------------------------------------------------- /.github/workflows/build-xray.yml: -------------------------------------------------------------------------------- 1 | name: Build Xray 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | uploadanon: 7 | type: boolean 8 | description: 'whether to upload to anonfiles' 9 | default: 'false' 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | if: github.event.repository.owner.id == github.event.sender.id 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: actions/setup-go@v5 18 | with: 19 | go-version: '1.22.0' 20 | check-latest: true 21 | cache-dependency-path: '**/go.sum' 22 | 23 | - name: Initialization environment 24 | run: | 25 | sudo apt-get update 26 | sudo apt install upx git -y 27 | 28 | - name: Clone&Build source code 29 | id: build 30 | run: | 31 | git clone --depth=1 https://github.com/xtls/xray-core.git xray-core 32 | cd xray-core/main 33 | GOOS=linux GOARCH=mipsle go build -o ../../xraybin/xray -trimpath -ldflags "-s -w -buildid=" ./ 34 | cd ../../xraybin 35 | #upx -9 xray 36 | shopt -s extglob 37 | rm -vrf !("xray") 38 | echo "xray=$PWD" >> $GITHUB_ENV 39 | echo "STATUS=success" >> $GITHUB_ENV 40 | 41 | - name : Upload packages 42 | uses: actions/upload-artifact@main 43 | if: env.STATUS == 'success' 44 | with: 45 | name: xray-packages 46 | path: ${{ env.xray }} 47 | 48 | - name: Upload xray bin to anonfiles 49 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 50 | run: | 51 | curl -fsSL git.io/file-transfer | sh 52 | ./transfer anon --no-progress ${v2ray} 2>&1 | tee anonfile.log 53 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 54 | 55 | - name: Remove obsolete xray(s) on artifacts 56 | uses: Bonnie2980/gha-remove-artifacts@master 57 | if: env.STATUS == 'success' 58 | with: 59 | age: '1 day' 60 | skip-recent: 5 61 | -------------------------------------------------------------------------------- /.github/workflows/build_MeIsReallyBa_kernal4.4_padavan.yml: -------------------------------------------------------------------------------- 1 | name: Build MeIsReallyBa's Kernal4.4 Padavan 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | target: 7 | type: choice 8 | description: 'target to compile' 9 | options: 10 | - Gee_B70 11 | - Nokia-Sbell_A-040W-Q 12 | - Xiaomi_CR6606 13 | - Xiaomi_CR6608 14 | - Xiaomi_CR6609 15 | - DLINK_DIR-878 16 | - DLINK_DIR-882 17 | - JCG_836PRO 18 | - JCG_AC860M 19 | - JCQ_Q20 20 | - JCQ_Q10Pro 21 | - JCG_Y2 22 | - Phicomm_K2P 23 | - Phicomm_K2P-USB 24 | - Xiaomi_4 25 | - Xiaomi_R3G 26 | - Xiaomi_R3P-PB 27 | - Xiaomi_R3P 28 | - Motorola_MR2600 29 | - Raisecom_MSG1500_X.00 30 | - Lenovo_NEWIFI2 31 | - Xiaomi_AC2100 32 | - JDCloud_Luban 33 | - JDCloud_1 34 | - Redmi_AC2100 35 | - Asus_RT-AC85P 36 | - Youhua_WR1200JS 37 | - Youhua_WR330 38 | - Xiaoyu_C1 39 | - Xiaoyu_C3 40 | - Xiaoyu_C5 41 | - ZTE_E8820S 42 | plugins: 43 | description: 'json format string of include configs' 44 | required: true 45 | default: '{"vpnsvr":"n","vpncli":"n","vpncmd":"n","ss":"y","v2ray":"n","xray":"y","trojan":"n","ssobfs":"n","dnsforwarder":"n","adbyby":"n","adguardhome":"n","smartdns":"n","aliddns":"n","zerotier":"n","ddnsto":"n","wireguard":"n","aldrive":"n","sqm":"y","mentohust":"n","scutclient":"n","njitclient":"n","minieap":"n","dogcom":"n"}' 46 | firmwarever: 47 | description: 'firmware''s version' 48 | required: true 49 | default: '20220218' 50 | uploadanon: 51 | type: boolean 52 | description: 'upload firmware to anonfiles' 53 | default: 'false' 54 | env: 55 | REPOSITORY_URL: https://github.com/MeIsReallyBa/padavan-4.4.git 56 | TOOLCHAIN_URL: https://github.com/hanwckf/padavan-toolchain/releases/download/linux-4.4-v1.0/mipsel-linux-uclibc.tar.xz 57 | WORK_PATH: /opt/padavan-4.4 58 | TIME_ZONE: Asia/Shanghai 59 | FIRMWARE_DATEPREFIX: $(date +"%Y%m%d") 60 | FIRMWARE_AUTHOR: MeIsReallyBa 61 | FIRMWARE_PATH: /opt/firmwares 62 | jobs: 63 | build: 64 | runs-on: ubuntu-20.04 65 | if: github.event.repository.owner.id == github.event.sender.id 66 | 67 | steps: 68 | - uses: actions/checkout@v4 69 | - uses: Bonnie2980/variable-mapper@master 70 | id: export 71 | with: 72 | key: "${{ github.event.inputs.target }}" 73 | map: | 74 | { 75 | "Gee_B70": { 76 | "model": "B70" 77 | }, 78 | "Nokia-Sbell_A-040W-Q": { 79 | "model": "BELL-A040WQ" 80 | }, 81 | "Xiaomi_CR6606": { 82 | "model": "CR660x" 83 | }, 84 | "Xiaomi_CR6608": { 85 | "model": "CR660x" 86 | }, 87 | "Xiaomi_CR6609": { 88 | "model": "CR660x" 89 | }, 90 | "DLINK_DIR-878": { 91 | "model": "DIR-878" 92 | }, 93 | "DLINK_DIR-882": { 94 | "model": "DIR-882" 95 | }, 96 | "JCG_836PRO": { 97 | "model": "JCG-836PRO" 98 | }, 99 | "JCG_AC860M": { 100 | "model": "JCG-AC860M" 101 | }, 102 | "JCQ_Q20": { 103 | "model": "JCG-Q20" 104 | }, 105 | "JCQ_Q10Pro": { 106 | "model": "JCG-Q20" 107 | }, 108 | "JCG_Y2": { 109 | "model": "JCG-Y2" 110 | }, 111 | "Phicomm_K2P": { 112 | "model": "K2P" 113 | }, 114 | "Phicomm_K2P-USB": { 115 | "model": "K2P-USB" 116 | }, 117 | "Xiaomi_4": { 118 | "model": "MI-4" 119 | }, 120 | "Xiaomi_R3G": { 121 | "model": "MI-R3G" 122 | }, 123 | "Xiaomi_R3P-PB": { 124 | "model": "MI-R3P-PB" 125 | }, 126 | "Xiaomi_R3P": { 127 | "model": "MI-R3P" 128 | }, 129 | "Motorola_MR2600": { 130 | "model": "MR2600" 131 | }, 132 | "Raisecom_MSG1500_X.00": { 133 | "model": "MSG1500" 134 | }, 135 | "Lenovo_NEWIFI2": { 136 | "model": "NEWIFI" 137 | }, 138 | "Xiaomi_AC2100": { 139 | "model": "R2100" 140 | }, 141 | "JDCloud_Luban": { 142 | "model": "RE-CP-02" 143 | }, 144 | "JDCloud_1": { 145 | "model": "RE-SP-01B" 146 | }, 147 | "Redmi_AC2100": { 148 | "model": "RM2100" 149 | }, 150 | "Asus_RT-AC85P": { 151 | "model": "RT-AC85P" 152 | }, 153 | "Youhua_WR1200JS": { 154 | "model": "WR1200JS" 155 | }, 156 | "Youhua_WR330": { 157 | "model": "WR330" 158 | }, 159 | "Xiaoyu_C1": { 160 | "model": "XY-C1" 161 | }, 162 | "Xiaoyu_C3": { 163 | "model": "XY-C1" 164 | }, 165 | "Xiaoyu_C5": { 166 | "model": "XY-C1" 167 | }, 168 | "ZTE_E8820S": { 169 | "model": "ZTE-E8820S" 170 | }, 171 | ".*": { 172 | "model": "K2P" 173 | } 174 | } 175 | export_to: env 176 | mode: first_match 177 | - name: Initialization environment 178 | env: 179 | DEBIAN_FRONTEND: noninteractive 180 | run: | 181 | sudo apt-get update 182 | sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \ 183 | fakeroot kmod cpio git python3-docutils gettext automake autopoint \ 184 | texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \ 185 | libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin 186 | sudo timedatectl set-timezone "$TIME_ZONE" 187 | - name: Clone source code 188 | run: | 189 | git clone --depth=1 $REPOSITORY_URL $WORK_PATH 190 | cd $WORK_PATH/toolchain-mipsel 191 | mkdir -p toolchain-4.4.x 192 | wget $TOOLCHAIN_URL 193 | tar -xf mipsel-linux-uclibc.tar.xz -C toolchain-4.4.x 194 | - name: Parse json string of include plugins 195 | run: | 196 | echo "vpnsvr=${{fromJson(github.event.inputs.plugins).vpnsvr}}" >> $GITHUB_ENV 197 | echo "vpncli=${{fromJson(github.event.inputs.plugins).vpncli}}" >> $GITHUB_ENV 198 | echo "vpncmd=${{fromJson(github.event.inputs.plugins).vpncmd}}" >> $GITHUB_ENV 199 | echo "ss=${{fromJson(github.event.inputs.plugins).ss}}" >> $GITHUB_ENV 200 | echo "v2ray=${{fromJson(github.event.inputs.plugins).v2ray}}" >> $GITHUB_ENV 201 | echo "xray=${{fromJson(github.event.inputs.plugins).xray}}" >> $GITHUB_ENV 202 | echo "trojan=${{fromJson(github.event.inputs.plugins).trojan}}" >> $GITHUB_ENV 203 | echo "ssobfs=${{fromJson(github.event.inputs.plugins).ssobfs}}" >> $GITHUB_ENV 204 | echo "dnsforwarder=${{fromJson(github.event.inputs.plugins).dnsforwarder}}" >> $GITHUB_ENV 205 | echo "adbyby=${{fromJson(github.event.inputs.plugins).adbyby}}" >> $GITHUB_ENV 206 | echo "adguardhome=${{fromJson(github.event.inputs.plugins).adguardhome}}" >> $GITHUB_ENV 207 | echo "smartdns=${{fromJson(github.event.inputs.plugins).smartdns}}" >> $GITHUB_ENV 208 | echo "aliddns=${{fromJson(github.event.inputs.plugins).aliddns}}" >> $GITHUB_ENV 209 | echo "zerotier=${{fromJson(github.event.inputs.plugins).zerotier}}" >> $GITHUB_ENV 210 | echo "ddnsto=${{fromJson(github.event.inputs.plugins).ddnsto}}" >> $GITHUB_ENV 211 | echo "wireguard=${{fromJson(github.event.inputs.plugins).wireguard}}" >> $GITHUB_ENV 212 | echo "aldrive=${{fromJson(github.event.inputs.plugins).aldrive}}" >> $GITHUB_ENV 213 | echo "sqm=${{fromJson(github.event.inputs.plugins).sqm}}" >> $GITHUB_ENV 214 | echo "mentohust=${{fromJson(github.event.inputs.plugins).mentohust}}" >> $GITHUB_ENV 215 | echo "scutclient=${{fromJson(github.event.inputs.plugins).scutclient}}" >> $GITHUB_ENV 216 | echo "njitclient=${{fromJson(github.event.inputs.plugins).njitclient}}" >> $GITHUB_ENV 217 | echo "minieap=${{fromJson(github.event.inputs.plugins).minieap}}" >> $GITHUB_ENV 218 | echo "dogcom=${{fromJson(github.event.inputs.plugins).dogcom}}" >> $GITHUB_ENV 219 | - name: Custom config 220 | run: | 221 | cd $WORK_PATH/trunk 222 | if [ ! -f configs/templates/${{ env.model }}.config ] ; then 223 | echo "configs/templates/${{ env.model }}.config not found" 224 | exit 1 225 | fi 226 | cp -f configs/templates/${{ env.model }}.config .config 227 | ################################################################################################ 228 | #因不同型号配置功能不一样,所以先把配置项删除,如果你自己要添加其他的,也要写上删除这一条,切记!!! 229 | ################################################################################################ 230 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER/d' .config #删除配置项SOFTETHERVPN 231 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT/d' .config #删除配置项SOFTETHERVPN 232 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD/d' .config #删除配置项SOFTETHERVPN 233 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS/d' .config #删除配置项SS plus+ 234 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SSSERVER/d' .config #删除配置项SS server 235 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER/d' .config #删除配置项DNSFORWARDER 236 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ADBYBY/d' .config #删除配置项adbyby plus+ 237 | sed -i '/CONFIG_FIRMWARE_INCLUDE_TUNSAFE/d' .config #删除配置项tunsafe 238 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ALIDDNS/d' .config #删除配置项阿里DDNS 239 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' .config #删除配置项srelay 240 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME/d' .config #删除配置项adguardhome 241 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ZEROTIER/d' .config #删除配置项zerotier 242 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNSTO/d' .config #删除配置项ddnsto 243 | sed -i '/CONFIG_FIRMWARE_INCLUDE_WIREGUARD/d' .config #删除配置项wireguard 244 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ALDRIVER/d' .config #删除配置项阿里云盘 245 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SMARTDNS/d' .config #删除配置项smartdns 246 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SQM/d' .config #删除配置项sqm 247 | #校园网相关开始 248 | sed -i '/CONFIG_FIRMWARE_INCLUDE_MENTOHUST/d' .config #删除配置项MENTOHUST 249 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT/d' .config #删除配置项SCUTCLIENT 250 | sed -i '/CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT/d' .config 251 | sed -i '/CONFIG_FIRMWARE_INCLUDE_MINIEAP/d' .config 252 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DOGCOM/d' .config 253 | #校园网相关结束 254 | sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' .config 255 | ###################################################################### 256 | #以下选项是定义你需要的功能(y=集成,n=忽略),重新写入到.config文件 257 | ###################################################################### 258 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER=${{env.vpnsvr}}" >> .config #SOFTETHERVPN 259 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT=${{env.vpncli}}" >> .config #SOFTETHERVPN 260 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD=${{env.vpncmd}}" >> .config #SOFTETHERVPN 261 | #科学相关 262 | echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=${{env.ss}}" >> .config #SS plus+ 263 | echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=${{env.v2ray}}" >> .config #集成v2ray执行文件(3.8M左右) 264 | echo "CONFIG_FIRMWARE_INCLUDE_XRAY=${{env.xray}}" >> .config #集成xray执行文件(5.6M左右),可以代替v2ray,注:如果闪存太小不够还是建议使用v2ray 265 | echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=${{env.trojan}}" >> .config #集成trojan执行文件(1.1M左右) 266 | echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=${{env.ssobfs}}" >> .config # simple-obfs混淆插件 267 | echo "CONFIG_FIRMWARE_INCLUDE_SSSERVER=n" >> .config #SS server 268 | # 269 | echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> .config #可以不集成 270 | echo "CONFIG_FIRMWARE_INCLUDE_TUNSAFE=n" >> .config #tunsafe 271 | echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=${{env.dnsforwarder}}" >> .config #dnsforwarder 272 | # 273 | echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=${{env.adbyby}}" >> .config #adbyby plus+ 274 | # 275 | echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=${{env.adguardhome}}" >> .config #adguardhome 276 | echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=${{env.smartdns}}" >> .config #smartdns 277 | # 278 | echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=${{env.aliddns}}" >> .config #阿里DDNS 279 | echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=${{env.zerotier}}" >> .config #zerotier ~1.3M 280 | echo "CONFIG_FIRMWARE_INCLUDE_DDNSTO=${{env.ddnsto}}" >> .config #ddnsto 281 | echo "CONFIG_FIRMWARE_INCLUDE_WIREGUARD=${{env.wireguard}}" >> .config #wireguard 282 | # 283 | echo "CONFIG_FIRMWARE_INCLUDE_ALDRIVER=${{env.aldrive}}" >> .config #阿里云盘 284 | echo "CONFIG_FIRMWARE_INCLUDE_SQM=${{env.sqm}}" >> .config #SQM 285 | # 286 | #校园网相关开始 287 | echo "CONFIG_FIRMWARE_INCLUDE_MENTOHUST=${{env.mentohust}}" >> .config #MENTOHUST 288 | echo "CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT=${{env.scutclient}}" >> .config #SCUTCLIENT 289 | echo "CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT=${{env.njitclient}}" >> .config 290 | echo "CONFIG_FIRMWARE_INCLUDE_MINIEAP=${{env.minieap}}" >> .config 291 | echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=${{env.dogcom}}" >> .config 292 | #校园网相关结束 293 | ######################################################################################### 294 | #自定义添加其它功能请参考源码configs/templates/目录下的config文件。按照上面的格式添加即可 295 | #格式如下: 296 | #sed -i '/自定义项/d' .config 297 | #echo "自定义项=y" >> .config 298 | sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${{ github.event.inputs.firmwarever }}/g" ./versions.inc 299 | echo '更新版本号时间' 300 | ######################################################################################### 301 | - name: Build firmware 302 | run: | 303 | cd $WORK_PATH/trunk 304 | sudo ./clear_tree 305 | sudo ./build_firmware_modify ${{ env.model }} 0 306 | echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV 307 | - name: Organize firmware files 308 | run: | 309 | mkdir -p $FIRMWARE_PATH/ 310 | cd $WORK_PATH/trunk/images 311 | for firmwarefile in $(ls *.trx) 312 | do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"${{ env.model }}"_kernal4.4.trx" 313 | done 314 | cd $FIRMWARE_PATH 315 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 316 | echo "STATUS=success" >> $GITHUB_ENV 317 | - name : Upload packages 318 | uses: actions/upload-artifact@main 319 | if: env.STATUS == 'success' 320 | with: 321 | name: Padavan44-packages 322 | path: ${{ env.FIRMWARE }} 323 | - name: Upload firmware to anonfiles 324 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 325 | run: | 326 | curl -fsSL git.io/file-transfer | sh 327 | ./transfer anon --no-progress ${FIRMWARE} 2>&1 | tee anonfile.log 328 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 329 | - name: Remove obsolete firmwares on artifacts 330 | uses: Bonnie2980/gha-remove-artifacts@master 331 | if: env.STATUS == 'success' 332 | with: 333 | age: '1 day' 334 | skip-recent: 5 335 | -------------------------------------------------------------------------------- /.github/workflows/build_asuswrt_modx.yml: -------------------------------------------------------------------------------- 1 | name: Build Asuswrt-Modx 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | target: 7 | type: choice 8 | description: 'target to build' 9 | options: 10 | - Xiaomi_R3G 11 | - Xiaomi_R3P 12 | - Xiaomi_R4A 13 | - Redmi_AC2100 14 | - Xiaomi_AC2100 15 | - Lenovo_NEWIFI2 16 | - Xiaoyu_C1 17 | - Xiaoyu_C3 18 | - Xiaoyu_C5 19 | - Diting_NEWIFI3 20 | - JDCloud_1 21 | - Gee_HC5962 22 | - ZTE_E8820S 23 | - Nokia-Sbell_A-040W-Q 24 | - Raisecom_MSG1500_X.00 25 | uploadanon: 26 | type: boolean 27 | description: 'upload firmware to anonfiles' 28 | default: 'false' 29 | env: 30 | REPOSITORY_URL: https://github.com/stkuroneko/asuswrt-mt7621at.git 31 | WORK_PATH: /opt/asuswrt-modx 32 | TIME_ZONE: Asia/Shanghai 33 | FIRMWARE_PATH: /opt/firmwares 34 | jobs: 35 | build: 36 | runs-on: ubuntu-20.04 37 | if: github.event.repository.owner.id == github.event.sender.id 38 | 39 | steps: 40 | - uses: actions/checkout@v4 41 | - uses: Bonnie2980/variable-mapper@master 42 | id: export 43 | with: 44 | key: "${{ github.event.inputs.target }}" 45 | map: | 46 | { 47 | "Xiaomi_R3G": { 48 | "model": "RT-MIR3G" 49 | }, 50 | "Xiaomi_R3P": { 51 | "model": "RT-MIR3P" 52 | }, 53 | "Xiaomi_R4A": { 54 | "model": "RT-MIR4A" 55 | }, 56 | "Redmi_AC2100": { 57 | "model": "RT-RM2100" 58 | }, 59 | "Xiaomi_AC2100": { 60 | "model": "RT-R2100" 61 | }, 62 | "Lenovo_NEWIFI2": { 63 | "model": "RT-NEWIFI2" 64 | }, 65 | "Xiaoyu_C1": { 66 | "model": "RT-XYC3" 67 | }, 68 | "Xiaoyu_C3": { 69 | "model": "RT-XYC3" 70 | }, 71 | "Xiaoyu_C5": { 72 | "model": "RT-XYC3" 73 | }, 74 | "Diting_NEWIFI3": { 75 | "model": "RT-NEWIFI3" 76 | }, 77 | "JDCloud_1": { 78 | "model": "RT-JDC1" 79 | }, 80 | "Gee_HC5962": { 81 | "model": "RT-HIWIFI4" 82 | }, 83 | "ZTE_E8820S": { 84 | "model": "RT-E8820S" 85 | }, 86 | "Nokia-Sbell_A-040W-Q": { 87 | "model": "RT-A040WQ" 88 | }, 89 | "Raisecom_MSG1500_X.00": { 90 | "model": "RT-MSG1500" 91 | }, 92 | ".*": { 93 | "model": "RT-MSG1500" 94 | } 95 | } 96 | export_to: env 97 | mode: first_match 98 | - name: Initialization environment 99 | env: 100 | DEBIAN_FRONTEND: noninteractive 101 | run: | 102 | sudo dpkg --add-architecture i386 103 | sudo dpkg -l | awk '/ii lib.*deb.sury.org/ {gsub(/:.*/, s, $2); print $2}' | xargs apt show -a | awk '/Package:/ {p=$2} /APT-Sources: .*focal\/main/ {print p"/focal"}' | sudo xargs eatmydata apt install --allow-downgrades 104 | sudo apt update 105 | sudo apt-get -y --no-install-recommends install libncurses5 libncurses5-dev m4 bison gawk flex libstdc++-4.8-dev g++-multilib g++ 106 | sudo apt-get -y --no-install-recommends install gengetopt git gitk zlib1g-dev autoconf autopoint libtool shtool autogen mtd-utils intltool sharutils 107 | sudo apt-get -y --no-install-recommends install docbook-xsl-* libstdc++5 texinfo dos2unix xsltproc binutils u-boot-tools device-tree-compiler python 108 | sudo apt-get -y --no-install-recommends install qemu gperf liblzo2-dev uuid-dev build-essential lzma-dev liblzma-dev lzma patch cmake intltool yodl yodl-doc 109 | sudo apt-get -y --no-install-recommends install libglib2.0-dev gtk-doc-tools libc6-i386 lib32stdc++6 lib32z1 libelf1:i386 lib32ncurses5 libc6-dev-i386 libstdc++6:i386 110 | sudo timedatectl set-timezone "$TIME_ZONE" 111 | - name: Clone source code 112 | run: | 113 | git clone --depth=1 $REPOSITORY_URL $WORK_PATH 114 | - name: Build 115 | run: | 116 | sudo cp -f bashScripts/asuswrt_build.sh $WORK_PATH/build.sh 117 | cd $WORK_PATH 118 | sudo chmod 777 ./build.sh 119 | bash ./build.sh ${{ env.model }} 120 | echo "dateprefix=$(date +"%Y%m%d")" >> $GITHUB_ENV 121 | - name: Organize firmware files 122 | run: | 123 | mkdir -p $FIRMWARE_PATH/ 124 | cd $WORK_PATH/release/src-ra-5010/image 125 | for firmwarefile in $(ls *.trx) 126 | do sudo mv -f $firmwarefile $FIRMWARE_PATH/${{ env.model }}"_"${dateprefix}.trx 127 | done 128 | for md5file in $(ls *.md5) 129 | do sudo mv -f $md5file $FIRMWARE_PATH/${{ env.model }}"_"${dateprefix}.md5 130 | done 131 | cd $FIRMWARE_PATH 132 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 133 | echo "STATUS=success" >> $GITHUB_ENV 134 | - name : Upload packages 135 | uses: actions/upload-artifact@main 136 | if: env.STATUS == 'success' 137 | with: 138 | name: Asuswrt-packages 139 | path: ${{ env.FIRMWARE }} 140 | - name: Upload firmware to anonfiles 141 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 142 | run: | 143 | curl -fsSL git.io/file-transfer | sh 144 | ./transfer anon --no-progress ${FIRMWARE} 2>&1 | tee anonfile.log 145 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 146 | - name: Remove obsolete firmwares on artifacts 147 | uses: Bonnie2980/gha-remove-artifacts@master 148 | if: env.STATUS == 'success' 149 | with: 150 | age: '1 day' 151 | skip-recent: 5 152 | -------------------------------------------------------------------------------- /.github/workflows/build_hanwckf_kernal3.x_padavan.yml: -------------------------------------------------------------------------------- 1 | name: Build hanwckf's kernal3.x Padavan 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | target: 7 | type: choice 8 | description: 'target to compile' 9 | options: 10 | - Phicomm_K1 11 | - Phicomm_K2 12 | - Oyewifi_OYE-0001 13 | - Lenovo_NEWIFI-MINI 14 | - Xiaomi_MINI 15 | - Xiaomi_3 16 | - Xiaomi_3C 17 | - Xiaomi_4 18 | - Xiaomi_R3G 19 | - Xiaomi_R4A 20 | - Xiaomi_R3P 21 | - Gee_HiWifi1S 22 | - Gee_HiWifi2 23 | - Gee_Enjoy1200 24 | - Qihoo_360P2 25 | - Xiaomi_NANO 26 | - Meizu_R13 27 | - Meizu_R13P 28 | - Asus_RT-AC1200GU 29 | - Xiaoyu_C1 30 | - Xiaoyu_C3 31 | - Xiaoyu_C5 32 | - Youhua_WR1200JS 33 | - Diting_NEWIFI3 34 | - Gee_B70 35 | - Totolink_A3004NS 36 | - Phicomm_K2P 37 | - Phicomm_K2P-USB 38 | - JCG_836PRO 39 | - JCG_AC860M 40 | - DLINK_DIR-882 41 | - DLINK_DIR-878 42 | - Motorola_MR2600 43 | - TP-LINK_WDR7300 44 | - Redmi_AC2100 45 | - Xiaomi_CR6606 46 | - Xiaomi_CR6608 47 | - Xiaomi_CR6609 48 | - Xiaomi_AC2100 49 | - JCG_Y2 50 | - ZTE_E8820V2 51 | - ZTE_E8820S 52 | - Raisecom_MSG1500_X.00 53 | - Netgear_R6220 54 | uploadanon: 55 | type: boolean 56 | description: 'upload firmware to anonfiles' 57 | default: 'false' 58 | env: 59 | REPOSITORY_URL: https://github.com/hanwckf/rt-n56u.git 60 | TOOLCHAIN_URL: https://github.com/hanwckf/padavan-toolchain/releases/download/v1.1/mipsel-linux-uclibc.tar.xz 61 | WORK_PATH: /opt/rt-n56u 62 | TIME_ZONE: Asia/Shanghai 63 | FIRMWARE_AUTHOR: hanwckf 64 | FIRMWARE_PATH: /opt/firmwares 65 | jobs: 66 | build: 67 | runs-on: ubuntu-20.04 68 | if: github.event.repository.owner.id == github.event.sender.id 69 | 70 | steps: 71 | - uses: actions/checkout@v4 72 | - uses: Bonnie2980/variable-mapper@master 73 | id: export 74 | with: 75 | key: "${{ github.event.inputs.target }}" 76 | map: | 77 | { 78 | "Phicomm_K1": { 79 | "model": "PSG1208" 80 | }, 81 | "Phicomm_K2": { 82 | "model": "PSG1218" 83 | }, 84 | "Oyewifi_OYE-0001": { 85 | "model": "OYE-001" 86 | }, 87 | "Lenovo_NEWIFI-MINI": { 88 | "model": "NEWIFI-MINI" 89 | }, 90 | "Xiaomi_MINI": { 91 | "model": "MI-MINI" 92 | }, 93 | "Xiaomi_3": { 94 | "model": "MI-3" 95 | }, 96 | "Xiaomi_3C": { 97 | "model": "MI-3C" 98 | }, 99 | "Xiaomi_4": { 100 | "model": "MI-4" 101 | }, 102 | "Xiaomi_R3G": { 103 | "model": "MI-R3G" 104 | }, 105 | "Xiaomi_R4A": { 106 | "model": "MI-R4A" 107 | }, 108 | "Xiaomi_R3P": { 109 | "model": "MI-R3P" 110 | }, 111 | "Gee_HiWifi1S": { 112 | "model": "HC5661A" 113 | }, 114 | "Gee_HiWifi2": { 115 | "model": "HC5761A" 116 | }, 117 | "Gee_Enjoy1200": { 118 | "model": "HC5861B" 119 | }, 120 | "Qihoo_360P2": { 121 | "model": "360P2" 122 | }, 123 | "Xiaomi_NANO": { 124 | "model": "MI-NANO" 125 | }, 126 | "Meizu_R13": { 127 | "model": "MZ-R13" 128 | }, 129 | "Meizu_R13P": { 130 | "model": "MZ-R13P" 131 | }, 132 | "Asus_RT-AC1200GU": { 133 | "model": "RT-AC1200GU" 134 | }, 135 | "Xiaoyu_C1": { 136 | "model": "XY-C1" 137 | }, 138 | "Xiaoyu_C3": { 139 | "model": "XY-C1" 140 | }, 141 | "Xiaoyu_C5": { 142 | "model": "XY-C1" 143 | }, 144 | "Youhua_WR1200JS": { 145 | "model": "WR1200JS" 146 | }, 147 | "Diting_NEWIFI3": { 148 | "model": "NEWIFI3" 149 | }, 150 | "Gee_B70": { 151 | "model": "B70" 152 | }, 153 | "Totolink_A3004NS": { 154 | "model": "A3004NS" 155 | }, 156 | "Phicomm_K2P": { 157 | "model": "K2P" 158 | }, 159 | "Phicomm_K2P-USB": { 160 | "model": "K2P-USB" 161 | }, 162 | "JCG_836PRO": { 163 | "model": "JCG-836PRO" 164 | }, 165 | "JCG_AC860M": { 166 | "model": "JCG-AC860M" 167 | }, 168 | "DLINK_DIR-882": { 169 | "model": "DIR-882" 170 | }, 171 | "DLINK_DIR-878": { 172 | "model": "DIR-878" 173 | }, 174 | "Motorola_MR2600": { 175 | "model": "MR2600" 176 | }, 177 | "TP-LINK_WDR7300": { 178 | "model": "WDR7300" 179 | }, 180 | "Redmi_AC2100": { 181 | "model": "RM2100" 182 | }, 183 | "Xiaomi_CR6606": { 184 | "model": "CR660x" 185 | }, 186 | "Xiaomi_CR6608": { 187 | "model": "CR660x" 188 | }, 189 | "Xiaomi_CR6609": { 190 | "model": "CR660x" 191 | }, 192 | "Xiaomi_AC2100": { 193 | "model": "R2100" 194 | }, 195 | "JCG_Y2": { 196 | "model": "JCG-Y2" 197 | }, 198 | "ZTE_E8820V2": { 199 | "model": "E8820V2" 200 | }, 201 | "ZTE_E8820S": { 202 | "model": "ZTE_E8820S" 203 | }, 204 | "Raisecom_MSG1500_X.00": { 205 | "model": "MSG1500" 206 | }, 207 | "Netgear_R6220": { 208 | "model": "R6220" 209 | }, 210 | ".*": { 211 | "model": "K2P" 212 | } 213 | } 214 | export_to: env 215 | mode: first_match 216 | - name: Initialization environment 217 | env: 218 | DEBIAN_FRONTEND: noninteractive 219 | run: | 220 | sudo apt-get update 221 | sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd fakeroot kmod \ 222 | cpio git python-docutils gettext automake autopoint texinfo build-essential help2man \ 223 | pkg-config zlib1g-dev libgmp3-dev libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin 224 | sudo timedatectl set-timezone "$TIME_ZONE" 225 | - name: Clone source code 226 | run: | 227 | git clone --depth=1 $REPOSITORY_URL $WORK_PATH 228 | cd $WORK_PATH/toolchain-mipsel 229 | mkdir -p toolchain-3.4.x 230 | wget $TOOLCHAIN_URL 231 | tar -xvf mipsel-linux-uclibc.tar.xz -C toolchain-3.4.x 232 | - name: Set environment variables 233 | run: | 234 | git config --global log.date format:'%Y%m%d' 235 | cd $WORK_PATH 236 | echo "FIRMWARE_VERSION=$(git log -1 --pretty=format:"%cd")" >> $GITHUB_ENV 237 | echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV 238 | - name: Custom config 239 | run: | 240 | cd $WORK_PATH/trunk 241 | if [ ! -f configs/templates/${{ env.model }}.config ] ; then 242 | echo "configs/templates/${{ env.model }}.config not found" 243 | exit 1 244 | fi 245 | cp -f configs/templates/${{ env.model }}.config .config 246 | sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${FIRMWARE_VERSION}/g" ./versions.inc 247 | - name: Build firmware 248 | run: | 249 | cd $WORK_PATH/trunk 250 | ./clear_tree 251 | fakeroot ./build_firmware_modify ${{ env.model }} 252 | - name: Organize firmware files 253 | id: organize 254 | run: | 255 | mkdir -p $FIRMWARE_PATH/ 256 | cd $WORK_PATH/trunk/images 257 | for firmwarefile in $(ls *.trx) 258 | do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"${{ env.model }}"_kernal3.x.trx" 259 | done 260 | cd $FIRMWARE_PATH 261 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 262 | echo "STATUS=success" >> $GITHUB_ENV 263 | - name : Upload packages 264 | uses: actions/upload-artifact@master 265 | if: env.STATUS == 'success' 266 | with: 267 | name: Padavan-packages 268 | path: ${{ env.FIRMWARE }} 269 | - name: Upload firmware to anonfiles 270 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 271 | run: | 272 | curl -fsSL git.io/file-transfer | sh 273 | ./transfer anon --no-progress ${FIRMWARE} 2>&1 | tee anonfile.log 274 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 275 | - name: Remove obsolete firmwares on artifacts 276 | uses: Bonnie2980/gha-remove-artifacts@master 277 | if: env.STATUS == 'success' 278 | with: 279 | age: '1 day' 280 | skip-recent: 5 281 | -------------------------------------------------------------------------------- /.github/workflows/build_hanwckf_kernal4.4_padavan.yml: -------------------------------------------------------------------------------- 1 | name: Build hanwckf's kernal4.4 Padavan 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | target: 7 | type: choice 8 | description: 'target to compile' 9 | options: 10 | - Xiaomi_CR6606 11 | - Xiaomi_CR6608 12 | - Xiaomi_CR6609 13 | - JCQ_Q20 14 | - JCQ_Q10Pro 15 | - JCG_836PRO 16 | - JCG_AC860M 17 | - JCG_Y2 18 | - DLINK_DIR-878 19 | - DLINK_DIR-882 20 | - Phicomm_K2P 21 | - Phicomm_K2P-USB 22 | - Motorola_MR2600 23 | - Xiaomi_R3P 24 | - Xiaoyu_C1 25 | - Xiaoyu_C3 26 | - Xiaoyu_C5 27 | uploadanon: 28 | type: boolean 29 | description: 'upload firmware to anonfiles' 30 | default: 'false' 31 | env: 32 | REPOSITORY_URL: https://github.com/hanwckf/padavan-4.4.git 33 | TOOLCHAIN_URL: https://github.com/hanwckf/padavan-toolchain/releases/download/linux-4.4-v1.0/mipsel-linux-uclibc.tar.xz 34 | WORK_PATH: /opt/padavan-4.4 35 | TIME_ZONE: Asia/Shanghai 36 | FIRMWARE_AUTHOR: hanwckf 37 | FIRMWARE_PATH: /opt/firmwares 38 | jobs: 39 | build: 40 | runs-on: ubuntu-20.04 41 | if: github.event.repository.owner.id == github.event.sender.id 42 | 43 | steps: 44 | - uses: actions/checkout@v4 45 | - uses: Bonnie2980/variable-mapper@master 46 | id: export 47 | with: 48 | key: "${{ github.event.inputs.target }}" 49 | map: | 50 | { 51 | "Xiaomi_CR6606": { 52 | "model": "CR660x" 53 | }, 54 | "Xiaomi_CR6608": { 55 | "model": "CR660x" 56 | }, 57 | "Xiaomi_CR6609": { 58 | "model": "CR660x" 59 | }, 60 | "JCQ_Q20": { 61 | "model": "JCG-Q20" 62 | }, 63 | "JCQ_Q10Pro": { 64 | "model": "JCG-Q20" 65 | }, 66 | "JCG_836PRO": { 67 | "model": "JCG-836PRO" 68 | }, 69 | "JCG_AC860M": { 70 | "model": "JCG-AC860M" 71 | }, 72 | "JCG_Y2": { 73 | "model": "JCG-Y2" 74 | }, 75 | "DLINK_DIR-882": { 76 | "model": "DIR-882" 77 | }, 78 | "DLINK_DIR-878": { 79 | "model": "DIR-878" 80 | }, 81 | "Phicomm_K2P": { 82 | "model": "K2P" 83 | }, 84 | "Phicomm_K2P-USB": { 85 | "model": "K2P-USB" 86 | }, 87 | "Motorola_MR2600": { 88 | "model": "MR2600" 89 | }, 90 | "Xiaomi_R3P": { 91 | "model": "MI-R3P" 92 | }, 93 | "Xiaoyu_C1": { 94 | "model": "XY-C1" 95 | }, 96 | "Xiaoyu_C3": { 97 | "model": "XY-C1" 98 | }, 99 | "Xiaoyu_C5": { 100 | "model": "XY-C1" 101 | }, 102 | ".*": { 103 | "model": "K2P" 104 | } 105 | } 106 | export_to: env 107 | mode: first_match 108 | - name: Initialization environment 109 | env: 110 | DEBIAN_FRONTEND: noninteractive 111 | run: | 112 | sudo apt-get update 113 | sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \ 114 | fakeroot kmod cpio git python3-docutils gettext automake autopoint \ 115 | texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \ 116 | libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin 117 | sudo timedatectl set-timezone "$TIME_ZONE" 118 | - name: Clone source code 119 | run: | 120 | git clone --depth=1 $REPOSITORY_URL $WORK_PATH 121 | cd $WORK_PATH/toolchain-mipsel 122 | mkdir -p toolchain-4.4.x 123 | wget $TOOLCHAIN_URL 124 | tar -xf mipsel-linux-uclibc.tar.xz -C toolchain-4.4.x 125 | - name: Set environment variables 126 | run: | 127 | git config --global log.date format:'%Y%m%d' 128 | cd $WORK_PATH 129 | echo "FIRMWARE_VERSION=$(git log -1 --pretty=format:"%cd")" >> $GITHUB_ENV 130 | echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV 131 | - name: Custom config 132 | run: | 133 | cd $WORK_PATH/trunk 134 | if [ ! -f configs/templates/${{ env.model }}.config ] ; then 135 | echo "configs/templates/${{ env.model }}.config not found" 136 | exit 1 137 | fi 138 | cp -f configs/templates/${{ env.model }}.config .config 139 | sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${FIRMWARE_VERSION}/g" ./versions.inc 140 | - name: Build firmware 141 | run: | 142 | cd $WORK_PATH/trunk 143 | ./clear_tree 144 | fakeroot ./build_firmware_modify ${{ env.model }} 145 | - name: Organize firmware files 146 | run: | 147 | mkdir -p $FIRMWARE_PATH/ 148 | cd $WORK_PATH/trunk/images 149 | for firmwarefile in $(ls *.trx) 150 | do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"${{ env.model }}"_kernal4.4.trx" 151 | done 152 | cd $FIRMWARE_PATH 153 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 154 | echo "STATUS=success" >> $GITHUB_ENV 155 | - name : Upload packages 156 | uses: actions/upload-artifact@master 157 | if: env.STATUS == 'success' 158 | with: 159 | name: Padavan44-packages 160 | path: ${{ env.FIRMWARE }} 161 | - name: Upload firmware to anonfiles 162 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 163 | run: | 164 | curl -fsSL git.io/file-transfer | sh 165 | ./transfer anon --no-progress ${FIRMWARE} 2>&1 | tee anonfile.log 166 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 167 | - name: Remove obsolete firmwares on artifacts 168 | uses: Bonnie2980/gha-remove-artifacts@master 169 | if: env.STATUS == 'success' 170 | with: 171 | age: '1 day' 172 | skip-recent: 5 173 | -------------------------------------------------------------------------------- /.github/workflows/build_padavan_toolchain.yml: -------------------------------------------------------------------------------- 1 | name: build padavan toolchain 2 | 3 | on: 4 | workflow_dispatch: 5 | env: 6 | REPOSITORY_URL: https://github.com/vb1980/padavan-4.4.git 7 | WORK_PATH: /opt/padavan-4.4 8 | jobs: 9 | build: 10 | name: build 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - name: Prepare environment 15 | run: | 16 | sudo apt update 17 | sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \ 18 | fakeroot kmod cpio git python3-docutils gettext automake autopoint \ 19 | texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \ 20 | libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin 21 | - name: Clone source code 22 | run: | 23 | git clone --depth=1 $REPOSITORY_URL $WORK_PATH 24 | - name: Start Build 25 | run: | 26 | cd $WORK_PATH 27 | make toolchain/build 28 | cd toolchain-mipsel/toolchain-4.4.x 29 | tar cJf ../mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz * 30 | - uses: actions/upload-artifact@main 31 | with: 32 | name: toolchain 33 | path: ${{ env.WORK_PATH }}/toolchain-mipsel/mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz 34 | -------------------------------------------------------------------------------- /.github/workflows/build_plan_b.yml: -------------------------------------------------------------------------------- 1 | name: Build plan_b 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | uploadanon: 7 | type: boolean 8 | description: 'whether to upload firmware to anonfiles' 9 | default: 'false' 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | if: github.event.repository.owner.id == github.event.sender.id 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: actions/setup-go@v5 18 | with: 19 | go-version: '1.21.1' 20 | check-latest: true 21 | cache-dependency-path: '**/go.sum' 22 | 23 | - name: Initialization environment 24 | run: | 25 | sudo apt-get update 26 | sudo apt install upx git -y 27 | 28 | - name: Clone&Build xray source code 29 | run: | 30 | git clone --depth=1 https://github.com/xtls/xray-core.git xray-core 31 | cd xray-core/main 32 | GOOS=linux GOARCH=mipsle go build -o ../../xraybin/xray -trimpath -ldflags "-s -w -buildid=" ./ 33 | cd ../../xraybin 34 | upx -9 xray 35 | shopt -s extglob 36 | rm -vrf !("xray") 37 | echo "xray=$PWD" >> $GITHUB_ENV 38 | 39 | - name: Clone&Build plan_b 40 | run: | 41 | git clone --depth=1 https://github.com/zusterben/plan_b 42 | mkdir plan_b/helloworld/bin 43 | sudo sed -i '/arch_list="mips arm armng arm64 mipsle"/arch_list="mipsle"' plan_b/build.sh 44 | sudo sed -i '/sync_xray_binary $arch/d' plan_b/build.sh 45 | sudo sed -i '/do_backup $arch/d' plan_b/build.sh 46 | sudo cp -f ${{env.xray}}/xray plan_b/bin_arch/mipsle 47 | sudo chmod +x plan_b/bin_arch/mipsle/xray 48 | cd plan_b 49 | sudo bash ./build.sh 50 | cd bin/mipsle 51 | echo "helloworld=$PWD" >> $GITHUB_ENV 52 | echo "STATUS=success" >> $GITHUB_ENV 53 | 54 | - name : Upload packages 55 | uses: actions/upload-artifact@main 56 | if: env.STATUS == 'success' 57 | with: 58 | name: helloworld-packages 59 | path: ${{ env.helloworld }} 60 | 61 | - name: Upload helloworld to anonfiles 62 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 63 | run: | 64 | curl -fsSL git.io/file-transfer | sh 65 | ./transfer anon --no-progress ${helloworld} 2>&1 | tee anonfile.log 66 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 67 | 68 | - name: Remove obsolete helloworlds on artifacts 69 | uses: Bonnie2980/gha-remove-artifacts@master 70 | if: env.STATUS == 'success' 71 | with: 72 | age: '1 day' 73 | skip-recent: 5 -------------------------------------------------------------------------------- /.github/workflows/build_tsl0922_kernal4.4_padavan.yml: -------------------------------------------------------------------------------- 1 | name: Build tsl0922's kernal4.4 Padavan 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | target: 7 | type: choice 8 | description: 'target to compile' 9 | options: 10 | - Gee_B70 11 | - Nokia-Sbell_A-040W-Q 12 | - Xiaomi_CR6606 13 | - Xiaomi_CR6608 14 | - Xiaomi_CR6609 15 | - DLINK_DIR-878 16 | - DLINK_DIR-882 17 | - JCG_836PRO 18 | - JCG_AC860M 19 | - JCQ_Q20 20 | - JCQ_Q10Pro 21 | - JCG_Y2 22 | - Phicomm_K2P-USB 23 | - Phicomm_K2P 24 | - Xiaomi_4 25 | - Xiaomi_R3G 26 | - Xiaomi_R3P-PB 27 | - Xiaomi_R3P 28 | - Motorola_MR2600 29 | - Raisecom_MSG1500_X.00 30 | - Diting_NEWIFI3 31 | - Xiaomi_AC2100 32 | - Redmi_AC2100 33 | - Asus_RT-AC85P 34 | - Youhua_WR1200JS 35 | - Youhua_WR330 36 | - Xiaoyu_C1 37 | - Xiaoyu_C3 38 | - Xiaoyu_C5 39 | - ZTE_E8820S 40 | default: Xiaoyu_C1 41 | plugins: 42 | description: 'json format string of include configs' 43 | required: true 44 | default: '{"vpnsvr":"n","vpncli":"n","vpncmd":"n","ss":"n","v2ray":"n","xray":"n","trojan":"n","singbox":"n","naiveproxy":"n","ssobfs":"n","dnsforwarder":"n","adbyby":"n","adguardhome":"n","smartdns":"n","aliddns":"n","zerotier":"n","ddnsto":"n","wireguard":"n","frpc":"y","aldrive":"n","sqm":"y","mentohust":"n","scutclient":"n","njitclient":"n","minieap":"n","dogcom":"n","transmission":"n","aria":"n","ariaweb":"n"}' 45 | firmwarever: 46 | description: 'firmware''s version' 47 | required: true 48 | default: '20240209' 49 | env: 50 | REPOSITORY_URL: https://github.com/tsl0922/padavan.git 51 | WORK_PATH: /opt/padavan-4.4 52 | TIME_ZONE: Asia/Shanghai 53 | FIRMWARE_DATEPREFIX: $(date +"%Y%m%d") 54 | FIRMWARE_AUTHOR: tsl0922 55 | FIRMWARE_PATH: /opt/firmwares 56 | jobs: 57 | build: 58 | runs-on: ubuntu-22.04 59 | if: github.event.repository.owner.id == github.event.sender.id 60 | 61 | steps: 62 | - uses: actions/checkout@v4 63 | - uses: hendrikmuhs/ccache-action@v1.2.12 64 | - uses: Bonnie2980/variable-mapper@master 65 | id: export 66 | with: 67 | key: "${{ github.event.inputs.target }}" 68 | map: | 69 | { 70 | "Gee_B70": { 71 | "model": "B70" 72 | }, 73 | "Nokia-Sbell_A-040W-Q": { 74 | "model": "BELL-A040WQ" 75 | }, 76 | "Xiaomi_CR6606": { 77 | "model": "CR660x" 78 | }, 79 | "Xiaomi_CR6608": { 80 | "model": "CR660x" 81 | }, 82 | "Xiaomi_CR6609": { 83 | "model": "CR660x" 84 | }, 85 | "DLINK_DIR-878": { 86 | "model": "DIR-878" 87 | }, 88 | "DLINK_DIR-882": { 89 | "model": "DIR-882" 90 | }, 91 | "JCG_836PRO": { 92 | "model": "JCG-836PRO" 93 | }, 94 | "JCG_AC860M": { 95 | "model": "JCG-AC860M" 96 | }, 97 | "JCQ_Q20": { 98 | "model": "JCG-Q20" 99 | }, 100 | "JCQ_Q10Pro": { 101 | "model": "JCG-Q20" 102 | }, 103 | "JCG_Y2": { 104 | "model": "JCG-Y2" 105 | }, 106 | "Phicomm_K2P-USB": { 107 | "model": "K2P-USB" 108 | }, 109 | "Phicomm_K2P": { 110 | "model": "K2P" 111 | }, 112 | "Xiaomi_4": { 113 | "model": "MI-4" 114 | }, 115 | "Xiaomi_R3G": { 116 | "model": "MI-R3G" 117 | }, 118 | "Xiaomi_R3P-PB": { 119 | "model": "MI-R3P-PB" 120 | }, 121 | "Xiaomi_R3P": { 122 | "model": "MI-R3P" 123 | }, 124 | "Motorola_MR2600": { 125 | "model": "MR2600" 126 | }, 127 | "Raisecom_MSG1500_X.00": { 128 | "model": "MSG1500" 129 | }, 130 | "Diting_NEWIFI3": { 131 | "model": "NEWIFI3" 132 | }, 133 | "Xiaomi_AC2100": { 134 | "model": "R2100" 135 | }, 136 | "Redmi_AC2100": { 137 | "model": "RM2100" 138 | }, 139 | "Asus_RT-AC85P": { 140 | "model": "RT-AC85P" 141 | }, 142 | "Youhua_WR1200JS": { 143 | "model": "WR1200JS" 144 | }, 145 | "Youhua_WR330": { 146 | "model": "WR1200JS" 147 | }, 148 | "Xiaoyu_C1": { 149 | "model": "XY-C1" 150 | }, 151 | "Xiaoyu_C3": { 152 | "model": "XY-C1" 153 | }, 154 | "Xiaoyu_C5": { 155 | "model": "XY-C1" 156 | }, 157 | "ZTE_E8820S": { 158 | "model": "ZTE-E8820S" 159 | }, 160 | ".*": { 161 | "model": "K2P" 162 | } 163 | } 164 | export_to: env 165 | mode: first_match 166 | - uses: actions/setup-go@v5 167 | with: 168 | go-version: '1.20' 169 | check-latest: true 170 | cache: false 171 | - uses: actions/setup-node@v4 172 | with: 173 | node-version: 18 174 | check-latest: true 175 | - name: Initialization environment 176 | env: 177 | DEBIAN_FRONTEND: noninteractive 178 | run: | 179 | sudo apt-get update 180 | sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \ 181 | fakeroot kmod cpio git python3-docutils gettext automake autopoint \ 182 | texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \ 183 | libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin libev-dev 184 | sudo timedatectl set-timezone "$TIME_ZONE" 185 | - name: Clone source code 186 | run: | 187 | git clone --depth=1 $REPOSITORY_URL $WORK_PATH 188 | cd $WORK_PATH 189 | sed -i '/cp -f/d' Makefile 190 | - name: Parse json string of include plugins 191 | run: | 192 | echo "vpnsvr=${{fromJson(github.event.inputs.plugins).vpnsvr}}" >> $GITHUB_ENV 193 | echo "vpncli=${{fromJson(github.event.inputs.plugins).vpncli}}" >> $GITHUB_ENV 194 | echo "vpncmd=${{fromJson(github.event.inputs.plugins).vpncmd}}" >> $GITHUB_ENV 195 | echo "ss=${{fromJson(github.event.inputs.plugins).ss}}" >> $GITHUB_ENV 196 | echo "v2ray=${{fromJson(github.event.inputs.plugins).v2ray}}" >> $GITHUB_ENV 197 | echo "xray=${{fromJson(github.event.inputs.plugins).xray}}" >> $GITHUB_ENV 198 | echo "trojan=${{fromJson(github.event.inputs.plugins).trojan}}" >> $GITHUB_ENV 199 | echo "singbox=${{fromJson(github.event.inputs.plugins).singbox}}" >> $GITHUB_ENV 200 | echo "naiveproxy=${{fromJson(github.event.inputs.plugins).naiveproxy}}" >> $GITHUB_ENV 201 | echo "ssobfs=${{fromJson(github.event.inputs.plugins).ssobfs}}" >> $GITHUB_ENV 202 | echo "dnsforwarder=${{fromJson(github.event.inputs.plugins).dnsforwarder}}" >> $GITHUB_ENV 203 | echo "adbyby=${{fromJson(github.event.inputs.plugins).adbyby}}" >> $GITHUB_ENV 204 | echo "adguardhome=${{fromJson(github.event.inputs.plugins).adguardhome}}" >> $GITHUB_ENV 205 | echo "smartdns=${{fromJson(github.event.inputs.plugins).smartdns}}" >> $GITHUB_ENV 206 | echo "aliddns=${{fromJson(github.event.inputs.plugins).aliddns}}" >> $GITHUB_ENV 207 | echo "zerotier=${{fromJson(github.event.inputs.plugins).zerotier}}" >> $GITHUB_ENV 208 | echo "ddnsto=${{fromJson(github.event.inputs.plugins).ddnsto}}" >> $GITHUB_ENV 209 | echo "wireguard=${{fromJson(github.event.inputs.plugins).wireguard}}" >> $GITHUB_ENV 210 | echo "frpc=${{fromJson(github.event.inputs.plugins).frpc}}" >> $GITHUB_ENV 211 | echo "aldrive=${{fromJson(github.event.inputs.plugins).aldrive}}" >> $GITHUB_ENV 212 | echo "sqm=${{fromJson(github.event.inputs.plugins).sqm}}" >> $GITHUB_ENV 213 | echo "mentohust=${{fromJson(github.event.inputs.plugins).mentohust}}" >> $GITHUB_ENV 214 | echo "scutclient=${{fromJson(github.event.inputs.plugins).scutclient}}" >> $GITHUB_ENV 215 | echo "njitclient=${{fromJson(github.event.inputs.plugins).njitclient}}" >> $GITHUB_ENV 216 | echo "minieap=${{fromJson(github.event.inputs.plugins).minieap}}" >> $GITHUB_ENV 217 | echo "dogcom=${{fromJson(github.event.inputs.plugins).dogcom}}" >> $GITHUB_ENV 218 | echo "transmission=${{fromJson(github.event.inputs.plugins).transmission}}" >> $GITHUB_ENV 219 | echo "aria=${{fromJson(github.event.inputs.plugins).aria}}" >> $GITHUB_ENV 220 | echo "ariaweb=${{fromJson(github.event.inputs.plugins).ariaweb}}" >> $GITHUB_ENV 221 | - name: Custom config 222 | run: | 223 | cd $WORK_PATH/trunk 224 | if [ ! -f configs/templates/${{ env.model }}.config ] ; then 225 | echo "configs/templates/${{ env.model }}.config not found" 226 | exit 1 227 | fi 228 | cp -f configs/templates/${{ env.model }}.config .config 229 | ################################################################################################ 230 | #因不同型号配置功能不一样,所以先把配置项删除,如果你自己要添加其他的,也要写上删除这一条,切记!!! 231 | ################################################################################################ 232 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER/d' .config #删除配置项SOFTETHERVPN 233 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT/d' .config #删除配置项SOFTETHERVPN 234 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD/d' .config #删除配置项SOFTETHERVPN 235 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS/d' .config #删除配置项SS plus+ 236 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SSSERVER/d' .config #删除配置项SS server 237 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER/d' .config #删除配置项DNSFORWARDER 238 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ADBYBY/d' .config #删除配置项adbyby plus+ 239 | sed -i '/CONFIG_FIRMWARE_INCLUDE_TUNSAFE/d' .config #删除配置项tunsafe 240 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ALIDDNS/d' .config #删除配置项阿里DDNS 241 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' .config #删除配置项srelay 242 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME/d' .config #删除配置项adguardhome 243 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SMARTDNS/d' .config #删除配置项smartdns 244 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ZEROTIER/d' .config #删除配置项zerotier 245 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNSTO/d' .config #删除配置项ddnsto 246 | sed -i '/CONFIG_FIRMWARE_INCLUDE_WIREGUARD/d' .config #删除配置项wireguard 247 | sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPS/d' .config #删除配置项frp server 248 | sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPC/d' .config #删除配置项frp client 249 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ALDRIVER/d' .config #删除配置项阿里云盘 250 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SQM/d' .config #删除配置项QOS流控 251 | sed -i '/CONFIG_FIRMWARE_INCLUDE_TRANSMISSION/d' .config #删除配置项Transmission 252 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ARIA/d' .config #删除配置项Aria 253 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ARIA_WEB_CONTROL/d' .config #删除配置项AriaWebControl 254 | #校园网相关开始 255 | sed -i '/CONFIG_FIRMWARE_INCLUDE_MENTOHUST/d' .config #删除配置项MENTOHUST 256 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT/d' .config #删除配置项SCUTCLIENT 257 | sed -i '/CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT/d' .config 258 | sed -i '/CONFIG_FIRMWARE_INCLUDE_MINIEAP/d' .config 259 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DOGCOM/d' .config 260 | #校园网相关结束 261 | sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' .config 262 | ###################################################################### 263 | #以下选项是定义你需要的功能(y=集成,n=忽略),重新写入到.config文件 264 | ###################################################################### 265 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER=${{env.vpnsvr}}" >> .config #SOFTETHERVPN 266 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT=${{env.vpncli}}" >> .config #SOFTETHERVPN 267 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD=${{env.vpncmd}}" >> .config #SOFTETHERVPN 268 | #科学相关 269 | echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=${{env.ss}}" >> .config #SS plus+ 270 | echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=${{env.v2ray}}" >> .config #集成v2ray执行文件(3.8M左右) 271 | echo "CONFIG_FIRMWARE_INCLUDE_XRAY=${{env.xray}}" >> .config #集成xray执行文件(5.6M左右),可以代替v2ray,注:如果闪存太小不够还是建议使用v2ray 272 | echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=${{env.trojan}}" >> .config #集成trojan执行文件(1.1M左右) 273 | echo "CONFIG_FIRMWARE_INCLUDE_SINGBOX=${{env.singbox}}" >> .config #集成Singbox执行文件 274 | echo "CONFIG_FIRMWARE_INCLUDE_NAIVEPROXY=${{env.naiveproxy}}" >> .config #集成Naiveproxy执行文件 275 | echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=${{env.ssobfs}}" >> .config # simple-obfs混淆插件 276 | echo "CONFIG_FIRMWARE_INCLUDE_SSSERVER=n" >> .config #SS server 277 | # 278 | echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> .config #可以不集成 279 | echo "CONFIG_FIRMWARE_INCLUDE_TUNSAFE=n" >> .config #tunsafe 280 | echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=${{env.dnsforwarder}}" >> .config #dnsforwarder 281 | # 282 | echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=${{env.adbyby}}" >> .config #adbyby plus+ 283 | # 284 | echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=${{env.adguardhome}}" >> .config #adguardhome 285 | echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=${{env.smartdns}}" >> .config #smartdns 286 | # 287 | echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=${{env.aliddns}}" >> .config #阿里DDNS 288 | echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=${{env.zerotier}}" >> .config #zerotier ~1.3M 289 | echo "CONFIG_FIRMWARE_INCLUDE_DDNSTO=${{env.ddnsto}}" >> .config #ddnsto 290 | echo "CONFIG_FIRMWARE_INCLUDE_WIREGUARD=${{env.wireguard}}" >> .config #wireguard 291 | echo "CONFIG_FIRMWARE_INCLUDE_FRPS=n" >> .config #frp server 292 | echo "CONFIG_FIRMWARE_INCLUDE_FRPC=${{env.frpc}}" >> .config #frp client 293 | # 294 | echo "CONFIG_FIRMWARE_INCLUDE_ALDRIVER=${{env.aldrive}}" >> .config #阿里云盘 295 | echo "CONFIG_FIRMWARE_INCLUDE_SQM=${{env.sqm}}" >> .config #QOS流控 296 | # 297 | # 298 | echo "CONFIG_FIRMWARE_INCLUDE_TRANSMISSION=${{env.transmission}}" >> .config #Transmission 299 | echo "CONFIG_FIRMWARE_INCLUDE_ARIA=${{env.aria}}" >> .config #Aria 300 | echo "CONFIG_FIRMWARE_INCLUDE_ARIA_WEB_CONTROL=${{env.ariaweb}}" >> .config #Aria Web 301 | # 302 | #校园网相关开始 303 | #echo "CONFIG_FIRMWARE_INCLUDE_MENTOHUST=${{env.mentohust}}" >> .config #MENTOHUST 304 | #echo "CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT=${{env.scutclient}}" >> .config #SCUTCLIENT 305 | #echo "CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT=${{env.njitclient}}" >> .config 306 | #echo "CONFIG_FIRMWARE_INCLUDE_MINIEAP=${{env.minieap}}" >> .config 307 | #echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=${{env.dogcom}}" >> .config 308 | #校园网相关结束 309 | ######################################################################################### 310 | #自定义添加其它功能请参考源码configs/templates/目录下的config文件。按照上面的格式添加即可 311 | #格式如下: 312 | #sed -i '/自定义项/d' .config 313 | #echo "自定义项=y" >> .config 314 | sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${{ github.event.inputs.firmwarever }}/g" ./versions.inc 315 | echo '更新版本号时间' 316 | ######################################################################################### 317 | - name: Build firmware 318 | run: | 319 | cd $WORK_PATH 320 | sudo make ${{ env.model }} TOOLCHAIN=mipsel-linux-musl 321 | echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV 322 | - name: Organize firmware files 323 | id: organize 324 | run: | 325 | mkdir -p $FIRMWARE_PATH/ 326 | cd $WORK_PATH/trunk/images 327 | for firmwarefile in $(ls *.trx) 328 | do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"${{ env.model }}"_kernal4.4.trx" 329 | done 330 | cd $FIRMWARE_PATH 331 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 332 | echo "STATUS=success" >> $GITHUB_ENV 333 | - name : Upload packages 334 | uses: actions/upload-artifact@main 335 | if: env.STATUS == 'success' 336 | with: 337 | name: tsl0922-Padavan44-packages 338 | path: ${{ env.FIRMWARE }} 339 | -------------------------------------------------------------------------------- /.github/workflows/build_vb1980_kernal4.4_padavan.yml: -------------------------------------------------------------------------------- 1 | name: Build vb1980's kernal4.4 Padavan 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | target: 7 | type: choice 8 | description: 'target to compile' 9 | options: 10 | - 360_T6M 11 | - 360_T6M-PB 12 | - Arcadyan_WE410443-TC 13 | - Asus_RT-AC85P 14 | - C-Life_XG1 15 | - Diting_NEWIFI3 16 | - DLINK_DIR-878 17 | - DLINK_DIR-882 18 | - FCJ_G-AX1800_Black 19 | - FCJ_G-AX1800_White 20 | - Gee_B70 21 | - GHL_R-001 22 | - H3C_TX1801 23 | - H3C_TX1806 24 | - Hair_HAR-20S2U1 25 | - JCG_836PRO 26 | - JCG_AC860M 27 | - JCG_Q20 28 | - JCG_Q20-PB 29 | - JCG_Q10Pro 30 | - JCG_Q10Pro-PB 31 | - JCG_Q11Pro 32 | - JCG_Y2 33 | - JDCloud_1 34 | - JDCloud_Luban 35 | - Lenovo_NEWIFI2 36 | - Linksys_EA7500 37 | - Motorola_MR2600 38 | - Netgear_R6800 39 | - Netgear_R7450 40 | - Nokia-Sbell_A-040W-Q 41 | - Phicomm_K2P 42 | - Phicomm_K2P-NANO 43 | - Phicomm_K2P-USB 44 | - QianmoBus_B1 45 | - Raisecom_MSG1500_X.00 46 | - Raisecom_MSG1500_Z.00 47 | - Redmi_AC2100 48 | - Skspruce_WIA3300-10 49 | - SIM_AX1800T 50 | - Xiaomi_4 51 | - Xiaomi_AC2100 52 | - Xiaomi_CR6606 53 | - Xiaomi_CR6608 54 | - Xiaomi_CR6609 55 | - Xiaomi_R3G 56 | - Xiaomi_R3P 57 | - Xiaomi_R3P-PB 58 | - Xiaomi_R3P-SPI 59 | - Xiaomi_R4A 60 | - Xiaoyu_C1 61 | - Xiaoyu_C3 62 | - Xiaoyu_C5 63 | - Youhua_WR1200JS 64 | - Youhua_WR330 65 | - ZTE_E8820V2 66 | - ZTE_E8820S 67 | - ZTT_RX6000 68 | default: SIM_AX1800T 69 | plugins: 70 | description: 'json format string of include configs' 71 | required: true 72 | default: '{"vpnsvr":"n","vpncli":"n","vpncmd":"n","ss":"y","v2ray":"n","xray":"y","trojan":"y","ssobfs":"y","dnsforwarder":"n","adbyby":"n","adguardhome":"n","smartdns":"n","aliddns":"n","zerotier":"n","ddnsto":"n","wireguard":"n","frpc":"y","aldrive":"n","sqm":"y","mentohust":"n","scutclient":"n","njitclient":"n","minieap":"n","dogcom":"n"}' 73 | usexraymin: 74 | type: boolean 75 | description: 'use streamlined xray' 76 | default: false 77 | customization: 78 | description: 'json format string of customized configs' 79 | required: true 80 | default: '{"rainbowui":"y","specializedlogo":"n","changebrandlogo":"n","lanip":"192.168.2.1","signaccount":"admin","signpassword":"admin","wifi2gssid":"","wifi5gssid":"","wifi2gpsk":"","wifi5gpsk":""}' 81 | firmwarever: 82 | description: 'firmware''s version' 83 | required: true 84 | default: '20240403' 85 | uploadanon: 86 | type: boolean 87 | description: 'upload firmware to anonfiles' 88 | default: 'false' 89 | env: 90 | REPOSITORY_URL: https://github.com/vb1980/padavan-4.4.git 91 | WORK_PATH: /opt/padavan-4.4 92 | DEFAULT_FILE: ./user/shared/defaults.h 93 | DICT_FILE: ./user/www/dict/CN.dict 94 | TIME_ZONE: Asia/Shanghai 95 | FIRMWARE_DATEPREFIX: $(date +"%Y%m%d") 96 | FIRMWARE_AUTHOR: vb1980 97 | FIRMWARE_PATH: /opt/firmwares 98 | jobs: 99 | build: 100 | runs-on: ubuntu-latest 101 | if: github.event.repository.owner.id == github.event.sender.id 102 | 103 | steps: 104 | - uses: actions/checkout@v4 105 | - uses: hendrikmuhs/ccache-action@v1.2.12 106 | - uses: Bonnie2980/variable-mapper@master 107 | id: export 108 | with: 109 | key: "${{ github.event.inputs.target }}" 110 | map: | 111 | { 112 | "360_T6M": { 113 | "model": "360-T6M" 114 | }, 115 | "360_T6M-PB": { 116 | "model": "360-T6M-PB" 117 | }, 118 | "Arcadyan_WE410443-TC": { 119 | "model": "WE410443-TC" 120 | }, 121 | "Asus_RT-AC85P": { 122 | "model": "RT-AC85P" 123 | }, 124 | "C-Life_XG1": { 125 | "model": "C-Life-XG1" 126 | }, 127 | "Diting_NEWIFI3": { 128 | "model": "NEWIFI3" 129 | }, 130 | "DLINK_DIR-878": { 131 | "model": "DIR-878" 132 | }, 133 | "DLINK_DIR-882": { 134 | "model": "DIR-882" 135 | }, 136 | "FCJ_G-AX1800_Black": { 137 | "model": "G-AX1800-B" 138 | }, 139 | "FCJ_G-AX1800_White": { 140 | "model": "G-AX1800" 141 | }, 142 | "Gee_B70": { 143 | "model": "B70" 144 | }, 145 | "GHL_R-001": { 146 | "model": "GHL" 147 | }, 148 | "H3C_TX1801": { 149 | "model": "TX1801" 150 | }, 151 | "H3C_TX1806": { 152 | "model": "TX1801" 153 | }, 154 | "Hair_HAR-20S2U1": { 155 | "model": "HAR-20S2U1" 156 | }, 157 | "JCG_836PRO": { 158 | "model": "JCG-836PRO" 159 | }, 160 | "JCG_AC860M": { 161 | "model": "JCG-AC860M" 162 | }, 163 | "JCG_Q20": { 164 | "model": "JCG-Q20" 165 | }, 166 | "JCG_Q20-PB": { 167 | "model": "JCG-Q20-PB" 168 | }, 169 | "JCG_Q10Pro": { 170 | "model": "JCG-Q10Pro" 171 | }, 172 | "JCG_Q10Pro-PB": { 173 | "model": "JCG-Q10Pro-PB" 174 | }, 175 | "JCG_Q11Pro": { 176 | "model": "JCG-Q11Pro" 177 | }, 178 | "JCG_Y2": { 179 | "model": "JCG-Y2" 180 | }, 181 | "JDCloud_1": { 182 | "model": "JDCLOUD-RE-SP-01B" 183 | }, 184 | "JDCloud_Luban": { 185 | "model": "JDCLOUD-RE-CP-02" 186 | }, 187 | "Lenovo_NEWIFI2": { 188 | "model": "NEWIFI" 189 | }, 190 | "Linksys_EA7500": { 191 | "model": "EA7500" 192 | }, 193 | "Motorola_MR2600": { 194 | "model": "MR2600" 195 | }, 196 | "Netgear_R6800": { 197 | "model": "NETGEAR-R6800" 198 | }, 199 | "Netgear_R7450": { 200 | "model": "NETGEAR-R7450" 201 | }, 202 | "Nokia-Sbell_A-040W-Q": { 203 | "model": "BELL-A040WQ" 204 | }, 205 | "Phicomm_K2P": { 206 | "model": "K2P" 207 | }, 208 | "Phicomm_K2P-NANO": { 209 | "model": "K2P-NANO" 210 | }, 211 | "Phicomm_K2P-USB": { 212 | "model": "K2P-USB" 213 | }, 214 | "QianmoBus_B1": { 215 | "model": "QM-B1" 216 | }, 217 | "Raisecom_MSG1500_X.00": { 218 | "model": "MSG1500" 219 | }, 220 | "Raisecom_MSG1500_Z.00": { 221 | "model": "MSG1500-Z" 222 | }, 223 | "Redmi_AC2100": { 224 | "model": "RM2100" 225 | }, 226 | "Skspruce_WIA3300-10": { 227 | "model": "WIA3300-10" 228 | }, 229 | "SIM_AX1800T": { 230 | "model": "SIM-AX1800T" 231 | }, 232 | "Xiaomi_4": { 233 | "model": "MI-4" 234 | }, 235 | "Xiaomi_AC2100": { 236 | "model": "R2100" 237 | }, 238 | "Xiaomi_CR6606": { 239 | "model": "CR660x" 240 | }, 241 | "Xiaomi_CR6608": { 242 | "model": "CR660x" 243 | }, 244 | "Xiaomi_CR6609": { 245 | "model": "CR660x" 246 | }, 247 | "Xiaomi_R3G": { 248 | "model": "MI-R3G" 249 | }, 250 | "Xiaomi_R3P": { 251 | "model": "MI-R3P" 252 | }, 253 | "Xiaomi_R3P-PB": { 254 | "model": "MI-R3P-PB" 255 | }, 256 | "Xiaomi_R3P-SPI": { 257 | "model": "MI-R3P-SPI" 258 | }, 259 | "Xiaomi_R4A": { 260 | "model": "MI-R4A" 261 | }, 262 | "Xiaoyu_C1": { 263 | "model": "XY-C1" 264 | }, 265 | "Xiaoyu_C3": { 266 | "model": "XY-C1" 267 | }, 268 | "Xiaoyu_C5": { 269 | "model": "XY-C1" 270 | }, 271 | "Youhua_WR1200JS": { 272 | "model": "WR1200JS" 273 | }, 274 | "Youhua_WR330": { 275 | "model": "WR1200JS" 276 | }, 277 | "ZTE_E8820V2": { 278 | "model": "ZTE-E8820V2" 279 | }, 280 | "ZTE_E8820S": { 281 | "model": "ZTE-E8820S" 282 | }, 283 | "ZTT_RX6000": { 284 | "model": "ZTT-RX6000" 285 | }, 286 | ".*": { 287 | "model": "K2P" 288 | } 289 | } 290 | export_to: env 291 | mode: first_match 292 | - uses: actions/setup-go@v5 293 | with: 294 | go-version: '1.23.0' 295 | check-latest: true 296 | cache-dependency-path: '**/go.sum' 297 | - name: Initialization environment 298 | env: 299 | DEBIAN_FRONTEND: noninteractive 300 | run: | 301 | sudo apt-get update 302 | sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \ 303 | fakeroot kmod cpio git python3-docutils gettext automake autopoint \ 304 | texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \ 305 | libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin libev-dev \ 306 | libssl-dev liblzo2-dev libpam0g-dev libevent-dev 307 | sudo timedatectl set-timezone "$TIME_ZONE" 308 | - name: Clone source code 309 | run: | 310 | git clone --depth=1 $REPOSITORY_URL $WORK_PATH 311 | cd $WORK_PATH 312 | sed -i '/cp -f/d' Makefile 313 | - name: Extract toolchain 314 | run: | 315 | cp -f toolchain/mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz $WORK_PATH 316 | cd $WORK_PATH 317 | mkdir -p toolchain-mipsel/toolchain-4.4.x 318 | tar -Jxvf mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz -C toolchain-mipsel/toolchain-4.4.x 319 | - name: Parse json string of customization configs 320 | run: | 321 | echo "rainbowui=${{fromJson(github.event.inputs.customization).rainbowui}}" >> $GITHUB_ENV 322 | echo "specializedlogo=${{fromJson(github.event.inputs.customization).specializedlogo}}" >> $GITHUB_ENV 323 | echo "changebrandlogo=${{fromJson(github.event.inputs.customization).changebrandlogo}}" >> $GITHUB_ENV 324 | echo "lanip=${{fromJson(github.event.inputs.customization).lanip}}" >> $GITHUB_ENV 325 | echo "signaccount=${{fromJson(github.event.inputs.customization).signaccount}}" >> $GITHUB_ENV 326 | echo "signpassword=${{fromJson(github.event.inputs.customization).signpassword}}" >> $GITHUB_ENV 327 | echo "wifi2gssid=${{fromJson(github.event.inputs.customization).wifi2gssid}}" >> $GITHUB_ENV 328 | echo "wifi5gssid=${{fromJson(github.event.inputs.customization).wifi5gssid}}" >> $GITHUB_ENV 329 | echo "wifi2gpsk=${{fromJson(github.event.inputs.customization).wifi2gpsk}}" >> $GITHUB_ENV 330 | echo "wifi5gpsk=${{fromJson(github.event.inputs.customization).wifi5gpsk}}" >> $GITHUB_ENV 331 | - name: Customization 332 | run: | 333 | cp -f bashScripts/setlanip.sh $WORK_PATH/trunk 334 | cp -f bashScripts/setaccount.sh $WORK_PATH/trunk 335 | cp -f bashScripts/setwifi.sh $WORK_PATH/trunk 336 | cd $WORK_PATH/trunk 337 | sudo chmod +x setlanip.sh 338 | sudo chmod +x setaccount.sh 339 | sudo chmod +x setwifi.sh 340 | if [ "${{ env.rainbowui }}" = "true" ]; then 341 | bash ./setlanip.sh ${{ env.DEFAULT_FILE }} ./user/www/n56u_rainbow/Restarting.asp ${{ env.DICT_FILE }} ${{ env.lanip }} 342 | else 343 | bash ./setlanip.sh ${{ env.DEFAULT_FILE }} ./user/www/n56u_ribbon_fixed/Restarting.asp ${{ env.DICT_FILE }} ${{ env.lanip }} 344 | fi 345 | bash ./setaccount.sh ${{ env.signaccount }} ${{ env.signpassword }} ${{ env.DEFAULT_FILE }} 346 | bash ./setwifi.sh ${{ env.wifi2gssid }} ${{ env.wifi5gssid }} ${{ env.wifi2gpsk }} ${{ env.wifi5gpsk }} ${{ env.DEFAULT_FILE }} 347 | #cat ${{ env.DEFAULT_FILE }} 348 | - name: Apply rainbow themes 349 | if: env.rainbowui == 'y' 350 | run: | 351 | cd $WORK_PATH/trunk/user/httpd 352 | git apply formlogin.patch 353 | cd $WORK_PATH/trunk/user/www 354 | sed -i "s/WEBUI_NAME=n56u_ribbon_fixed/WEBUI_NAME=n56u_rainbow/g" ./Makefile 355 | - name: Apply specialized logo 356 | if: env.specializedlogo == 'y' 357 | run: | 358 | logoFile= 359 | if [ "${{ env.model }}" = "BELL-A040WQ" ]; then 360 | logoFile="a040wq/bell_asus_logo.png" 361 | fi 362 | if [ "${{ env.model }}" = "ZTE-E8820S" ]; then 363 | logoFile="e8820s/zte_asus_logo.png" 364 | fi 365 | if [ "${{ env.model }}" = "MSG1500" ]; then 366 | logoFile="msg1500/raisecom_asus_logo.png" 367 | fi 368 | if [ -n "$logoFile" ]; then 369 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_ribbon_fixed/bootstrap/img/asus_logo.png 370 | if [ "${{ env.rainbowui }}" = "y" ]; then 371 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_blue.png 372 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_cyan.png 373 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_green.png 374 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_orange.png 375 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_purple.png 376 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_red.png 377 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_yellow.png 378 | fi 379 | fi 380 | - name: Change specialized brand logo image 381 | if: env.changebrandlogo == 'y' && env.specializedlogo == 'n' 382 | run: | 383 | cd $WORK_PATH/trunk 384 | if [ "${{ env.rainbowui }}" = "y" ]; then 385 | sudo ./change_logo.sh ${{ env.model }} 0 386 | else 387 | sudo ./change_logo.sh ${{ env.model }} 388 | fi 389 | - name: Parse json string of include plugins 390 | run: | 391 | echo "vpnsvr=${{fromJson(github.event.inputs.plugins).vpnsvr}}" >> $GITHUB_ENV 392 | echo "vpncli=${{fromJson(github.event.inputs.plugins).vpncli}}" >> $GITHUB_ENV 393 | echo "vpncmd=${{fromJson(github.event.inputs.plugins).vpncmd}}" >> $GITHUB_ENV 394 | echo "ss=${{fromJson(github.event.inputs.plugins).ss}}" >> $GITHUB_ENV 395 | echo "v2ray=${{fromJson(github.event.inputs.plugins).v2ray}}" >> $GITHUB_ENV 396 | echo "xray=${{fromJson(github.event.inputs.plugins).xray}}" >> $GITHUB_ENV 397 | echo "trojan=${{fromJson(github.event.inputs.plugins).trojan}}" >> $GITHUB_ENV 398 | echo "ssobfs=${{fromJson(github.event.inputs.plugins).ssobfs}}" >> $GITHUB_ENV 399 | echo "dnsforwarder=${{fromJson(github.event.inputs.plugins).dnsforwarder}}" >> $GITHUB_ENV 400 | echo "adbyby=${{fromJson(github.event.inputs.plugins).adbyby}}" >> $GITHUB_ENV 401 | echo "adguardhome=${{fromJson(github.event.inputs.plugins).adguardhome}}" >> $GITHUB_ENV 402 | echo "smartdns=${{fromJson(github.event.inputs.plugins).smartdns}}" >> $GITHUB_ENV 403 | echo "aliddns=${{fromJson(github.event.inputs.plugins).aliddns}}" >> $GITHUB_ENV 404 | echo "zerotier=${{fromJson(github.event.inputs.plugins).zerotier}}" >> $GITHUB_ENV 405 | echo "ddnsto=${{fromJson(github.event.inputs.plugins).ddnsto}}" >> $GITHUB_ENV 406 | echo "wireguard=${{fromJson(github.event.inputs.plugins).wireguard}}" >> $GITHUB_ENV 407 | echo "frpc=${{fromJson(github.event.inputs.plugins).frpc}}" >> $GITHUB_ENV 408 | echo "aldrive=${{fromJson(github.event.inputs.plugins).aldrive}}" >> $GITHUB_ENV 409 | echo "sqm=${{fromJson(github.event.inputs.plugins).sqm}}" >> $GITHUB_ENV 410 | echo "mentohust=${{fromJson(github.event.inputs.plugins).mentohust}}" >> $GITHUB_ENV 411 | echo "scutclient=${{fromJson(github.event.inputs.plugins).scutclient}}" >> $GITHUB_ENV 412 | echo "njitclient=${{fromJson(github.event.inputs.plugins).njitclient}}" >> $GITHUB_ENV 413 | echo "minieap=${{fromJson(github.event.inputs.plugins).minieap}}" >> $GITHUB_ENV 414 | echo "dogcom=${{fromJson(github.event.inputs.plugins).dogcom}}" >> $GITHUB_ENV 415 | - name: Custom config 416 | run: | 417 | cd $WORK_PATH/trunk 418 | if [ ! -f configs/templates/${{ env.model }}.config ] ; then 419 | echo "configs/templates/${{ env.model }}.config not found" 420 | exit 1 421 | fi 422 | cp -f configs/templates/${{ env.model }}.config .config 423 | ################################################################################################ 424 | #因不同型号配置功能不一样,所以先把配置项删除,如果你自己要添加其他的,也要写上删除这一条,切记!!! 425 | ################################################################################################ 426 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER/d' .config #删除配置项SOFTETHERVPN 427 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT/d' .config #删除配置项SOFTETHERVPN 428 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD/d' .config #删除配置项SOFTETHERVPN 429 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS/d' .config #删除配置项SS plus+ 430 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SSSERVER/d' .config #删除配置项SS server 431 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER/d' .config #删除配置项DNSFORWARDER 432 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ADBYBY/d' .config #删除配置项adbyby plus+ 433 | sed -i '/CONFIG_FIRMWARE_INCLUDE_TUNSAFE/d' .config #删除配置项tunsafe 434 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ALIDDNS/d' .config #删除配置项阿里DDNS 435 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' .config #删除配置项srelay 436 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME/d' .config #删除配置项adguardhome 437 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SMARTDNS/d' .config #删除配置项smartdns 438 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ZEROTIER/d' .config #删除配置项zerotier 439 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNSTO/d' .config #删除配置项ddnsto 440 | sed -i '/CONFIG_FIRMWARE_INCLUDE_WIREGUARD/d' .config #删除配置项wireguard 441 | sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPS/d' .config #删除配置项frp server 442 | sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPC/d' .config #删除配置项frp client 443 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ALDRIVER/d' .config #删除配置项阿里云盘 444 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SQM/d' .config #删除配置项QOS流控 445 | #校园网相关开始 446 | sed -i '/CONFIG_FIRMWARE_INCLUDE_MENTOHUST/d' .config #删除配置项MENTOHUST 447 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT/d' .config #删除配置项SCUTCLIENT 448 | sed -i '/CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT/d' .config 449 | sed -i '/CONFIG_FIRMWARE_INCLUDE_MINIEAP/d' .config 450 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DOGCOM/d' .config 451 | #校园网相关结束 452 | sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' .config 453 | ###################################################################### 454 | #以下选项是定义你需要的功能(y=集成,n=忽略),重新写入到.config文件 455 | ###################################################################### 456 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER=${{env.vpnsvr}}" >> .config #SOFTETHERVPN 457 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT=${{env.vpncli}}" >> .config #SOFTETHERVPN 458 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD=${{env.vpncmd}}" >> .config #SOFTETHERVPN 459 | #科学相关 460 | echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=${{env.ss}}" >> .config #SS plus+ 461 | echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=${{env.v2ray}}" >> .config #集成v2ray执行文件(3.8M左右) 462 | echo "CONFIG_FIRMWARE_INCLUDE_XRAY=${{env.xray}}" >> .config #集成xray执行文件(5.6M左右),可以代替v2ray,注:如果闪存太小不够还是建议使用v2ray 463 | echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=${{env.trojan}}" >> .config #集成trojan执行文件(1.1M左右) 464 | echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=${{env.ssobfs}}" >> .config # simple-obfs混淆插件 465 | echo "CONFIG_FIRMWARE_INCLUDE_SSSERVER=n" >> .config #SS server 466 | if [[ "${{ env.xray }}" == "y" && "${{ github.event.inputs.usexraymin }}" == "true" ]]; then 467 | sed -i 's/+= xray/+= xraymin/g' $WORK_PATH/trunk/user/Makefile 468 | fi 469 | # 470 | echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> .config #可以不集成 471 | echo "CONFIG_FIRMWARE_INCLUDE_TUNSAFE=n" >> .config #tunsafe 472 | echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=${{env.dnsforwarder}}" >> .config #dnsforwarder 473 | # 474 | echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=${{env.adbyby}}" >> .config #adbyby plus+ 475 | # 476 | echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=${{env.adguardhome}}" >> .config #adguardhome 477 | echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=${{env.smartdns}}" >> .config #smartdns 478 | # 479 | echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=${{env.aliddns}}" >> .config #阿里DDNS 480 | echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=${{env.zerotier}}" >> .config #zerotier ~1.3M 481 | echo "CONFIG_FIRMWARE_INCLUDE_DDNSTO=${{env.ddnsto}}" >> .config #ddnsto 482 | echo "CONFIG_FIRMWARE_INCLUDE_WIREGUARD=${{env.wireguard}}" >> .config #wireguard 483 | echo "CONFIG_FIRMWARE_INCLUDE_FRPS=n" >> .config #frp server 484 | echo "CONFIG_FIRMWARE_INCLUDE_FRPC=${{env.frpc}}" >> .config #frp client 485 | # 486 | echo "CONFIG_FIRMWARE_INCLUDE_ALDRIVER=${{env.aldrive}}" >> .config #阿里云盘 487 | echo "CONFIG_FIRMWARE_INCLUDE_SQM=${{env.sqm}}" >> .config #QOS流控 488 | # 489 | #校园网相关开始 490 | echo "CONFIG_FIRMWARE_INCLUDE_MENTOHUST=${{env.mentohust}}" >> .config #MENTOHUST 491 | echo "CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT=${{env.scutclient}}" >> .config #SCUTCLIENT 492 | echo "CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT=${{env.njitclient}}" >> .config 493 | echo "CONFIG_FIRMWARE_INCLUDE_MINIEAP=${{env.minieap}}" >> .config 494 | echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=${{env.dogcom}}" >> .config 495 | #校园网相关结束 496 | ######################################################################################### 497 | #自定义添加其它功能请参考源码configs/templates/目录下的config文件。按照上面的格式添加即可 498 | #格式如下: 499 | #sed -i '/自定义项/d' .config 500 | #echo "自定义项=y" >> .config 501 | sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${{ github.event.inputs.firmwarever }}/g" ./versions.inc 502 | echo '更新版本号时间' 503 | ######################################################################################### 504 | - name: Build firmware 505 | run: | 506 | cd $WORK_PATH 507 | sudo make ${{ env.model }} 508 | echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV 509 | - name: Organize firmware files 510 | id: organize 511 | run: | 512 | rainbow_Prefix="" 513 | if [ "${{ env.rainbowui }}" = "y" ]; then 514 | rainbow_Prefix="rainbow_" 515 | fi 516 | mkdir -p $FIRMWARE_PATH/ 517 | cd $WORK_PATH/trunk/images 518 | for firmwarefile in $(ls *.trx) 519 | do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"${{ env.model }}"_"${rainbow_Prefix}"kernal4.4.trx" 520 | done 521 | cd $FIRMWARE_PATH 522 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 523 | echo "STATUS=success" >> $GITHUB_ENV 524 | - name : Upload packages 525 | uses: actions/upload-artifact@main 526 | if: env.STATUS == 'success' 527 | with: 528 | name: Padavan44-packages 529 | path: ${{ env.FIRMWARE }} 530 | - name: Upload firmware to anonfiles 531 | if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true' 532 | run: | 533 | curl -fsSL git.io/file-transfer | sh 534 | ./transfer anon --no-progress ${FIRMWARE} 2>&1 | tee anonfile.log 535 | echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" 536 | - name: Remove obsolete firmwares on artifacts 537 | uses: Bonnie2980/gha-remove-artifacts@master 538 | if: env.STATUS == 'success' 539 | with: 540 | age: '1 day' 541 | skip-recent: 5 542 | -------------------------------------------------------------------------------- /.github/workflows/build_vb1980_kernal4.4_padavan_multi_targets.yml: -------------------------------------------------------------------------------- 1 | name: Build vb1980's kernal4.4 Padavan for multi targets 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | targets: 7 | description: 'targets to compile' 8 | required: true 9 | default: "['SIM-AX1800T','HAR-20S2U1','CR660x','JCG-Q20']" 10 | plugins: 11 | description: 'json format string of include configs' 12 | required: true 13 | default: '{"vpnsvr":"n","vpncli":"n","vpncmd":"n","ss":"n","v2ray":"n","xray":"n","trojan":"n","ssobfs":"n","dnsforwarder":"n","adbyby":"n","adguardhome":"n","smartdns":"n","aliddns":"n","zerotier":"n","ddnsto":"n","wireguard":"n","frpc":"y","aldrive":"n","sqm":"y","mentohust":"n","scutclient":"n","njitclient":"n","minieap":"n","dogcom":"n"}' 14 | usexraymin: 15 | type: boolean 16 | description: 'use streamlined xray' 17 | default: false 18 | customization: 19 | description: 'json format string of customized configs' 20 | required: true 21 | default: '{"rainbowui":"y","specializedlogo":"n","changebrandlogo":"n","lanip":"192.168.2.1","signaccount":"admin","signpassword":"admin","wifi2gssid":"","wifi5gssid":"","wifi2gpsk":"","wifi5gpsk":""}' 22 | firmwarever: 23 | description: 'firmware''s version' 24 | required: true 25 | default: '20240410' 26 | env: 27 | REPOSITORY_URL: https://github.com/vb1980/padavan-4.4.git 28 | WORK_PATH: /opt/padavan-4.4 29 | DEFAULT_FILE: ./user/shared/defaults.h 30 | DICT_FILE: ./user/www/dict/CN.dict 31 | TIME_ZONE: Asia/Shanghai 32 | FIRMWARE_DATEPREFIX: $(date +"%Y%m%d") 33 | FIRMWARE_AUTHOR: vb1980 34 | FIRMWARE_PATH: /opt/firmwares 35 | jobs: 36 | build: 37 | runs-on: ubuntu-latest 38 | if: github.event.repository.owner.id == github.event.sender.id 39 | 40 | strategy: 41 | fail-fast: false 42 | matrix: 43 | target: ${{ fromJSON(github.event.inputs.targets) }} 44 | 45 | steps: 46 | - uses: actions/checkout@v4 47 | - uses: hendrikmuhs/ccache-action@v1.2.12 48 | with: 49 | key: ${{ matrix.target }} 50 | append-timestamp: false 51 | 52 | - uses: actions/setup-go@v5 53 | with: 54 | go-version: '1.23.0' 55 | check-latest: true 56 | cache-dependency-path: '**/go.sum' 57 | 58 | - name: Initialization environment 59 | env: 60 | DEBIAN_FRONTEND: noninteractive 61 | run: | 62 | sudo apt-get update 63 | sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \ 64 | fakeroot kmod cpio git python3-docutils gettext automake autopoint \ 65 | texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \ 66 | libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin libev-dev ccache \ 67 | libssl-dev liblzo2-dev libpam0g-dev 68 | sudo timedatectl set-timezone "$TIME_ZONE" 69 | - name: Clone source code 70 | run: | 71 | git clone --depth=1 $REPOSITORY_URL $WORK_PATH 72 | cd $WORK_PATH 73 | sed -i '/cp -f/d' Makefile 74 | - name: Extract toolchain 75 | run: | 76 | cp -f toolchain/mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz $WORK_PATH 77 | cd $WORK_PATH 78 | mkdir -p toolchain-mipsel/toolchain-4.4.x 79 | tar -Jxvf mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz -C toolchain-mipsel/toolchain-4.4.x 80 | - name: Parse json string of customization configs 81 | run: | 82 | echo "rainbowui=${{fromJson(github.event.inputs.customization).rainbowui}}" >> $GITHUB_ENV 83 | echo "specializedlogo=${{fromJson(github.event.inputs.customization).specializedlogo}}" >> $GITHUB_ENV 84 | echo "changebrandlogo=${{fromJson(github.event.inputs.customization).changebrandlogo}}" >> $GITHUB_ENV 85 | echo "lanip=${{fromJson(github.event.inputs.customization).lanip}}" >> $GITHUB_ENV 86 | echo "signaccount=${{fromJson(github.event.inputs.customization).signaccount}}" >> $GITHUB_ENV 87 | echo "signpassword=${{fromJson(github.event.inputs.customization).signpassword}}" >> $GITHUB_ENV 88 | echo "wifi2gssid=${{fromJson(github.event.inputs.customization).wifi2gssid}}" >> $GITHUB_ENV 89 | echo "wifi5gssid=${{fromJson(github.event.inputs.customization).wifi5gssid}}" >> $GITHUB_ENV 90 | echo "wifi2gpsk=${{fromJson(github.event.inputs.customization).wifi2gpsk}}" >> $GITHUB_ENV 91 | echo "wifi5gpsk=${{fromJson(github.event.inputs.customization).wifi5gpsk}}" >> $GITHUB_ENV 92 | - name: Customization 93 | run: | 94 | cp -f bashScripts/setlanip.sh $WORK_PATH/trunk 95 | cp -f bashScripts/setaccount.sh $WORK_PATH/trunk 96 | cp -f bashScripts/setwifi.sh $WORK_PATH/trunk 97 | cd $WORK_PATH/trunk 98 | sudo chmod +x setlanip.sh 99 | sudo chmod +x setaccount.sh 100 | sudo chmod +x setwifi.sh 101 | if [ "${{ env.rainbowui }}" = "true" ]; then 102 | bash ./setlanip.sh ${{ env.DEFAULT_FILE }} ./user/www/n56u_rainbow/Restarting.asp ${{ env.DICT_FILE }} ${{ env.lanip }} 103 | else 104 | bash ./setlanip.sh ${{ env.DEFAULT_FILE }} ./user/www/n56u_ribbon_fixed/Restarting.asp ${{ env.DICT_FILE }} ${{ env.lanip }} 105 | fi 106 | bash ./setaccount.sh ${{ env.signaccount }} ${{ env.signpassword }} ${{ env.DEFAULT_FILE }} 107 | bash ./setwifi.sh ${{ env.wifi2gssid }} ${{ env.wifi5gssid }} ${{ env.wifi2gpsk }} ${{ env.wifi5gpsk }} ${{ env.DEFAULT_FILE }} 108 | - name: Apply rainbow themes 109 | if: env.rainbowui == 'y' 110 | run: | 111 | cd $WORK_PATH/trunk/user/httpd 112 | git apply formlogin.patch 113 | cd $WORK_PATH/trunk/user/www 114 | sed -i "s/WEBUI_NAME=n56u_ribbon_fixed/WEBUI_NAME=n56u_rainbow/g" ./Makefile 115 | - name: Apply specialized logo 116 | if: env.specializedlogo == 'y' 117 | run: | 118 | logoFile= 119 | if [ "${{ matrix.target }}" = "BELL-A040WQ" ]; then 120 | logoFile="a040wq/bell_asus_logo.png" 121 | fi 122 | if [ "${{ matrix.target }}" = "ZTE-E8820S" ]; then 123 | logoFile="e8820s/zte_asus_logo.png" 124 | fi 125 | if [ "${{ matrix.target }}" = "MSG1500" ]; then 126 | logoFile="msg1500/raisecom_asus_logo.png" 127 | fi 128 | if [ -n "$logoFile" ]; then 129 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_ribbon_fixed/bootstrap/img/asus_logo.png 130 | if [ "${{ env.rainbowui }}" = "y" ]; then 131 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_blue.png 132 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_cyan.png 133 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_green.png 134 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_orange.png 135 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_purple.png 136 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_red.png 137 | cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_yellow.png 138 | fi 139 | fi 140 | - name: Change specialized brand logo image 141 | if: env.changebrandlogo == 'y' && env.specializedlogo == 'n' 142 | run: | 143 | cd $WORK_PATH/trunk 144 | if [ "${{ env.rainbowui }}" = "y" ]; then 145 | sudo ./change_logo.sh ${{ matrix.target }} 0 146 | else 147 | sudo ./change_logo.sh ${{ matrix.target }} 148 | fi 149 | - name: Parse json string of include plugins 150 | run: | 151 | echo "vpnsvr=${{fromJson(github.event.inputs.plugins).vpnsvr}}" >> $GITHUB_ENV 152 | echo "vpncli=${{fromJson(github.event.inputs.plugins).vpncli}}" >> $GITHUB_ENV 153 | echo "vpncmd=${{fromJson(github.event.inputs.plugins).vpncmd}}" >> $GITHUB_ENV 154 | echo "ss=${{fromJson(github.event.inputs.plugins).ss}}" >> $GITHUB_ENV 155 | echo "v2ray=${{fromJson(github.event.inputs.plugins).v2ray}}" >> $GITHUB_ENV 156 | echo "xray=${{fromJson(github.event.inputs.plugins).xray}}" >> $GITHUB_ENV 157 | echo "trojan=${{fromJson(github.event.inputs.plugins).trojan}}" >> $GITHUB_ENV 158 | echo "ssobfs=${{fromJson(github.event.inputs.plugins).ssobfs}}" >> $GITHUB_ENV 159 | echo "dnsforwarder=${{fromJson(github.event.inputs.plugins).dnsforwarder}}" >> $GITHUB_ENV 160 | echo "adbyby=${{fromJson(github.event.inputs.plugins).adbyby}}" >> $GITHUB_ENV 161 | echo "adguardhome=${{fromJson(github.event.inputs.plugins).adguardhome}}" >> $GITHUB_ENV 162 | echo "smartdns=${{fromJson(github.event.inputs.plugins).smartdns}}" >> $GITHUB_ENV 163 | echo "aliddns=${{fromJson(github.event.inputs.plugins).aliddns}}" >> $GITHUB_ENV 164 | echo "zerotier=${{fromJson(github.event.inputs.plugins).zerotier}}" >> $GITHUB_ENV 165 | echo "ddnsto=${{fromJson(github.event.inputs.plugins).ddnsto}}" >> $GITHUB_ENV 166 | echo "wireguard=${{fromJson(github.event.inputs.plugins).wireguard}}" >> $GITHUB_ENV 167 | echo "frpc=${{fromJson(github.event.inputs.plugins).frpc}}" >> $GITHUB_ENV 168 | echo "aldrive=${{fromJson(github.event.inputs.plugins).aldrive}}" >> $GITHUB_ENV 169 | echo "sqm=${{fromJson(github.event.inputs.plugins).sqm}}" >> $GITHUB_ENV 170 | echo "mentohust=${{fromJson(github.event.inputs.plugins).mentohust}}" >> $GITHUB_ENV 171 | echo "scutclient=${{fromJson(github.event.inputs.plugins).scutclient}}" >> $GITHUB_ENV 172 | echo "njitclient=${{fromJson(github.event.inputs.plugins).njitclient}}" >> $GITHUB_ENV 173 | echo "minieap=${{fromJson(github.event.inputs.plugins).minieap}}" >> $GITHUB_ENV 174 | echo "dogcom=${{fromJson(github.event.inputs.plugins).dogcom}}" >> $GITHUB_ENV 175 | - name: Custom config 176 | run: | 177 | cd $WORK_PATH/trunk 178 | if [ ! -f configs/templates/${{ matrix.target }}.config ] ; then 179 | echo "configs/templates/${{ matrix.target }}.config not found" 180 | exit 1 181 | fi 182 | cp -f configs/templates/${{ matrix.target }}.config .config 183 | ################################################################################################ 184 | #因不同型号配置功能不一样,所以先把配置项删除,如果你自己要添加其他的,也要写上删除这一条,切记!!! 185 | ################################################################################################ 186 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER/d' .config #删除配置项SOFTETHERVPN 187 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT/d' .config #删除配置项SOFTETHERVPN 188 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD/d' .config #删除配置项SOFTETHERVPN 189 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS/d' .config #删除配置项SS plus+ 190 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SSSERVER/d' .config #删除配置项SS server 191 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER/d' .config #删除配置项DNSFORWARDER 192 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ADBYBY/d' .config #删除配置项adbyby plus+ 193 | sed -i '/CONFIG_FIRMWARE_INCLUDE_TUNSAFE/d' .config #删除配置项tunsafe 194 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ALIDDNS/d' .config #删除配置项阿里DDNS 195 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' .config #删除配置项srelay 196 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME/d' .config #删除配置项adguardhome 197 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SMARTDNS/d' .config #删除配置项smartdns 198 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ZEROTIER/d' .config #删除配置项zerotier 199 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNSTO/d' .config #删除配置项ddnsto 200 | sed -i '/CONFIG_FIRMWARE_INCLUDE_WIREGUARD/d' .config #删除配置项wireguard 201 | sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPS/d' .config #删除配置项frp server 202 | sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPC/d' .config #删除配置项frp client 203 | sed -i '/CONFIG_FIRMWARE_INCLUDE_ALDRIVER/d' .config #删除配置项阿里云盘 204 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SQM/d' .config #删除配置项QOS流控 205 | #校园网相关开始 206 | sed -i '/CONFIG_FIRMWARE_INCLUDE_MENTOHUST/d' .config #删除配置项MENTOHUST 207 | sed -i '/CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT/d' .config #删除配置项SCUTCLIENT 208 | sed -i '/CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT/d' .config 209 | sed -i '/CONFIG_FIRMWARE_INCLUDE_MINIEAP/d' .config 210 | sed -i '/CONFIG_FIRMWARE_INCLUDE_DOGCOM/d' .config 211 | #校园网相关结束 212 | sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' .config 213 | ###################################################################### 214 | #以下选项是定义你需要的功能(y=集成,n=忽略),重新写入到.config文件 215 | ###################################################################### 216 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER=${{env.vpnsvr}}" >> .config #SOFTETHERVPN 217 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT=${{env.vpncli}}" >> .config #SOFTETHERVPN 218 | echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD=${{env.vpncmd}}" >> .config #SOFTETHERVPN 219 | #科学相关 220 | echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=${{env.ss}}" >> .config #SS plus+ 221 | echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=${{env.v2ray}}" >> .config #集成v2ray执行文件(3.8M左右) 222 | echo "CONFIG_FIRMWARE_INCLUDE_XRAY=${{env.xray}}" >> .config #集成xray执行文件(5.6M左右),可以代替v2ray,注:如果闪存太小不够还是建议使用v2ray 223 | echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=${{env.trojan}}" >> .config #集成trojan执行文件(1.1M左右) 224 | echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=${{env.ssobfs}}" >> .config # simple-obfs混淆插件 225 | echo "CONFIG_FIRMWARE_INCLUDE_SSSERVER=n" >> .config #SS server 226 | if [[ "${{env.xray}}" == "y" && "${{ github.event.inputs.usexraymin }}" == "true" ]]; then 227 | sed -i 's/+= xray/+= xraymin/g' ./user/Makefile 228 | fi 229 | # 230 | echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> .config #可以不集成 231 | echo "CONFIG_FIRMWARE_INCLUDE_TUNSAFE=n" >> .config #tunsafe 232 | echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=${{env.dnsforwarder}}" >> .config #dnsforwarder 233 | # 234 | echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=${{env.adbyby}}" >> .config #adbyby plus+ 235 | # 236 | echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=${{env.adguardhome}}" >> .config #adguardhome 237 | echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=${{env.smartdns}}" >> .config #smartdns 238 | # 239 | echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=${{env.aliddns}}" >> .config #阿里DDNS 240 | echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=${{env.zerotier}}" >> .config #zerotier ~1.3M 241 | echo "CONFIG_FIRMWARE_INCLUDE_DDNSTO=${{env.ddnsto}}" >> .config #ddnsto 242 | echo "CONFIG_FIRMWARE_INCLUDE_WIREGUARD=${{env.wireguard}}" >> .config #wireguard 243 | echo "CONFIG_FIRMWARE_INCLUDE_FRPS=n" >> .config #frp server 244 | echo "CONFIG_FIRMWARE_INCLUDE_FRPC=${{env.frpc}}" >> .config #frp client 245 | # 246 | echo "CONFIG_FIRMWARE_INCLUDE_ALDRIVER=${{env.aldrive}}" >> .config #阿里云盘 247 | echo "CONFIG_FIRMWARE_INCLUDE_SQM=${{env.sqm}}" >> .config #QOS流控 248 | # 249 | #校园网相关开始 250 | echo "CONFIG_FIRMWARE_INCLUDE_MENTOHUST=${{env.mentohust}}" >> .config #MENTOHUST 251 | echo "CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT=${{env.scutclient}}" >> .config #SCUTCLIENT 252 | echo "CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT=${{env.njitclient}}" >> .config 253 | echo "CONFIG_FIRMWARE_INCLUDE_MINIEAP=${{env.minieap}}" >> .config 254 | echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=${{env.dogcom}}" >> .config 255 | #校园网相关结束 256 | ######################################################################################### 257 | #自定义添加其它功能请参考源码configs/templates/目录下的config文件。按照上面的格式添加即可 258 | #格式如下: 259 | #sed -i '/自定义项/d' .config 260 | #echo "自定义项=y" >> .config 261 | sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${{ github.event.inputs.firmwarever }}/g" ./versions.inc 262 | echo '更新版本号时间' 263 | ######################################################################################### 264 | - name: Build firmware 265 | run: | 266 | cd $WORK_PATH 267 | sudo make ${{ matrix.target }} 268 | echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV 269 | - name: Organize firmware files 270 | id: organize 271 | run: | 272 | rainbow_Prefix="" 273 | if [ "${{ env.rainbowui }}" = "y" ]; then 274 | rainbow_Prefix="rainbow_" 275 | fi 276 | mkdir -p $FIRMWARE_PATH/ 277 | cd $WORK_PATH/trunk/images 278 | for firmwarefile in $(ls *.trx) 279 | do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"${{ matrix.target }}"_"${rainbow_Prefix}"kernal4.4.trx" 280 | done 281 | cd $FIRMWARE_PATH 282 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 283 | echo "STATUS=success" >> $GITHUB_ENV 284 | - name : Upload packages 285 | uses: actions/upload-artifact@main 286 | if: env.STATUS == 'success' 287 | with: 288 | name: Padavan44-packages 289 | path: ${{ env.FIRMWARE_PATH }}/*.trx 290 | - name: Remove obsolete firmwares on artifacts 291 | uses: Bonnie2980/gha-remove-artifacts@master 292 | if: env.STATUS == 'success' 293 | with: 294 | age: '1 day' 295 | skip-recent: 5 296 | -------------------------------------------------------------------------------- /.github/workflows/delete_legacy_workflow_runs.yml: -------------------------------------------------------------------------------- 1 | name: Delete legacy workflow runs 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | days: 6 | description: 'Number of days.' 7 | required: true 8 | default: 90 9 | minimum_runs: 10 | description: 'The minimum runs to keep for each workflow.' 11 | required: true 12 | default: 6 13 | 14 | jobs: 15 | del_runs: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Delete workflow runs 19 | uses: GitRML/delete-workflow-runs@main 20 | with: 21 | token: ${{ secrets.GITHUB_TOKEN }} 22 | repository: ${{ github.repository }} 23 | retain_days: ${{ github.event.inputs.days }} 24 | keep_minimum_runs: ${{ github.event.inputs.minimum_runs }} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Build Padavan firmwares through git action. 2 | 3 | - [[StartBuild](https://github.com/vb1980/Padavan_CI/actions?query=workflow%3A%22Build+Padavan%22)] 4 | -------------------------------------------------------------------------------- /a040wq/bell_asus_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vb1980/Padavan_CI/40adef3dda5b4167fd314fb4a17f3b49b85242d9/a040wq/bell_asus_logo.png -------------------------------------------------------------------------------- /bashScripts/asuswrt_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ROOTDIR=$(cd `dirname $0`; pwd) 3 | TOOLSDIR=$ROOTDIR/tools; 4 | GCCDIR=$ToolsDIR/buildroot-gcc463 5 | #if [ ! -d "brcm" ];then 6 | #echo "=================COPY-brcm=============================" 7 | #cp -f ROOTDIR/tools/brcm brcm 8 | #fi 9 | if [ ! -d "$GCCDIR" ];then 10 | echo "=================EXTRACT-buildroot-gcc463=================" 11 | cd $TOOLSDIR 12 | tar xjf buildroot-gcc463_32bits.tar.bz2 13 | fi 14 | if [ -h "/opt/brcm" ];then 15 | sudo rm -rf /opt/brcm 16 | fi 17 | if [ -h "/opt/buildroot-gcc463" ];then 18 | sudo rm -rf /opt/buildroot-gcc463 19 | fi 20 | if [ ! -h "/opt/brcm" ];then 21 | sudo ln -s $TOOLSDIR/brcm /opt/brcm 22 | fi 23 | if [ ! -h "/opt/buildroot-gcc463" ];then 24 | sudo ln -s $TOOLSDIR/buildroot-gcc463 /opt/buildroot-gcc463 25 | fi 26 | export PATH=/opt/brcm/hndtools-mipsel-linux/bin:$PATH 27 | export PATH=/opt/brcm/hndtools-mipsel-uclibc/bin:$PATH 28 | export PATH=/opt/buildroot-gcc463/bin:$PATH 29 | cd $ROOTDIR/release/src/router/libnfnetlink-1.0.1 30 | autoreconf -vfi 31 | cd $ROOTDIR/release/src-ra-5010 32 | make $1 33 | -------------------------------------------------------------------------------- /bashScripts/setaccount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | account=$1 3 | password=$2 4 | defaultfile=$3 5 | 6 | if [ -n "$account" ]; then 7 | sed -i "28s/\"admin\"/\"$account\"/g" $defaultfile 8 | fi 9 | if [ -n "$password" ]; then 10 | sed -i "47s/\"admin\"/\"$password\"/g" $defaultfile 11 | fi 12 | -------------------------------------------------------------------------------- /bashScripts/setlanip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | defaultfile=$1 3 | restartingfile=$2 4 | dicfile=$3 5 | lanip=$4 6 | oc1=${lanip%%.*} 7 | x=${lanip#*.*} 8 | oc2=${x%%.*} 9 | x=${x#*.*} 10 | oc3=${x%%.*} 11 | dhcpfrom=$oc1"."$oc2"."$oc3".100" 12 | dhcpto=$oc1"."$oc2"."$oc3".244" 13 | sed -i "s/\"192.168.2.1\"/\"$lanip\"/g" $defaultfile 14 | sed -i "s/\"192.168.2.100\"/\"$dhcpfrom\"/g" $defaultfile 15 | sed -i "s/\"192.168.2.244\"/\"$dhcpto\"/g" $defaultfile 16 | sed -i "s/192.168.2.1/$lanip/" $restartingfile 17 | sed -i "s/192.168.2.1/$lanip/" $dicfile 18 | -------------------------------------------------------------------------------- /bashScripts/setwifi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | wifi_2g_ssid=$1 3 | wifi_5g_ssid=$2 4 | wifi_2g_pwd=$3 5 | wifi_5g_pwd=$4 6 | defaultfile=$5 7 | 8 | if [ -n "$wifi_2g_ssid" ]; then 9 | sed -i "40s/BOARD_PID \"_%s\"/\"$wifi_2g_ssid\"/g" $defaultfile 10 | fi 11 | if [ -n "$wifi_5g_ssid" ]; then 12 | sed -i "41s/BOARD_PID \"_5G_%s\"/\"$wifi_5g_ssid\"/g" $defaultfile 13 | fi 14 | if [ -n "$wifi_2g_pwd" ]; then 15 | sed -i "44s/\"1234567890\"/\"$wifi_2g_pwd\"/g" $defaultfile 16 | fi 17 | if [ -n "$wifi_5g_pwd" ]; then 18 | sed -i "45s/\"1234567890\"/\"$wifi_5g_pwd\"/g" $defaultfile 19 | fi 20 | -------------------------------------------------------------------------------- /e8820s/zte_asus_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vb1980/Padavan_CI/40adef3dda5b4167fd314fb4a17f3b49b85242d9/e8820s/zte_asus_logo.png -------------------------------------------------------------------------------- /formlogin/Login.asp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Padavan登录 8 | 9 | 10 | 72 | 73 | 74 | 75 |
76 | Avatar Image 77 |

Padavan登录

78 |
79 | 80 | 81 | 82 | 83 | 84 |
85 | 86 |
87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /formlogin/Logout.asp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <#Web_Title#> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 30 | 31 | 32 |
33 |
34 |
35 |

<#logoutmessage#>

36 | 37 |
<#Not_authpage_login_again#>
38 |
39 |
40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /formlogin/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vb1980/Padavan_CI/40adef3dda5b4167fd314fb4a17f3b49b85242d9/formlogin/favicon.png -------------------------------------------------------------------------------- /formlogin/httpd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This program is free software; you can redistribute it and/or 3 | * modify it under the terms of the GNU General Public License as 4 | * published by the Free Software Foundation; either version 2 of 5 | * the License, or (at your option) any later version. 6 | * 7 | * This program is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | * GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License 13 | * along with this program; if not, write to the Free Software 14 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 15 | * MA 02111-1307 USA 16 | */ 17 | 18 | #define _GNU_SOURCE 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | 45 | #include "httpd.h" 46 | #include "common.h" 47 | 48 | #define LOGIN_TIMEOUT 30 49 | #define SERVER_NAME "httpd" 50 | #define SERVER_PORT 80 51 | #define SERVER_PORT_SSL 443 52 | #define PROTOCOL "HTTP/1.0" 53 | #define CACHE_AGE_VAL (30 * (24*60*60)) 54 | #define RFC1123FMT "%a, %d %b %Y %H:%M:%S GMT" 55 | #define MAX_LISTEN_BACKLOG 511 56 | #define MAX_CONN_ACCEPT 50 57 | #define MAX_CONN_TIMEOUT 30 58 | #define MAX_AUTH_LEN 128 59 | 60 | /* A multi-family in_addr. */ 61 | typedef struct { 62 | union { 63 | struct in_addr in4; 64 | #if defined (USE_IPV6) 65 | struct in6_addr in6; 66 | #endif 67 | } addr; 68 | int family; 69 | int len; 70 | } uaddr; 71 | 72 | /* A multi-family sockaddr. */ 73 | typedef union { 74 | struct sockaddr sa; 75 | struct sockaddr_in sa_in; 76 | #if defined (USE_IPV6) 77 | struct sockaddr_in6 sa_in6; 78 | #endif 79 | } usockaddr; 80 | 81 | typedef struct conn_item { 82 | TAILQ_ENTRY(conn_item) entry; 83 | int fd; 84 | #if defined (SUPPORT_HTTPS) 85 | int ssl; 86 | #endif 87 | usockaddr usa; 88 | } conn_item_t; 89 | 90 | typedef struct conn_list { 91 | TAILQ_HEAD(, conn_item) head; 92 | int count; 93 | } conn_list_t; 94 | 95 | enum { 96 | HTTP_METHOD_GET = 0, 97 | HTTP_METHOD_HEAD, 98 | HTTP_METHOD_POST 99 | }; 100 | 101 | /* Globals. */ 102 | char log_header[32] = {0}; 103 | int auth_nvram_changed = 0; 104 | int debug_mode = 0; 105 | #if defined (SUPPORT_HTTPS) 106 | int http_is_ssl = 0; 107 | #endif 108 | 109 | static int daemon_exit = 0; 110 | static int http_has_lang = 0; 111 | static int http_acl_mode = 0; 112 | static int login_safe = 0; // the login from LAN/VPN 113 | static time_t login_timestamp = 0; // the timestamp of the logined ip 114 | static uaddr login_ip; // the logined ip 115 | static char login_mac[18] = {0}; // the logined mac 116 | static char auth_basic_data[MAX_AUTH_LEN]; 117 | 118 | #if defined (USE_IPV6) 119 | static const struct in6_addr in6in4addr_loopback = {{{0x00, 0x00, 0x00, 0x00, 120 | 0x00, 0x00, 0x00, 0x00, 121 | 0x00, 0x00, 0xff, 0xff, 122 | 0x7f, 0x00, 0x00, 0x01}}}; 123 | #endif 124 | 125 | kw_t kw_EN = {0, 0, {0, 0, 0, 0}, NULL, NULL}; 126 | kw_t kw_XX = {0, 0, {0, 0, 0, 0}, NULL, NULL}; 127 | 128 | const int int_1 = 1; 129 | 130 | const struct language_table language_tables[] = { 131 | {"en-us", "EN"}, 132 | {"en", "EN"}, 133 | {"ru-ru", "RU"}, 134 | {"ru", "RU"}, 135 | {"uk-UA", "UK"}, 136 | {"uk", "UK"}, 137 | {"fr", "FR"}, 138 | {"fr-fr", "FR"}, 139 | {"de-at", "DE"}, 140 | {"de-li", "DE"}, 141 | {"de-lu", "DE"}, 142 | {"de-de", "DE"}, 143 | {"de-ch", "DE"}, 144 | {"de", "DE"}, 145 | {"cs-cz", "CZ"}, 146 | {"cs", "CZ"}, 147 | {"pl-pl", "PL"}, 148 | {"pl", "PL"}, 149 | {"zh-tw", "TW"}, 150 | {"zh", "TW"}, 151 | {"zh-hk", "CN"}, 152 | {"zh-cn", "CN"}, 153 | {"ms", "MS"}, 154 | {"th", "TH"}, 155 | {"th-TH", "TH"}, 156 | {"th-TH-TH", "TH"}, 157 | {"tr", "TR"}, 158 | {"tr-TR", "TR"}, 159 | {"da", "DA"}, 160 | {"da-DK", "DA"}, 161 | {"fi", "FI"}, 162 | {"fi-FI", "FI"}, 163 | {"no", "NO"}, 164 | {"nb-NO", "NO"}, 165 | {"nn-NO", "NO"}, 166 | {"sv", "SV"}, 167 | {"sv-FI", "SV"}, 168 | {"sv-SE", "SV"}, 169 | {"br", "BR"}, 170 | {"pt-BR", "BR"}, 171 | {"ja", "JP"}, 172 | {"ja-JP", "JP"}, 173 | {NULL, NULL} 174 | }; 175 | 176 | long 177 | uptime(void) 178 | { 179 | struct sysinfo info; 180 | sysinfo(&info); 181 | 182 | return info.uptime; 183 | } 184 | 185 | static int 186 | is_uaddr_equal(const uaddr *ip1, const uaddr *ip2) 187 | { 188 | if ((ip1->len > 0) && (ip1->len == ip2->len) && (memcmp(&ip1->addr, &ip2->addr, ip1->len) == 0)) 189 | return 1; 190 | 191 | return 0; 192 | } 193 | 194 | static int 195 | is_uaddr_localhost(const uaddr *ip) 196 | { 197 | if ( 198 | #if defined (USE_IPV6) 199 | ((ip->family == AF_INET6) && 200 | ((memcmp(&ip->addr.in6, &in6addr_loopback, sizeof(struct in6_addr)) == 0) || 201 | (memcmp(&ip->addr.in6, &in6in4addr_loopback, sizeof(struct in6_addr)) == 0))) || 202 | ((ip->family == AF_INET) && (ip->addr.in4.s_addr == 0x100007f)) 203 | #else 204 | (ip->addr.in4.s_addr == 0x100007f) 205 | #endif 206 | ) 207 | return 1; 208 | 209 | return 0; 210 | } 211 | 212 | static void 213 | usockaddr_to_uaddr(const usockaddr *usa, uaddr *ip) 214 | { 215 | ip->family = usa->sa.sa_family; 216 | 217 | #if defined (USE_IPV6) 218 | if (ip->family == AF_INET6) { 219 | ip->len = sizeof(struct in6_addr); 220 | memcpy(&ip->addr.in6, &usa->sa_in6.sin6_addr, ip->len); 221 | } else 222 | #endif 223 | { 224 | ip->len = sizeof(struct in_addr); 225 | ip->addr.in4.s_addr = usa->sa_in.sin_addr.s_addr; 226 | } 227 | } 228 | 229 | static int 230 | convert_ip_to_string(const uaddr *ip, char *p_out_ip, size_t out_ip_len) 231 | { 232 | #if defined (USE_IPV6) 233 | char s_addr[INET6_ADDRSTRLEN]; 234 | #else 235 | char s_addr[INET_ADDRSTRLEN]; 236 | #endif 237 | char *p_addr = s_addr; 238 | 239 | if (ip->len < 1 || !inet_ntop(ip->family, &ip->addr, s_addr, sizeof(s_addr))) { 240 | p_out_ip[0] = 0; 241 | return -1; 242 | } 243 | 244 | #if defined (USE_IPV6) 245 | if (ip->family == AF_INET6 && strncmp(p_addr, "::ffff:", 7) == 0) 246 | p_addr += 7; 247 | #endif 248 | strncpy(p_out_ip, p_addr, out_ip_len); 249 | 250 | return 0; 251 | } 252 | 253 | static int 254 | find_mac_from_ip(const uaddr *ip, unsigned char *p_out_mac, int *p_out_lan) 255 | { 256 | FILE *fp; 257 | int result = -1; 258 | unsigned int arp_flags; 259 | char buffer[256], arp_mac[32], arp_if[32]; 260 | #if defined (USE_IPV6) 261 | char s_addr1[INET6_ADDRSTRLEN]; 262 | char s_addr2[INET6_ADDRSTRLEN]; 263 | #else 264 | char s_addr1[INET_ADDRSTRLEN]; 265 | char s_addr2[INET_ADDRSTRLEN]; 266 | #endif 267 | 268 | if (convert_ip_to_string(ip, s_addr1, sizeof(s_addr1)) < 0) 269 | return -1; 270 | 271 | if (!(*s_addr1)) 272 | return -1; 273 | 274 | fp = fopen("/proc/net/arp", "r"); 275 | if (fp) { 276 | // skip first line 277 | fgets(buffer, sizeof(buffer), fp); 278 | 279 | while (fgets(buffer, sizeof(buffer), fp)) { 280 | arp_flags = 0; 281 | if (sscanf(buffer, "%s %*s 0x%x %31s %*s %31s", s_addr2, &arp_flags, arp_mac, arp_if) == 4) { 282 | if ((arp_flags & 0x02) && !strcmp(s_addr1, s_addr2) && strcmp(arp_mac, "00:00:00:00:00:00")) { 283 | if (ether_atoe(arp_mac, p_out_mac)) { 284 | if (p_out_lan) 285 | *p_out_lan = (strcmp(arp_if, IFNAME_BR) == 0) ? 1 : 0; 286 | result = 0; 287 | } 288 | break; 289 | } 290 | } 291 | } 292 | 293 | fclose(fp); 294 | } 295 | 296 | return result; 297 | } 298 | 299 | static int 300 | is_http_client_allowed(const usockaddr *usa) 301 | { 302 | uaddr uip; 303 | int mac_in_sta_list, is_lan_client = 0; 304 | unsigned char mac[8] = {0}; 305 | 306 | if (http_acl_mode < 1) 307 | return 1; 308 | 309 | usockaddr_to_uaddr(usa, &uip); 310 | 311 | /* 1. get MAC from IP (allow if failed) */ 312 | if (find_mac_from_ip(&uip, mac, &is_lan_client) < 0) 313 | return 1; 314 | 315 | /* 2. do not check wireless sta list if client not from br0 */ 316 | if (!is_lan_client) 317 | return 1; 318 | 319 | /* 3. check MAC in AP client list */ 320 | mac_in_sta_list = is_mac_in_sta_list(mac); 321 | if (!mac_in_sta_list) 322 | return 1; 323 | 324 | if (http_acl_mode == 2) { 325 | /* LAN users + WiFi main AP users */ 326 | if (mac_in_sta_list == 1 || mac_in_sta_list == 3) 327 | return 1; 328 | } 329 | 330 | return 0; 331 | } 332 | 333 | static int 334 | is_safe_ifname(const char *ifname) 335 | { 336 | if (strcmp(ifname, IFNAME_BR) == 0) 337 | return 1; 338 | #if defined(APP_OPENVPN) 339 | if (strcmp(ifname, IFNAME_SERVER_TUN) == 0) 340 | return 1; 341 | #endif 342 | if (strncmp(ifname, "ppp", 3) == 0 && atoi(ifname+3) >= 10) 343 | return 1; 344 | return 0; 345 | } 346 | 347 | static int 348 | is_safe_ipaddr(const uaddr *ip) 349 | { 350 | int result = 0; 351 | struct ifaddrs *ifa, *ife; 352 | const struct in_addr *addr4, *mask4, *ip4 = NULL; 353 | #if defined (USE_IPV6) 354 | struct in_addr ip4_6; 355 | const struct in6_addr *addr6, *mask6, *ip6 = NULL; 356 | 357 | if (ip->family == AF_INET6) { 358 | ip6 = &ip->addr.in6; 359 | 360 | /* check IPv4-Mapped IPv6 Addresses */ 361 | if (IN6_IS_ADDR_V4MAPPED(ip6)) { 362 | ip4_6.s_addr = ip6->s6_addr32[3]; 363 | ip4 = &ip4_6; 364 | ip6 = NULL; 365 | } 366 | } else 367 | #endif 368 | if (ip->family == AF_INET) 369 | ip4 = &ip->addr.in4; 370 | else 371 | return 0; 372 | 373 | if (getifaddrs(&ifa) < 0) 374 | return 0; 375 | 376 | for (ife = ifa; ife; ife = ife->ifa_next) { 377 | if (!ife->ifa_addr) 378 | continue; 379 | if (!(ife->ifa_flags & IFF_UP)) 380 | continue; 381 | if (!ife->ifa_name) 382 | continue; 383 | if (!is_safe_ifname(ife->ifa_name)) 384 | continue; 385 | #if defined (USE_IPV6) 386 | if (ip6 && ife->ifa_addr->sa_family == AF_INET6) { 387 | addr6 = &((struct sockaddr_in6 *)ife->ifa_addr)->sin6_addr; 388 | mask6 = &((struct sockaddr_in6 *)ife->ifa_netmask)->sin6_addr; 389 | if (IN6_IS_ADDR_LINKLOCAL(addr6)) 390 | continue; 391 | 392 | if ((addr6->s6_addr32[0] & mask6->s6_addr32[0]) == (ip6->s6_addr32[0] & mask6->s6_addr32[0]) && 393 | (addr6->s6_addr32[1] & mask6->s6_addr32[1]) == (ip6->s6_addr32[1] & mask6->s6_addr32[1]) && 394 | (addr6->s6_addr32[2] & mask6->s6_addr32[2]) == (ip6->s6_addr32[2] & mask6->s6_addr32[2]) && 395 | (addr6->s6_addr32[3] & mask6->s6_addr32[3]) == (ip6->s6_addr32[3] & mask6->s6_addr32[3])) { 396 | result = 1; 397 | break; 398 | } 399 | } else 400 | #endif 401 | if (ip4 && ife->ifa_addr->sa_family == AF_INET) { 402 | if ((ife->ifa_flags & IFF_POINTOPOINT) && ife->ifa_dstaddr) 403 | addr4 = &((struct sockaddr_in *)ife->ifa_dstaddr)->sin_addr; 404 | else 405 | addr4 = &((struct sockaddr_in *)ife->ifa_addr)->sin_addr; 406 | mask4 = &((struct sockaddr_in *)ife->ifa_netmask)->sin_addr; 407 | if (mask4->s_addr == INADDR_ANY || addr4->s_addr == INADDR_BROADCAST) 408 | continue; 409 | 410 | if ((addr4->s_addr & mask4->s_addr) == (ip4->s_addr & mask4->s_addr)) { 411 | result = 1; 412 | break; 413 | } 414 | } 415 | } 416 | 417 | freeifaddrs(ifa); 418 | 419 | return result; 420 | } 421 | 422 | void 423 | fill_login_ip(char *p_out_ip, size_t out_ip_len) 424 | { 425 | convert_ip_to_string(&login_ip, p_out_ip, out_ip_len); 426 | } 427 | 428 | const char * 429 | get_login_mac(void) 430 | { 431 | return login_mac; 432 | } 433 | 434 | int 435 | get_login_safe(void) 436 | { 437 | if (login_ip.len == 0) 438 | return 0; 439 | 440 | #if defined (SUPPORT_HTTPS) 441 | if (http_is_ssl) 442 | return 1; 443 | #endif 444 | 445 | return login_safe; 446 | } 447 | 448 | static void 449 | http_login(const uaddr *ip_now) 450 | { 451 | char s_lts[32]; 452 | unsigned char mac[8] = {0}; 453 | 454 | memcpy(&login_ip, ip_now, sizeof(uaddr)); 455 | 456 | if (find_mac_from_ip(ip_now, mac, NULL) == 0) 457 | ether_etoa(mac, login_mac); 458 | else 459 | login_mac[0] = 0; 460 | 461 | if (!get_ap_mode()) 462 | login_safe = is_safe_ipaddr(ip_now); 463 | else 464 | login_safe = 1; 465 | 466 | login_timestamp = uptime(); 467 | 468 | sprintf(s_lts, "%lu", login_timestamp); 469 | nvram_set_temp("login_timestamp", s_lts); 470 | } 471 | 472 | static void 473 | load_nvram_auth(void) 474 | { 475 | char *pw_str; 476 | size_t pw_len, bs_len; 477 | 478 | memset(auth_basic_data, 0, sizeof(auth_basic_data)); 479 | snprintf(auth_basic_data, sizeof(auth_basic_data)-1, "%s:", nvram_safe_get("http_username")); 480 | 481 | bs_len = strlen(auth_basic_data); 482 | 483 | pw_str = nvram_safe_get("http_passwd"); 484 | pw_len = MIN(sizeof(auth_basic_data)-bs_len-1, strlen(pw_str)); 485 | strncpy(&auth_basic_data[bs_len], pw_str, pw_len); 486 | auth_basic_data[bs_len+pw_len] = '\0'; 487 | } 488 | 489 | static void 490 | reset_login_data(void) 491 | { 492 | // load new acl mode 493 | http_acl_mode = nvram_get_int("http_access"); 494 | http_has_lang = (strlen(nvram_safe_get("preferred_lang")) > 1) ? 1 : 0; 495 | 496 | memset(&login_ip, 0, sizeof(uaddr)); 497 | 498 | login_safe = 0; 499 | login_timestamp = 0; 500 | 501 | nvram_set_temp("login_timestamp", ""); 502 | 503 | if (auth_nvram_changed) { 504 | auth_nvram_changed = 0; 505 | load_nvram_auth(); 506 | } 507 | } 508 | 509 | static void 510 | http_logout(const uaddr *ip_now) 511 | { 512 | if (is_uaddr_equal(ip_now, &login_ip)) 513 | reset_login_data(); 514 | } 515 | 516 | 517 | /* 518 | * attempt login check, result 519 | * 0: can not login, has other loginer 520 | * 1: can login, this is localhost (always allow w/o auth) 521 | * 2: can login, no loginer 522 | * 3: can login, loginer is our 523 | */ 524 | static int 525 | http_login_check(const uaddr *ip_now) 526 | { 527 | if (is_uaddr_localhost(ip_now)) 528 | return 1; 529 | 530 | if (login_ip.len == 0) 531 | return 2; 532 | 533 | if (is_uaddr_equal(&login_ip, ip_now)) 534 | return 3; 535 | 536 | if ((unsigned long)(uptime() - login_timestamp) > LOGIN_TIMEOUT) { 537 | reset_login_data(); 538 | return 2; 539 | } 540 | 541 | return 0; 542 | } 543 | 544 | static int 545 | initialize_listen_socket(usockaddr* usaP, int http_port) 546 | { 547 | int listen_fd; 548 | int sa_family; 549 | 550 | sa_family = usaP->sa.sa_family; 551 | memset( usaP, 0, sizeof(usockaddr) ); 552 | #if defined (USE_IPV6) 553 | if (sa_family == AF_INET6) { 554 | usaP->sa.sa_family = AF_INET6; 555 | usaP->sa_in6.sin6_addr = in6addr_any; 556 | usaP->sa_in6.sin6_port = htons( http_port ); 557 | } else 558 | #endif 559 | { 560 | usaP->sa.sa_family = AF_INET; 561 | usaP->sa_in.sin_addr.s_addr = htonl( INADDR_ANY ); 562 | usaP->sa_in.sin_port = htons( http_port ); 563 | } 564 | 565 | listen_fd = socket( usaP->sa.sa_family, SOCK_STREAM, IPPROTO_TCP ); 566 | if ( listen_fd < 0 ) 567 | { 568 | perror( "socket" ); 569 | return -1; 570 | } 571 | 572 | fcntl( listen_fd, F_SETFD, FD_CLOEXEC ); 573 | 574 | if ( setsockopt( listen_fd, SOL_SOCKET, SO_REUSEADDR, &int_1, sizeof(int_1) ) < 0 ) 575 | { 576 | close(listen_fd); // 1104 chk 577 | perror( "setsockopt" ); 578 | return -1; 579 | } 580 | 581 | if ( bind( listen_fd, &usaP->sa, sizeof(usockaddr) ) < 0 ) 582 | { 583 | close(listen_fd); // 1104 chk 584 | perror( "bind" ); 585 | return -1; 586 | } 587 | 588 | if ( listen( listen_fd, MAX_LISTEN_BACKLOG ) < 0 ) 589 | { 590 | close(listen_fd); // 1104 chk 591 | perror( "listen" ); 592 | return -1; 593 | } 594 | 595 | return listen_fd; 596 | } 597 | 598 | static void 599 | send_headers( int status, const char *title, const char *extra_header, const char *mime_type, const struct stat *st, FILE *conn_fp ) 600 | { 601 | time_t now; 602 | char timebuf[64]; 603 | 604 | now = time(NULL); 605 | strftime( timebuf, sizeof(timebuf), RFC1123FMT, gmtime( &now ) ); 606 | 607 | fprintf( conn_fp, "%s %d %s\r\n", PROTOCOL, status, title ); 608 | fprintf( conn_fp, "Server: %s\r\n", SERVER_NAME ); 609 | fprintf( conn_fp, "Date: %s\r\n", timebuf ); 610 | if (extra_header) { 611 | fprintf( conn_fp, "%s\r\n", extra_header ); 612 | } else if (st) { 613 | now += CACHE_AGE_VAL; 614 | strftime( timebuf, sizeof(timebuf), RFC1123FMT, gmtime( &now ) ); 615 | fprintf( conn_fp, "Cache-Control: max-age=%u\r\n", CACHE_AGE_VAL ); 616 | fprintf( conn_fp, "Expires: %s\r\n", timebuf ); 617 | if (st->st_mtime != 0) { 618 | now = st->st_mtime; 619 | strftime( timebuf, sizeof(timebuf), RFC1123FMT, gmtime( &now ) ); 620 | fprintf( conn_fp, "Last-Modified: %s\r\n", timebuf ); 621 | } 622 | if (st->st_size > 0) 623 | fprintf( conn_fp, "Content-Length: %lu\r\n", st->st_size ); 624 | } 625 | if (mime_type) 626 | fprintf( conn_fp, "Content-Type: %s\r\n", mime_type ); 627 | fprintf( conn_fp, "Connection: close\r\n" ); 628 | fprintf( conn_fp, "\r\n" ); 629 | } 630 | 631 | static void 632 | send_error( int status, const char *title, const char *extra_header, const char *text, FILE *conn_fp ) 633 | { 634 | send_headers( status, title, extra_header, "text/html", NULL, conn_fp ); 635 | fprintf( conn_fp, "%d %s\n

%d %s

\n", status, title, status, title ); 636 | fprintf( conn_fp, "%s\n", text ); 637 | fprintf( conn_fp, "\n" ); 638 | fflush( conn_fp ); 639 | } 640 | 641 | static int 642 | auth_check( const char *authorization ) 643 | { 644 | char authinfo[256]; 645 | int auth_len; 646 | 647 | /* Basic authorization info? */ 648 | if (!authorization || strncmp(authorization, "Basic ", 6) != 0) 649 | return 0; 650 | 651 | /* Decode it. */ 652 | auth_len = b64_decode(authorization+6, authinfo, sizeof(authinfo)-1); 653 | authinfo[auth_len] = '\0'; 654 | 655 | /* Is this the right user and password? */ 656 | if (strcmp(authinfo, auth_basic_data) == 0) 657 | return 1; 658 | 659 | return 0; 660 | } 661 | 662 | static int 663 | match_one( const char *pattern, int patternlen, const char *string ) 664 | { 665 | const char* p; 666 | 667 | for ( p = pattern; p - pattern < patternlen; ++p, ++string ) { 668 | if ( *p == '?' && *string != '\0' ) 669 | continue; 670 | if ( *p == '*' ) { 671 | int i, pl; 672 | ++p; 673 | if ( *p == '*' ) { 674 | /* Double-wildcard matches anything. */ 675 | ++p; 676 | i = strlen( string ); 677 | } else { 678 | /* Single-wildcard matches anything but slash. */ 679 | i = strcspn( string, "/" ); 680 | } 681 | 682 | pl = patternlen - ( p - pattern ); 683 | for ( ; i >= 0; --i ) 684 | if ( match_one( p, pl, &(string[i]) ) ) 685 | return 1; 686 | return 0; 687 | } 688 | if ( *p != *string ) 689 | return 0; 690 | } 691 | 692 | if ( *string == '\0' ) 693 | return 1; 694 | 695 | return 0; 696 | } 697 | 698 | /* Simple shell-style filename matcher. Only does ? * and **, and multiple 699 | ** patterns separated by |. Returns 1 or 0. 700 | */ 701 | static int 702 | match( const char *pattern, const char *string ) 703 | { 704 | const char *or; 705 | 706 | for (;;) { 707 | or = strchr( pattern, '|' ); 708 | if ( or == (char*) 0 ) 709 | return match_one( pattern, strlen( pattern ), string ); 710 | if ( match_one( pattern, or - pattern, string ) ) 711 | return 1; 712 | pattern = or + 1; 713 | } 714 | } 715 | 716 | static void 717 | eat_post_data(FILE *conn_fp, int clen) 718 | { 719 | char fake_buf[128]; 720 | 721 | do_cgi_clear(); 722 | 723 | if (!fgets(fake_buf, MIN(clen+1, sizeof(fake_buf)), conn_fp)) 724 | return; 725 | 726 | clen -= strlen(fake_buf); 727 | while (clen--) 728 | fgetc(conn_fp); 729 | } 730 | 731 | static void 732 | try_pull_data(FILE *conn_fp, int conn_fd) 733 | { 734 | int flags = fcntl(conn_fd, F_GETFL); 735 | 736 | /* Read up to two more characters */ 737 | if (flags != -1 && fcntl(conn_fd, F_SETFL, flags | O_NONBLOCK) != -1) { 738 | if (fgetc(conn_fp) != EOF) 739 | fgetc(conn_fp); 740 | 741 | fcntl(conn_fd, F_SETFL, flags); 742 | } 743 | } 744 | 745 | int 746 | do_fwrite(const char *buffer, int len, FILE *stream) 747 | { 748 | int n = len; 749 | int r = 0; 750 | 751 | while (n > 0) { 752 | r = fwrite(buffer, 1, n, stream); 753 | if ((r == 0) && (errno != EINTR)) 754 | return -1; 755 | buffer += r; 756 | n -= r; 757 | } 758 | 759 | return r; 760 | } 761 | 762 | void 763 | do_file(const char *url, FILE *stream) 764 | { 765 | FILE *fp; 766 | char buf[1024]; 767 | int nr; 768 | 769 | if ((fp = fopen(url, "r")) != NULL) { 770 | while ((nr = fread(buf, 1, sizeof(buf), fp)) > 0) 771 | do_fwrite(buf, nr, stream); 772 | fclose(fp); 773 | } 774 | } 775 | 776 | static int 777 | set_preferred_lang(char *cur) 778 | { 779 | char *p, *p_lang; 780 | char lang_buf[64], lang_file[16]; 781 | const struct language_table *p_lt; 782 | 783 | memset(lang_buf, 0, sizeof(lang_buf)); 784 | strncpy(lang_buf, cur, sizeof(lang_buf)-1); 785 | 786 | p = lang_buf; 787 | p_lang = NULL; 788 | while (p != NULL) { 789 | p = strtok (p, "\r\n ,;"); 790 | if (p == NULL) 791 | break; 792 | 793 | for (p_lt = language_tables; p_lt->Lang != NULL; ++p_lt) { 794 | if (strcasecmp(p, p_lt->Lang)==0) { 795 | p_lang = p_lt->Target_Lang; 796 | break; 797 | } 798 | } 799 | 800 | if (p_lang) 801 | break; 802 | 803 | p+=strlen(p)+1; 804 | } 805 | 806 | if (p_lang) { 807 | snprintf(lang_file, sizeof(lang_file), "%s.dict", p_lang); 808 | if (f_exists(lang_file)) 809 | nvram_set("preferred_lang", p_lang); 810 | else 811 | nvram_set("preferred_lang", "EN"); 812 | 813 | return 1; 814 | } 815 | 816 | return 0; 817 | } 818 | 819 | static void 820 | handle_request(FILE *conn_fp, const conn_item_t *item) 821 | { 822 | char line[4096]; 823 | char *method, *path, *protocol, *authorization, *boundary; 824 | char *cur, *end, *cp, *file, *query; 825 | int len, login_state, method_id, do_logout, clen = 0; 826 | time_t if_modified_since = (time_t)-1; 827 | struct mime_handler *handler; 828 | struct stat st, *p_st = NULL; 829 | uaddr conn_ip; 830 | 831 | /* Initialize the request variables. */ 832 | authorization = boundary = NULL; 833 | 834 | /* Parse the first line of the request. */ 835 | if (!fgets(line, sizeof(line), conn_fp)) { 836 | send_error( 400, "Bad Request", NULL, "No request found.", conn_fp); 837 | return; 838 | } 839 | 840 | method = path = line; 841 | strsep(&path, " "); 842 | while (path && *path == ' ') path++; 843 | 844 | protocol = path; 845 | strsep(&protocol, " "); 846 | while (protocol && *protocol == ' ') protocol++; 847 | 848 | cp = protocol; 849 | strsep(&cp, " "); 850 | 851 | if ( !method || !path || !protocol ) { 852 | send_error( 400, "Bad Request", NULL, "Can't parse request.", conn_fp ); 853 | return; 854 | } 855 | 856 | cur = protocol + strlen(protocol) + 1; 857 | end = line + sizeof(line) - 1; 858 | 859 | while ( (cur < end) && (fgets(cur, line + sizeof(line) - cur, conn_fp)) ) { 860 | if ( strcmp( cur, "\n" ) == 0 || strcmp( cur, "\r\n" ) == 0 ) { 861 | break; 862 | } 863 | 864 | if (strncasecmp(cur, "Accept-Language:", 16) == 0) { 865 | if (!http_has_lang) 866 | http_has_lang = set_preferred_lang(cur + 16); 867 | } 868 | else if (strncasecmp( cur, "Authorization:", 14) == 0) { 869 | cp = cur + 14; 870 | cp += strspn( cp, " \t" ); 871 | authorization = cp; 872 | cur = cp + strlen(cp) + 1; 873 | } 874 | else if (strncasecmp( cur, "Content-Length:", 15) == 0) { 875 | cp = cur + 15; 876 | cp += strspn( cp, " \t" ); 877 | clen = strtoul( cp, NULL, 0 ); 878 | if ((clen < 0) || (clen > 50000000)) { 879 | send_error( 400, "Bad Request", NULL, "Content length invalid.", conn_fp); 880 | return; 881 | } 882 | } 883 | else if (strncasecmp( cur, "If-Modified-Since:", 18) == 0) { 884 | cp = cur + 18; 885 | cp += strspn( cp, " \t" ); 886 | if_modified_since = tdate_parse(cp); 887 | } 888 | else if ((cp = strstr( cur, "boundary=" ))) { 889 | boundary = cp + 9; 890 | for ( cp = cp + 9; *cp && *cp != '\r' && *cp != '\n'; cp++ ); 891 | *cp = '\0'; 892 | cur = ++cp; 893 | } 894 | } 895 | 896 | if (strcasecmp(method, "get") == 0) 897 | method_id = HTTP_METHOD_GET; 898 | else if (strcasecmp(method, "head") == 0) 899 | method_id = HTTP_METHOD_HEAD; 900 | else if (strcasecmp(method, "post") == 0) 901 | method_id = HTTP_METHOD_POST; 902 | else { 903 | send_error( 501, "Not Implemented", NULL, "Unsupported method.", conn_fp ); 904 | return; 905 | } 906 | 907 | if ( path[0] != '/' ) { 908 | send_error( 400, "Bad Request", NULL, "Bad URL.", conn_fp ); 909 | return; 910 | } 911 | 912 | file = path + 1; 913 | len = strlen(file); 914 | 915 | if (file[0] == '/' || strcmp(file, "..") == 0 || strncmp(file, "../", 3) == 0 || strstr(file, "/../") != NULL) { 916 | send_error( 400, "Bad Request", NULL, "Illegal URL.", conn_fp ); 917 | return; 918 | } 919 | 920 | if (len > 0 && file[len-1] == '/') { 921 | send_error( 400, "Bad Request", NULL, "Illegal URL.", conn_fp ); 922 | return; 923 | } 924 | 925 | if (len > 2 && strcmp(&(file[len-3]), "/.." ) == 0) { 926 | send_error( 400, "Bad Request", NULL, "Illegal URL.", conn_fp ); 927 | return; 928 | } 929 | 930 | if (len < 1) 931 | file = "index.asp"; 932 | 933 | query = file; 934 | strsep(&query, "?"); 935 | 936 | usockaddr_to_uaddr(&item->usa, &conn_ip); 937 | 938 | login_state = http_login_check(&conn_ip); 939 | 940 | if (login_state == 0) { 941 | if (strstr(file, ".htm") != NULL || strstr(file, ".asp") != NULL) { 942 | file = "Nologin.asp"; 943 | query = NULL; 944 | } 945 | } 946 | 947 | 948 | /* special case for reset browser credentials */ 949 | if (strcmp(file, "logout") == 0) { 950 | send_headers( 401, "Unauthorized", NULL, NULL, NULL, conn_fp ); 951 | return; 952 | } 953 | 954 | for (handler = mime_handlers; handler->pattern; handler++) { 955 | if (match(handler->pattern, file)) 956 | break; 957 | } 958 | 959 | if (!handler->pattern) { 960 | send_error( 404, "Not Found", NULL, "URL was not found.", conn_fp ); 961 | return; 962 | } 963 | 964 | #if defined (SUPPORT_HTTPS) 965 | http_is_ssl = item->ssl; 966 | #endif 967 | 968 | do_logout = (strcmp(file, "Logout.asp") == 0) ? 1 : 0; 969 | 970 | if (handler->need_auth && login_state > 1 && !do_logout) { 971 | /* 972 | 没登录需要验证 973 | */ 974 | if (login_state == 2){ 975 | if(auth_check(authorization)){ 976 | http_login(&conn_ip); 977 | send_headers( 200, "OK", NULL, NULL, NULL, conn_fp ); 978 | return; 979 | }else { 980 | http_logout(&conn_ip); 981 | if (method_id == HTTP_METHOD_POST) 982 | eat_post_data(conn_fp, clen); 983 | file = "Login.asp"; 984 | query = NULL; 985 | } 986 | 987 | } 988 | } 989 | 990 | if (method_id == HTTP_METHOD_POST) { 991 | if (handler->input) 992 | handler->input(file, conn_fp, clen, boundary); 993 | else 994 | eat_post_data(conn_fp, clen); 995 | try_pull_data(conn_fp, item->fd); 996 | } else { 997 | if (query) 998 | do_uncgi_query(query); 999 | else if (handler->output == do_ej) 1000 | do_cgi_clear(); 1001 | } 1002 | 1003 | if (handler->output == do_file) { 1004 | if (stat(file, &st) == 0 && !S_ISDIR(st.st_mode)) { 1005 | p_st = &st; 1006 | if (!handler->extra_header && if_modified_since != (time_t)-1 && if_modified_since == st.st_mtime) { 1007 | st.st_size = 0; /* not send Content-Length */ 1008 | send_headers( 304, "Not Modified", NULL, handler->mime_type, p_st, conn_fp ); 1009 | return; 1010 | } 1011 | } 1012 | } 1013 | 1014 | send_headers( 200, "OK", handler->extra_header, handler->mime_type, p_st, conn_fp ); 1015 | 1016 | if (method_id != HTTP_METHOD_HEAD) { 1017 | if (handler->output) 1018 | handler->output(file, conn_fp); 1019 | } 1020 | 1021 | if (do_logout) 1022 | http_logout(&conn_ip); 1023 | } 1024 | 1025 | static void 1026 | reset_lang_dict(void) 1027 | { 1028 | // reset last loaded XX.dict 1029 | memset(kw_XX.dict, 0, sizeof(kw_XX.dict)); 1030 | } 1031 | 1032 | static void 1033 | catch_sig(int sig) 1034 | { 1035 | if (sig == SIGTERM) 1036 | { 1037 | daemon_exit = 1; 1038 | httpd_log("Received %s, terminating.", "SIGTERM"); 1039 | } 1040 | else if (sig == SIGHUP) 1041 | { 1042 | reset_lang_dict(); 1043 | } 1044 | else if (sig == SIGUSR1) 1045 | { 1046 | reset_login_data(); 1047 | } 1048 | else if (sig == SIGUSR2) 1049 | { 1050 | ; 1051 | } 1052 | } 1053 | 1054 | int 1055 | main(int argc, char **argv) 1056 | { 1057 | FILE *pid_fp; 1058 | struct timeval tv; 1059 | fd_set active_rfds; 1060 | usockaddr usa[2]; 1061 | int listen_fd[2], http_port[2]; 1062 | int i, c, tmp, max_fd, cnt_fd, selected; 1063 | pid_t pid; 1064 | socklen_t sz; 1065 | conn_list_t pool; 1066 | conn_item_t *item, *next; 1067 | 1068 | snprintf(log_header, sizeof(log_header), "%s[%d]", SYSLOG_ID_HTTPD, getpid()); 1069 | 1070 | http_port[0] = 0; 1071 | http_port[1] = 0; 1072 | 1073 | // usage : httpd -p [port] -s [port] 1074 | if(argc) { 1075 | while ((c = getopt(argc, argv, "p:s:d")) != -1) { 1076 | switch (c) { 1077 | case 'p': 1078 | tmp = atoi(optarg); 1079 | if (tmp > 0 && tmp < 65536) 1080 | http_port[0] = tmp; 1081 | else 1082 | http_port[0] = SERVER_PORT; 1083 | break; 1084 | #if defined (SUPPORT_HTTPS) 1085 | case 's': 1086 | tmp = atoi(optarg); 1087 | if (tmp > 0 && tmp < 65536) 1088 | http_port[1] = tmp; 1089 | else 1090 | http_port[1] = SERVER_PORT_SSL; 1091 | break; 1092 | #endif 1093 | case 'd': 1094 | debug_mode = 1; 1095 | break; 1096 | } 1097 | } 1098 | } 1099 | 1100 | if (!http_port[0] && !http_port[1]) 1101 | http_port[0] = SERVER_PORT; 1102 | 1103 | #if defined (SUPPORT_HTTPS) 1104 | if (http_port[1] == http_port[0]) { 1105 | if (http_port[0] != SERVER_PORT_SSL) 1106 | http_port[1] = SERVER_PORT_SSL; 1107 | else 1108 | http_port[1] = 0; 1109 | } 1110 | 1111 | if (http_port[1]) { 1112 | char path_ca[64], path_crt[64], path_key[64], path_dhp[64]; 1113 | sprintf(path_ca, "%s/%s", STORAGE_HTTPSSL_DIR, "ca.crt"); 1114 | sprintf(path_crt, "%s/%s", STORAGE_HTTPSSL_DIR, "server.crt"); 1115 | sprintf(path_key, "%s/%s", STORAGE_HTTPSSL_DIR, "server.key"); 1116 | sprintf(path_dhp, "%s/%s", STORAGE_HTTPSSL_DIR, "dh1024.pem"); 1117 | if (ssl_server_init(path_ca, path_crt, path_key, path_dhp, nvram_get("https_clist")) != 0) { 1118 | http_port[1] = 0; 1119 | /* avoid httpd unload */ 1120 | if (!http_port[0]) 1121 | http_port[0] = SERVER_PORT; 1122 | if (nvram_get_int("http_proto") == 1) 1123 | nvram_set_int("http_proto", 0); 1124 | } 1125 | } 1126 | #endif 1127 | 1128 | #if defined (USE_IPV6) 1129 | usa[0].sa.sa_family = (get_ipv6_type() != IPV6_DISABLED) ? AF_INET6 : AF_INET; 1130 | usa[1].sa.sa_family = usa[0].sa.sa_family; 1131 | #endif 1132 | 1133 | listen_fd[0] = -1; 1134 | listen_fd[1] = -1; 1135 | 1136 | if (http_port[0]) { 1137 | if ((listen_fd[0] = initialize_listen_socket(&usa[0], http_port[0])) < 0) { 1138 | perror("bind"); 1139 | httpd_log("ERROR: can't bind listening port %d to any address!", http_port[0]); 1140 | http_port[0] = 0; 1141 | if (!http_port[1]) 1142 | exit(errno); 1143 | } 1144 | } 1145 | 1146 | #if defined (SUPPORT_HTTPS) 1147 | if (http_port[1]) { 1148 | if ((listen_fd[1] = initialize_listen_socket(&usa[1], http_port[1])) < 0) { 1149 | perror("bind"); 1150 | httpd_log("ERROR: can't bind listening port %d to any address!", http_port[1]); 1151 | if (listen_fd[0] < 0) { 1152 | ssl_server_uninit(); 1153 | exit(errno); 1154 | } 1155 | } 1156 | } 1157 | #endif 1158 | 1159 | signal(SIGPIPE, SIG_IGN); 1160 | signal(SIGHUP, catch_sig); 1161 | signal(SIGUSR1, catch_sig); 1162 | signal(SIGUSR2, catch_sig); 1163 | signal(SIGTERM, catch_sig); 1164 | 1165 | cnt_fd = (listen_fd[1] >= 0) ? 2 : 1; 1166 | 1167 | if (!debug_mode && daemon(1, 0) < 0) { 1168 | perror("daemon"); 1169 | for (i=0; i= 0) { 1171 | shutdown(listen_fd[i], SHUT_RDWR); 1172 | close(listen_fd[i]); 1173 | } 1174 | } 1175 | #if defined (SUPPORT_HTTPS) 1176 | if (http_port[1]) 1177 | ssl_server_uninit(); 1178 | #endif 1179 | exit(errno); 1180 | } 1181 | 1182 | pid = getpid(); 1183 | snprintf(log_header, sizeof(log_header), "%s[%d]", SYSLOG_ID_HTTPD, pid); 1184 | 1185 | if ((pid_fp = fopen("/var/run/httpd.pid", "w"))) { 1186 | fprintf(pid_fp, "%d", pid); 1187 | fclose(pid_fp); 1188 | } 1189 | 1190 | reset_login_data(); 1191 | load_nvram_auth(); 1192 | 1193 | chdir("/www"); 1194 | 1195 | FD_ZERO(&active_rfds); 1196 | TAILQ_INIT(&pool.head); 1197 | pool.count = 0; 1198 | sz = sizeof(usa); 1199 | 1200 | load_dictionary("EN", &kw_EN); 1201 | 1202 | if (http_port[0] && listen_fd[0] >= 0) 1203 | httpd_log("Server listening port %d (%s).", http_port[0], "HTTP"); 1204 | #if defined (SUPPORT_HTTPS) 1205 | if (http_port[1] && listen_fd[1] >= 0) 1206 | httpd_log("Server listening port %d (%s). %s.", http_port[1], "HTTPS", ssl_server_get_ssl_ver()); 1207 | #endif 1208 | 1209 | while (!daemon_exit) { 1210 | fd_set rfds; 1211 | 1212 | rfds = active_rfds; 1213 | max_fd = -1; 1214 | if (pool.count < MAX_CONN_ACCEPT) { 1215 | for (i=0; i= 0) { 1217 | FD_SET(listen_fd[i], &rfds); 1218 | max_fd = (listen_fd[i] > max_fd) ? listen_fd[i] : max_fd; 1219 | } 1220 | } 1221 | } 1222 | 1223 | TAILQ_FOREACH(item, &pool.head, entry) 1224 | max_fd = (item->fd > max_fd) ? item->fd : max_fd; 1225 | 1226 | /* wait for new connection or incoming request */ 1227 | tv.tv_sec = MAX_CONN_TIMEOUT; 1228 | tv.tv_usec = 0; 1229 | selected = select(max_fd + 1, &rfds, NULL, NULL, &tv); 1230 | if (selected < 0) { 1231 | if (errno == EINTR || errno == EAGAIN) 1232 | continue; 1233 | if (debug_mode) 1234 | perror("select"); 1235 | else 1236 | httpd_log("Failed to select open sockets (errno: %d). EXITING", errno); 1237 | break; 1238 | } 1239 | 1240 | /* check and accept new connection */ 1241 | if (selected) { 1242 | int is_accept = 0; 1243 | for (i=0; i= 0 && FD_ISSET(listen_fd[i], &rfds)) { 1245 | item = malloc(sizeof(*item)); 1246 | if (!item) 1247 | continue; 1248 | 1249 | item->fd = accept(listen_fd[i], &item->usa.sa, &sz); 1250 | if (item->fd >= 0) { 1251 | #if defined (SUPPORT_HTTPS) 1252 | item->ssl = (i > 0) ? 1 : 0; 1253 | #endif 1254 | if (is_http_client_allowed(&item->usa)) { 1255 | setsockopt(item->fd, SOL_SOCKET, SO_KEEPALIVE, &int_1, sizeof(int_1)); 1256 | FD_SET(item->fd, &active_rfds); 1257 | TAILQ_INSERT_TAIL(&pool.head, item, entry); 1258 | pool.count++; 1259 | is_accept++; 1260 | } else { 1261 | shutdown(item->fd, SHUT_RDWR); 1262 | close(item->fd); 1263 | free(item); 1264 | } 1265 | } else { 1266 | if (errno != EINTR && errno != EAGAIN) { 1267 | if (debug_mode) 1268 | perror("accept"); 1269 | } 1270 | free(item); 1271 | } 1272 | } 1273 | } 1274 | 1275 | /* Continue waiting */ 1276 | if (is_accept) 1277 | continue; 1278 | } 1279 | 1280 | /* Check and process pending or expired requests */ 1281 | TAILQ_FOREACH_SAFE(item, &pool.head, entry, next) { 1282 | if (selected && !FD_ISSET(item->fd, &rfds)) 1283 | continue; 1284 | 1285 | FD_CLR(item->fd, &active_rfds); 1286 | TAILQ_REMOVE(&pool.head, item, entry); 1287 | pool.count--; 1288 | 1289 | if (selected) { 1290 | FILE *conn_fp; 1291 | #if defined (SUPPORT_HTTPS) 1292 | if (item->ssl) 1293 | conn_fp = ssl_server_fopen(item->fd); 1294 | else 1295 | #endif 1296 | conn_fp = fdopen(item->fd, "r+"); 1297 | if (conn_fp) { 1298 | handle_request(conn_fp, item); 1299 | fflush(conn_fp); 1300 | #if defined (SUPPORT_HTTPS) 1301 | http_is_ssl = 0; 1302 | if (!item->ssl) 1303 | #endif 1304 | shutdown(item->fd, SHUT_RDWR); 1305 | fclose(conn_fp); 1306 | conn_fp = NULL; 1307 | item->fd = -1; 1308 | } 1309 | if (--selected == 0) 1310 | next = NULL; 1311 | } 1312 | 1313 | if (item->fd >= 0) { 1314 | shutdown(item->fd, SHUT_RDWR); 1315 | close(item->fd); 1316 | } 1317 | 1318 | free(item); 1319 | } 1320 | } 1321 | 1322 | /* free all pending requests */ 1323 | TAILQ_FOREACH_SAFE(item, &pool.head, entry, next) { 1324 | if (item->fd >= 0) { 1325 | shutdown(item->fd, SHUT_RDWR); 1326 | close(item->fd); 1327 | } 1328 | 1329 | free(item); 1330 | } 1331 | 1332 | for (i=0; i= 0) { 1334 | shutdown(listen_fd[i], SHUT_RDWR); 1335 | close(listen_fd[i]); 1336 | } 1337 | } 1338 | 1339 | #if defined (SUPPORT_HTTPS) 1340 | if (http_port[1]) 1341 | ssl_server_uninit(); 1342 | #endif 1343 | 1344 | init_cgi(NULL); 1345 | release_dictionary(&kw_XX); 1346 | release_dictionary(&kw_EN); 1347 | 1348 | return 0; 1349 | } 1350 | 1351 | -------------------------------------------------------------------------------- /formlogin/login.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | background-color: #f1f4f5; 5 | background-repeat: no-repeat; 6 | font-family: sans-serif; 7 | height: 100vh; 8 | background-image: url(https://bing.ioliu.cn/v1/rand); 9 | } 10 | 11 | .login-box { 12 | width: 320px; 13 | height: 400px; 14 | background: #fff; 15 | color: rgb(132,119,116); 16 | top: 50%; 17 | left: 50%; 18 | position: absolute; 19 | transform: translate(-50%, -50%); 20 | box-sizing: border-box; 21 | padding: 70px 30px; 22 | filter: alpha(opacity=60); 23 | -moz-opacity: 0.6; 24 | -khtml-opacity: 0.6; 25 | opacity: 0.6; 26 | } 27 | 28 | .login-box.no-opacity{ 29 | filter: alpha(opacity=100); 30 | -moz-opacity: 1; 31 | -khtml-opacity: 1; 32 | opacity: 1; 33 | } 34 | 35 | .login-box .avatar { 36 | width: 100px; 37 | height: 100px; 38 | border-radius: 50%; 39 | position: absolute; 40 | top: -50px; 41 | left: calc(50% - 50px); 42 | } 43 | 44 | .login-box h1 { 45 | margin: 0; 46 | padding: 0 0 20px; 47 | text-align: center; 48 | font-size: 22px; 49 | } 50 | 51 | .login-box label { 52 | margin: 0; 53 | padding: 0; 54 | font-weight: bold; 55 | display: block; 56 | } 57 | 58 | .login-box input { 59 | width: 100%; 60 | margin-bottom: 20px; 61 | } 62 | 63 | .login-box input[type="text"], .login-box input[type="password"] { 64 | border: none; 65 | border-bottom: 1px solid #fff; 66 | border: 2px solid #e4eaec; 67 | border-radius: 15px; 68 | background: transparent; 69 | outline: none; 70 | height: 30px; 71 | color: #76838f; 72 | font-size: 16px; 73 | } 74 | 75 | .login-box input.error { 76 | border: 2px solid #f00; 77 | } 78 | 79 | .login-box input[type="submit"] { 80 | border: none; 81 | outline: none; 82 | height: 40px; 83 | background: #ff0000; 84 | color: #fff; 85 | font-size: 18px; 86 | border-radius: 20px; 87 | margin-top: 20px; 88 | margin-bottom: 0px; 89 | } 90 | 91 | .login-box input[type="submit"]:hover { 92 | cursor: pointer; 93 | color: #000; 94 | } 95 | 96 | .login-footer { 97 | height: 10%; 98 | text-align: center; 99 | margin-top: 20px; 100 | } 101 | 102 | @media screen and (max-width:800px){ 103 | /*body { 104 | background-image: url(https://bing.ioliu.cn/v1/rand?w=480&h=800); 105 | }*/ 106 | 107 | form { 108 | margin: 0 0 10px; 109 | } 110 | 111 | .login-box { 112 | width: 160px; 113 | height: 270px; 114 | top: 35%; 115 | padding: 35px 15px; 116 | } 117 | 118 | .login-box .avatar { 119 | width: 50px; 120 | height: 50px; 121 | top: -25px; 122 | left: calc(50% - 25px); 123 | } 124 | 125 | .login-box h1 { 126 | padding: 0 0 5px; 127 | font-size: 12px; 128 | line-height: 24px; 129 | } 130 | 131 | .login-box label { 132 | font-size: 12px; 133 | } 134 | 135 | .login-box input { 136 | margin-bottom: 5px; 137 | } 138 | 139 | .login-box input[type="text"], .login-box input[type="password"] { 140 | border-radius: 7px; 141 | height: 15px; 142 | font-size: 12px; 143 | width: 94%; 144 | } 145 | 146 | .login-box input[type="submit"] { 147 | height: 25px; 148 | font-size: 12px; 149 | border-radius: 10px; 150 | margin-top: 10px; 151 | margin-bottom: 0px; 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /msg1500/raisecom_asus_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vb1980/Padavan_CI/40adef3dda5b4167fd314fb4a17f3b49b85242d9/msg1500/raisecom_asus_logo.png -------------------------------------------------------------------------------- /toolchain/mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vb1980/Padavan_CI/40adef3dda5b4167fd314fb4a17f3b49b85242d9/toolchain/mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz -------------------------------------------------------------------------------- /toolchain/mipsel-linux-uclibc-gcc10.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vb1980/Padavan_CI/40adef3dda5b4167fd314fb4a17f3b49b85242d9/toolchain/mipsel-linux-uclibc-gcc10.tar.xz -------------------------------------------------------------------------------- /toolchain/mipsel-linux-uclibc.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vb1980/Padavan_CI/40adef3dda5b4167fd314fb4a17f3b49b85242d9/toolchain/mipsel-linux-uclibc.tar.xz --------------------------------------------------------------------------------