diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 994a22f..3d4079d 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -134,7 +134,7 @@ jobs: run: | VERSIONED_DIR="rayhunter-v${{ env.VERSION }}" mkdir "$VERSIONED_DIR" - mv rayhunter-daemon-* rootshell/rootshell installer-* "$VERSIONED_DIR"/ + mv rayhunter-daemon-* rootshell/rootshell installer-* dist/* "$VERSIONED_DIR"/ - name: Archive release directory as zip run: | VERSIONED_DIR="rayhunter-v${{ env.VERSION }}" diff --git a/doc/installing-from-release-windows.md b/doc/installing-from-release-windows.md index fe9c0f0..a3a7600 100644 --- a/doc/installing-from-release-windows.md +++ b/doc/installing-from-release-windows.md @@ -12,155 +12,10 @@ Windows support in Rayhunter's installer is a work-in-progress. Depending on the ## Orbic 1. Install the [Zadig WinUSB driver](https://zadig.akeo.ie/). -2. Download the latest `release.zip` from the [Rayhunter releases page](https://github.com/EFForg/rayhunter/releases). -3. Unzip `release.zip`. -4. Save the `install.ps1` file below in top of the folder that was unzipped from release.zip. +2. Download the latest `rayhunter-vX.X.X.zip` from the [Rayhunter releases page](https://github.com/EFForg/rayhunter/releases). The version you download will have numbers instead of X +3. Unzip `rayhunter-vX.X.X` . +4. Save the [`install.ps1` file here](https://github.com/EFForg/rayhunter/blob/powershell/installer/install.ps1) in top of the folder that was unzipped from release.zip. 5. Run the install script by double clicking on `install.ps1`. A powershell window will launch. The device will restart multiple times over the next few minutes. You will know it is done when you see terminal output that says `checking for rayhunter server...success!` 6. Rayhunter should now be running! You can verify this by following the instructions below to [view the web UI](#usage-viewing-the-web-ui). You should also see a green line flash along the top of top the display on the device. - -# `install.ps1` -```powershell -$global:adb = "./platform-tools-latest-windows/platform-tools/adb.exe" -$global:serial = ".\installer-windows-x86_64\installer.exe" - -function _adb_push { - & $global:adb -d push @args | Out-Null - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - write-host "push exited with exit code $($exitCode)" - } - return $exitCode -} - -function _adb_shell { - & $global:adb -d shell @args | Out-Null - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - write-host "shell exited with exit code $($exitCode)" - } - return $exitCode -} - -function _wait_for_adb_shell { - do { - start-sleep -seconds 1 - $success = _adb_shell "uname -a" - } until ($success -eq 0) -} - -function _wait_for_atfwd_daemon { - do { - start-sleep -seconds 1 - $success = _adb_shell "pgrep atfwd_daemon" - } until ($success -eq 0) -} - -function force_debug_mode { - write-host "Using adb at $($global:adb)" - write-host "Forcing a switch into debug mode to enable ADB" - _serial "util" "serial" "--root" | Out-Host - write-host "adb enabled, waiting for reboot..." -nonewline - _wait_for_adb_shell - write-host " it's alive!" - write-host "waiting for atfwd_daemon to start ..." -nonewline - _wait_for_atfwd_daemon - write-host " done!" -} -function _serial { - param ( - [Parameter(Mandatory = $false, ValueFromRemainingArguments = $true)] - [string[]]$Args - ) - - # Build the full argument list - $allArgs = @("util", "serial") + $Args - - # Call the serial executable - & $global:serial @allArgs -} - -function setup_rootshell { - _adb_push "rootshell" "/tmp" - write-host "cp..." - _serial "AT+SYSCMD=cp /tmp/rootshell /bin/rootshell" | Out-Host - start-sleep -seconds 1 - write-host "chown..." - _serial "AT+SYSCMD=chown root /bin/rootshell" | Out-Host - start-sleep -seconds 1 - write-host "chmod..." - _serial "AT+SYSCMD=chmod 4755 /bin/rootshell" | Out-Host - start-sleep -seconds 1 - _adb_shell '/bin/rootshell -c id' - write-host "we have root!" -} - -function setup_rayhunter { - _serial "AT+SYSCMD=mkdir -p /data/rayhunter" | Out-Host - _adb_push "config.toml.example" "/tmp/config.toml" - _serial "AT+SYSCMD=mv /tmp/config.toml /data/rayhunter" | Out-Host - _adb_push "rayhunter-daemon-orbic/rayhunter-daemon" "/tmp/rayhunter-daemon" - _serial "AT+SYSCMD=mv /tmp/rayhunter-daemon /data/rayhunter" | Out-Host - _adb_push "scripts/rayhunter_daemon" "/tmp/rayhunter_daemon" - _serial "AT+SYSCMD=mv /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon" | Out-Host - _adb_push "scripts/misc-daemon" "/tmp/misc-daemon" - _serial "AT+SYSCMD=mv /tmp/misc-daemon /etc/init.d/misc-daemon" | Out-Host - - _serial "AT+SYSCMD=chmod 755 /data/rayhunter/rayhunter-daemon" | Out-Host - _serial "AT+SYSCMD=chmod 755 /etc/init.d/rayhunter_daemon" | Out-Host - _serial "AT+SYSCMD=chmod 755 /etc/init.d/misc-daemon" | Out-Host - - write-host "waiting for reboot..." - _serial "AT+SYSCMD=shutdown -r -t 1 now" | Out-Host - do { - start-sleep -seconds 1 - } until ((_adb_shell "true 2> /dev/null") -ne 0) - - _wait_for_adb_shell - write-host "done!" -} - -function test_rayhunter { - $URL = "http://localhost:8080" - & $global:adb -d forward tcp:8080 tcp:8080 - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - write-host "adb forward tcp:8080 tcp:8080 failed with exit code $($exitCode)" - return - } - write-host "checking for rayhunter server..." -nonewline - $seconds = 0 - do { - $resp = invoke-webrequest -uri $URL - if ($resp.statuscode -eq 200) { - write-host "success!" - write-host "you can access rayhunter at $($URL)" - return - } - start-sleep 1 - $seconds = $seconds + 1 - } until ($seconds -eq 30) - write-host "timeout reached! failed to reach rayhunter url $($URL), something went wrong :(" -} - -function get_android_tools { - write-host "adb not found, downloading local copy" - invoke-webrequest "https://dl.google.com/android/repository/platform-tools-latest-windows.zip" -outfile ./platform-tools-latest-windows.zip - expand-archive -force -path "platform-tools-latest-windows.zip" -} - -if (-not (test-path -path $global:serial)) { - write-error "can't find serial, aborting" - return -} - -if (-not (test-path -path $global:adb)) { - get_android_tools -} - -force_debug_mode -setup_rootshell -setup_rayhunter -test_rayhunter -``` diff --git a/docker_make.sh b/docker_make.sh index 8af7f00..a330fd5 100755 --- a/docker_make.sh +++ b/docker_make.sh @@ -1,10 +1,11 @@ #!/bin/bash -e -pushd bin/web +cd bin/web npm run build -popd -#docker build -t rayhunter-devenv -f tools/devenv.dockerfile . -docker run --user $UID:$GID -v ./:/workdir -w /workdir -it rayhunter-devenv sh -c 'cargo build --release --target="armv7-unknown-linux-gnueabihf"' +cd .. +docker build -t rayhunter-devenv -f tools/devenv.dockerfile . +echo ' build!' +docker run --user $UID:$GID -v ./:/workdir -w /workdir -it rayhunter-devenv sh -c 'cargo build --release --target="armv7-unknown-linux-musleabihf"' adb shell '/bin/rootshell -c "/etc/init.d/rayhunter_daemon stop"' -adb push target/armv7-unknown-linux-gnueabihf/release/rayhunter-daemon /data/rayhunter/rayhunter-daemon +adb push target/armv7-unknown-linux-musleabihf/release/rayhunter-daemon /data/rayhunter/rayhunter-daemon echo "rebooting the device..." adb shell '/bin/rootshell -c "reboot"' diff --git a/installer/install.ps1 b/installer/install.ps1 index 2676846..cd9df5f 100644 --- a/installer/install.ps1 +++ b/installer/install.ps1 @@ -1,4 +1,4 @@ -$global:adb = "./platform-tools-latest-windows/platform-tools/adb.exe" +$global:adb = ".\platform-tools-latest-windows\platform-tools\adb.exe" $global:serial = ".\installer-windows-x86_64\installer.exe" function _adb_push { @@ -98,7 +98,7 @@ function setup_rayhunter { } function test_rayhunter { - $URL = "http://localhost:8080" + $URL = "http://localhost:8080/index.html" & $global:adb -d forward tcp:8080 tcp:8080 $exitCode = $LASTEXITCODE if ($exitCode -ne 0) {