param(
[Parameter(Mandatory=$false)]
[string]$Headless
)
# function for messages
#$ErrorActionPreference="Continue"
$Global:VerNum = 'JAMBOREE 5.1'
$host.ui.RawUI.WindowTitle = $Global:VerNum
function Write-Message {
<#
.SYNOPSIS
Prints colored messages depending on type
.PARAMETER TYPE
Type of error message to be prepended to the message and sets the color
.PARAMETER MESSAGE
Message to be output
#>
[CmdletBinding()]
param (
[string]
$Type,
[string]
$Message
)
if (($TYPE) -eq ("INFO")) { $Tag = "INFO" ; $Color = "Green"}
if (($TYPE) -eq ("WARNING")) { $Tag = "WARNING" ; $Color = "Yellow"}
if (($TYPE) -eq ("ERROR")) { $Tag = "ERROR" ; $Color = "Red"}
Write-Host (Get-Date -UFormat "%m/%d:%T")$($Tag)$($Message) -ForegroundColor $Color
#echo "$Message"
}
$splashArt = @"
" .
. . .'. \ /
\ / .'. .' '.' ' -= o =-
-= o =- .' ' / | \
/ | \ |
| JAMBOREE |
| |
| .=====|
|=====. |.---.|
|.---.| ||=o=||
||=o=|| || ||
|| || |[___]|
||___|| |[:::]|
|[:::]| '-----'
'-----'
"@
function Draw-Splash{
param([string]$Text)
# Use a random colour for each character
$Text.ToCharArray() | ForEach-Object{
switch -Regex ($_){
# Ignore new line characters
"`r"{
break
}
# Start a new line
"`n"{
Write-Host " ";break
}
# Use random colours for displaying this non-space character
"[^ ]"{
# Splat the colours to write-host
$arrColors = @('DarkRed','DarkYellow','Gray','DarkGray','Green','Cyan','Red','Magenta','Yellow','White')
$writeHostOptions = @{
ForegroundColor = ($arrColors) | get-random
NoNewLine = $true
}
Write-Host $_ @writeHostOptions
break
}
" "{Write-Host " " -NoNewline}
}
}
}
#backup USERPROFILE for BurpSuite Open Dialog Fix
$USERPROFILE_BACKUP="$env:USERPROFILE"
# set current directory
$VARCD = (Get-Location)
Write-Message -Message "Current Working Directory $VARCD" -Type "INFO"
Set-Location -Path "$VARCD"
# for pycharm and any other
Write-Message -Message "Setting base path for HOMEPATH,USERPROFILE,APPDATA,LOCALAPPDATA,TEMP and TMP to $VARCD" -Type "INFO"
$env:HOMEPATH="$VARCD"
$env:USERPROFILE="$VARCD"
New-Item -Path "$VARCD\Desktop" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
New-Item -Path "$VARCD\AppData\Roaming" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
$env:APPDATA="$VARCD\AppData\Roaming"
New-Item -Path "$VARCD\AppData\Local" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
$env:LOCALAPPDATA="$VARCD\AppData\Local"
New-Item -Path "$VARCD\AppData\Local\Temp" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
$env:TEMP="$VARCD\AppData\Local\Temp"
$env:TMP="$VARCD\AppData\Local\Temp"
# fix for burp suite Documents Path
New-Item -Path "$VARCD\Documents" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
Write-Message -Message "Setting ANDROID ENV Paths $VARCD" -Type "INFO"
$env:ANDROID_SDK_ROOT="$VARCD"
$env:ANDROID_AVD_HOME="$VARCD"
$env:ANDROID_HOME="$VARCD"
$env:ANDROID_AVD_HOME="$VARCD\avd"
New-Item -Path "$VARCD\avd" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
$env:ANDROID_SDK_HOME="$VARCD"
# postgres paths
Write-Message -Message "Setting postgres ENV Paths $VARCD" -Type "INFO"
$env:PGDATA = "$VARCD\PG\data"
$env:PGDATABASE = "postgres"
$env:PGUSER = "postgres"
$env:PGPORT = "5439"
$env:PGLOCALEDIR = "$VARCD\PG\data"
$env:PGDATA = "$VARCD\PG\share\locale"
$env:PGLOG = "$VARCD\PG\postgres.log"
# 1. Dynamically locate the latest CUDA version and set primary environment variables
$c="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA"
$l=gci $c -ad 2>$null|?{$_.Name -match '^v\d+\.\d+$'}|sort{[version]($_.Name-replace 'v')}|select -L 1
if($l){
$b=$l.FullName; $env:CUDA_PATH=$b
ni "env:CUDA_PATH_$($l.Name-replace '\.','_')".ToUpper() -Value $b -F|Out-Null
$p=@("$b\bin","$b\bin\x64","$b\libnvvp","C:\Program Files\NVIDIA Corporation\NVIDIA App\NvDLISR","C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common")
$p|%{$path=$_; if($env:Path-split';'-notcontains $path){$env:Path="$path;$env:Path"}}
Write-Host "CUDA Path updated: $b" -F Green
}else{Write-Warning "No CUDA found in $c"}
# for Whispr / GPU CUDA !
$env:DEVICE_TYPE="cuda"
$env:WHISPER_COMPUTE_TYPE="float16"
# -- Override every path Electron/Node resolves as "home" --
$env:HOME = "$VARCD"
$env:HOMEDRIVE = (Split-Path "$VARCD" -Qualifier)
$env:XDG_CACHE_HOME = "$VARCD\.cache"
$env:XDG_CONFIG_HOME = "$VARCD\.config"
$env:XDG_DATA_HOME = "$VARCD\.local\share"
$env:LM_STUDIO_HOME = "$VARCD\.lmstudio"
$env:LM_STUDIO_CACHE = "$VARCD\.cache\lm-studio"
$env:LM_STUDIO_MODELS = "$VARCD\.cache\lm-studio\models"
$env:ELECTRON_NO_UPDATER = "1"
#java
Write-Message -Message "Setting JAVA ENV Paths $VARCD" -Type "INFO"
$env:JAVA_HOME = "$VARCD\jdk"
Write-Message -Message "Resetting Path variables to not use local python,java,node,adb,git,java,postgres ..." -Type "WARNING"
$env:Path = "$env:SystemRoot\system32;$env:SystemRoot;$env:SystemRoot\System32\Wbem;$env:SystemRoot\System32\WindowsPowerShell\v1.0\;$VARCD\PG\bin;$VARCD\platform-tools\;$VARCD\rootAVD-master;$VARCD\python\tools\Scripts;$VARCD\python\tools\Lib\venv\scripts\;$VARCD\python\tools;python\tools\Lib\site-packages;$VARCD\PortableGit\cmd;$VARCD\jdk\bin;$VARCD\nodeRMS;$VARCD\node;$VARCD\w64devkit\bin;C:\Program Files\PowerShell\7\;$VARCD\AppData\Local\Kiro-Cli\"
# python
$env:PYTHONHOME="$VARCD\python\tools"
# wsl don't use system32 path !
$env:WSLBIN= "C:\Windows\System32\wsl.exe"
# VS code eating my env ...
$env:PYTHONPATH = "$VARCD\python\tools\Lib\site-packages"
#init stuff
Stop-process -name adb -Force -ErrorAction SilentlyContinue |Out-Null
# Setup Form
Add-Type -assembly System.Windows.Forms
$main_form = New-Object System.Windows.Forms.Form
$main_form.AutoSize = $true
$main_form.Text = "$VerNum"
$hShift = 0
$vShift = 0
### MAIN ###
function Test-PathLength {
<#
.SYNOPSIS
Checks if the current path exceeds 100 characters and displays an error message
.DESCRIPTION
Validates the current working directory path length and alerts the user if it exceeds 100 characters
#>
[CmdletBinding()]
param()
$currentPath = (Get-Location).Path
if ($currentPath.Length -gt 100) {
Write-Message -Type "ERROR" -Message "Current path is $($currentPath.Length) characters long. Please move to a base folder (e.g., C:\JAMBOREE) to avoid path length issues."
}
}
############# CheckAdmin
Function CheckAdmin {
If ((!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) -and ( $Global:NOGUI -eq $null )) {
Write-Message -Message "Not running as admin" -Type "ERROR"
if (($PSCommandPath -eq $null ) ) { function GetPSCommandPath() { return $MyInvocation.PSCommandPath; } $PSCommandPath = GetPSCommandPath }
$wshell = New-Object -ComObject Wscript.Shell
$pause = $wshell.Popup("Need to esclate to administrator to run the current Function!", 0, "Wait!", 48+1)
if ($pause -eq '1') {
Write-Message -Message "Restarting $PSCommandPath as admin... " -Type "INFO"
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" " -WorkingDirectory "$VARCD" -Verb RunAs
exit
}
Elseif ($pause = '2') {
Write-Message -Message "Not running as admin" -Type "ERROR"
Start-Sleep -Seconds 5
exit
}
}
}
############# CheckVolatility3
Function CheckVolatility3 {
if (-not(Test-Path -Path "$VARCD\volatility3-develop" )) {
try {
CheckPython
Write-Message -Message "Downloading volatility3" -Type "INFO"
downloadFile "https://github.com/volatilityfoundation/volatility3/archive/refs/heads/develop.zip" "$VARCD\develop.zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\develop.zip", "$VARCD\")
Write-Message -Message "Downloading upx-3.96-win64.zip" -Type "INFO"
downloadFile "https://github.com/upx/upx/releases/download/v3.96/upx-3.96-win64.zip" "$VARCD\upx.zip"
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\upx.zip", "$VARCD\")
Write-Message -Message "Installing Setuptools" -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\volatility3-develop\" -ArgumentList " -m pip install setuptools " -wait -NoNewWindow
Write-Message -Message "Installing pyinstaller " -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\volatility3-develop\" -ArgumentList " -m pip install pyinstaller " -wait -NoNewWindow
Write-Message -Message "Installing requirements.txt" -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\volatility3-develop\" -ArgumentList " -m pip install -r requirements.txt " -wait -NoNewWindow
Write-Message -Message "Building Volatility" -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\volatility3-develop\" -ArgumentList " setup.py build " -wait -NoNewWindow
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\volatility3-develop\" -ArgumentList " setup.py install " -wait -NoNewWindow
Write-Message -Message "Running pyinstaller to create binary " -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\Scripts\pyinstaller.exe" -WorkingDirectory "$VARCD\volatility3-develop\volatility3" -ArgumentList " --upx-dir `"$VARCD\upx-3.96-win64`" ..\vol.spec " -wait -NoNewWindow
Write-Message -Message "Downloading Volatility Symbols ~800MB" -Type "INFO"
downloadFile "https://downloads.volatilityfoundation.org/volatility3/symbols/windows.zip" "$VARCD\windows.zip"
New-Item -Path "$VARCD\volatility3-develop\volatility3\dist\symbols" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
[System.IO.Compression.ZipFile]::ExtractToDirectory( "$VARCD\windows.zip", "$VARCD\volatility3-develop\volatility3\dist\symbols")
Write-Message -Message "Complete opening volatility3 folder example command line .\vol.exe -f memory.dump windows.pslist " -Type "INFO"
explorer "$VARCD\volatility3-develop\volatility3\dist"
New-Item -Path "$VARCD\volatility3-develop\volatility3\dist\symbols" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\volatility3-develop Already Exist" -Type "WARNING"
}
}
############# CheckNode
Function CheckNode {
if (-not(Test-Path -Path "$VARCD\node" )) {
try {
Write-Message -Message "Downloading latest node" -Type "INFO"
$downloadUri = $downloadUri = (Invoke-RestMethod -Method GET -Uri "https://nodejs.org/dist/latest/") -split '"' -match '.*node-.*-win-x64.zip.*' | ForEach-Object {$_ -ireplace '^\/','https://nodejs.org/' } | select -first 1
downloadFile "$downloadUri" "$VARCD\node.zip"
Write-Message -Message "Extracting Node" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\node.zip", "$VARCD")
Get-ChildItem "$VARCD\node-*" | Rename-Item -NewName "node"
Write-Message -Message "Updating npm" -Type "INFO"
Start-Process -FilePath "$VARCD\node\npm.cmd" -WorkingDirectory "$VARCD\node" -ArgumentList " install -g npm " -wait -NoNewWindow
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\node already Exist" -Type "WARNING"
}
}
############# CheckNodeRMS
Function CheckNodeRMS {
Write-Message -Message "Checking for node 22.9.0" -Type "WARNING"
if (-not(Test-Path -Path "$VARCD\nodeRMS" )) {
try {
Write-Message -Message "Downloading 22.9.0 node" -Type "INFO"
$downloadUri = $downloadUri = (Invoke-RestMethod -Method GET -Uri "https://nodejs.org/dist/latest/") -split '"' -match '.*node-.*-win-x64.zip.*' | ForEach-Object {$_ -ireplace '^\/','https://nodejs.org/' } | select -first 1
downloadFile "https://nodejs.org/dist/v22.9.0/node-v22.9.0-win-x64.zip" "$VARCD\node.zip"
Write-Message -Message "Extracting Node" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\node.zip", "$VARCD")
Get-ChildItem "$VARCD\node-*" | Rename-Item -NewName "nodeRMS"
Write-Message -Message "Updating npm" -Type "INFO"
Start-Process -FilePath "$VARCD\nodeRMS\npm.cmd" -WorkingDirectory "$VARCD\nodeRMS" -ArgumentList " install -g npm " -wait -NoNewWindow
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\nodeRMS already Exist" -Type "WARNING"
}
}
############# StartRMS
Function StartRMS {
CheckPython
CheckNodeRMS
if (-not(Test-Path -Path "$VARCD\nodeRMS\rms.cmd" )) {
try {
Start-Process -FilePath "$VARCD\nodeRMS\npm.cmd" -WorkingDirectory "$VARCD\nodeRMS" -ArgumentList " install -g rms-runtime-mobile-security " -wait -NoNewWindow
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\nodeRMS\rms.cmd already exist" -Type "INFO"
}
StartFrida
Write-Message -Message "Killing node " -Type "INFO"
Stop-process -name node -Force -ErrorAction SilentlyContinue |Out-Null
Write-Message -Message "Starting rms-runtime-mobile-security please wait....." -Type "INFO"
Start-Process -FilePath "$VARCD\nodeRMS\rms.cmd" -WorkingDirectory "$VARCD\nodeRMS" -NoNewWindow
Start-Sleep -Seconds 5
Start-Process "http://127.0.0.1:5491/"
}
############# StartSillyTavern
Function StartSillyTavern {
CheckGit
Write-Message -Message "Killing node " -Type "INFO"
Stop-process -name node -Force -ErrorAction SilentlyContinue |Out-Null
CheckNode
if (-not(Test-Path -Path "$VARCD\SillyTavern" )) {
try {
Write-Message -Message "Running git clone https://github.com/SillyTavern/SillyTavern -b staging" -Type "INFO"
# -b staging broke TTS Autogen!
Start-Process -FilePath "$VARCD\PortableGit\cmd\git.exe" -WorkingDirectory "$VARCD\" -ArgumentList " clone `"https://github.com/SillyTavern/SillyTavern`" -b staging " -wait -NoNewWindow
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\SillyTavern" -Type "WARNING"
}
Write-Message -Message "Starting SillyTavern please wait....." -Type "INFO"
Start-Process -FilePath "$VARCD\SillyTavern\Start.bat" -WorkingDirectory "$VARCD\SillyTavern" -NoNewWindow
}
############# CheckADB
function CheckADB {
if ((Get-Command adb -ErrorAction SilentlyContinue)) {
$varadb = (adb devices)
Write-Message -Message "$varadb" -Type "INFO"
$varadb = $varadb -match 'device\b' -replace 'device','' -replace '\s',''
Write-Message -Message "Online Device: $varadb" -Type "INFO"
if (($varadb.length -lt 1 )) {
Write-Message -Message "ADB Failed! Check for unauthorized devices listed in ADB UI or use ! AVD Wipe Button" -Type "ERROR"
adb devices
}
return $varadb
}
}
############# KillADB
function KillADB {
Write-Message -Message "Killing ADB.exe " -Type "INFO"
Stop-process -name adb -Force -ErrorAction SilentlyContinue |Out-Null
}
Function StartJAMBOREE_SSL_N_ANTIROOT {
CheckFrida
StartFrida
Write-Message -Message "Running Frida-ps select package to run FridaBypassKit.js:" -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c pm list packages `" " -NoNewWindow -RedirectStandardOutput "$VARCD\RedirectStandardOutput.txt"
Start-Sleep -Seconds 2
$PackageName = (Get-Content -Path "$VARCD\RedirectStandardOutput.txt") -replace 'package:','' | Out-GridView -Title "Select Package to Run Objection" -OutputMode Single
Write-Message -Message "Downloading Frida Root/SSL Depinning FridaBypassKit.js" -Type "INFO"
downloadFile "https://github.com/freeload101/FridaBypassKit/raw/refs/heads/okankurtuluss/main/FridaBypassKit.js" "$VARCD\FridaBypassKit.js"
Write-Message -Message "Starting Frida with FridaBypassKit.js" -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\Scripts\frida.exe" -WorkingDirectory "$VARCD\python\tools\Scripts" -ArgumentList " -l `"$VARCD\FridaBypassKit.js`" -f $PackageName -U " -NoNewWindow
Write-Message -Message "⚠️ NOTICE: IF SSL DEPINNING IS NOT WORKING, TRY RELOADING OR MODIFYING THE FRIDA SCRIPT. TIMING ISSUES BETWEEN APP INITIALIZATION AND HOOK INJECTION CAN CAUSE SSL PINNING BYPASS TO FAIL ON THE FIRST RUN. RELOADING THE SCRIPT AFTER THE APP HAS FULLY INITIALIZED OFTEN RESOLVES THE ISSUE." -Type "INFO"
start-sleep -Seconds 5
}
############# downloadFile
function downloadFile($url, $file) {
$req = [System.Net.HttpWebRequest]::Create($url)
$req.AllowAutoRedirect = $true
$req.Timeout = 600000
$req.ReadWriteTimeout = 600000
$req.UserAgent = "Mozilla/5.0"
$webRes = $req.GetResponse()
$expectedLen = $webRes.ContentLength
if ($expectedLen -gt 0) { Write-Message -Message "Expected size : $([math]::Round($expectedLen / 1MB)) MB" -Type "INFO" }
$res = $webRes.GetResponseStream()
$fs = [System.IO.FileStream]::new($file, 'Create')
$buf = [byte[]]::new(256KB)
$totalRead = [long]0
$lastPct = -1
while (($c = $res.Read($buf, 0, $buf.Length)) -gt 0) {
$fs.Write($buf, 0, $c)
$totalRead += $c
if ($expectedLen -gt 0) {
$pct = [math]::Floor($totalRead * 100 / $expectedLen)
if ($pct -ne $lastPct -and $pct % 10 -eq 0) {
Write-Message -Message "Downloaded : $pct% ($([math]::Round($totalRead / 1MB)) MB)" -Type "INFO"
$lastPct = $pct
}
}
}
$fs.Flush(); $fs.Close(); $res.Close(); $webRes.Close()
$actualLen = (Get-Item $file).Length
Write-Message -Message "Actual size : $([math]::Round($actualLen / 1MB)) MB" -Type "INFO"
if ($expectedLen -gt 0 -and $actualLen -ne $expectedLen) {
Write-Message -Message "Download INCOMPLETE: expected $expectedLen bytes, got $actualLen bytes" -Type "INFO"
Remove-Item $file -Force -ErrorAction SilentlyContinue
throw "Download verification failed for $file"
}
}
############# CHECK JAVA FOR NEO4J
Function CheckJavaNeo4j {
if (-not(Test-Path -Path "$VARCD\jdk_neo4j" )) {
try {
Write-Message -Message "Downloading Java" -Type "INFO"
# does not work for neo4j bloodhound wants java11 ... downloadFile "https://download.oracle.com/java/17/latest/jdk-17_windows-x64_bin.zip" "$VARCD\openjdk.zip"
downloadFile "https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip" "$VARCD\jdk_neo4j.zip"
Write-Message -Message "Extracting Java" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\jdk_neo4j.zip", "$VARCD")
Get-ChildItem "$VARCD\jdk-*" | Rename-Item -NewName "jdk_neo4j"
$env:JAVA_HOME = "$VARCD\jdk_neo4j"
$env:Path = "$VARCD\jdk_neo4j;$env:Path"
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\jdk_neo4j already exists" -Type "WARNING"
$env:JAVA_HOME = "$VARCD\jdk_neo4j"
}
}
############# CHECK JAVA
Function CheckJava {
Write-Message -Message "Checking for Java" -Type "INFO"
if (-not(Test-Path -Path "$VARCD\jdk" )) {
Write-Message -Message "Downloading Java" -Type "INFO"
downloadFile "https://download.java.net/java/GA/jdk24/1f9ff9062db4449d8ca828c504ffae90/36/GPL/openjdk-24_windows-x64_bin.zip" "$VARCD\jdk.zip"
Write-Message -Message "Extracting Java" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\jdk.zip", "$VARCD")
Get-ChildItem "$VARCD\jdk-*" | Rename-Item -NewName { $_.Name -replace '-.*','' }
$env:JAVA_HOME = "$VARCD\jdk"
#$env:Path = "$VARCD\jdk;$env:Path"
}
else {
Write-Message -Message "$VARCD\openjdk.zip already exists" -Type "WARNING"
}
}
############# CHECK Frida tools
Function CheckFrida {
if (-not(Test-Path -Path "$VARCD\python\tools\Lib\site-packages\frida" )) {
# for frida/AVD
Write-Message -Message "Installing objection and python-xz needed for AVD" -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\python\tools" -ArgumentList " -m pip install objection " -wait -NoNewWindow
# for Frida Android Binary
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\python\tools" -ArgumentList " -m pip install python-xz " -wait -NoNewWindow
Write-Message -Message "Installing frida-tools" -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\python\tools" -ArgumentList " -m pip install frida==17.9.10 " -wait -NoNewWindow
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\python\tools" -ArgumentList " -m pip install frida-tools " -wait -NoNewWindow
}
}
############# CHECK PYTHON
Function CheckPython {
if (-not(Test-Path -Path "$VARCD\python" )) {
Write-Message -Message "Downloading Python nuget package" -Type "INFO"
downloadFile "https://www.nuget.org/api/v2/package/python" "$VARCD\python.zip"
New-Item -Path "$VARCD\python" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
Write-Message -Message "Extracting Python nuget package" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\python.zip", "$VARCD\python")
Write-Message -Message "Updating pip" -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\python\tools" -ArgumentList " -m pip install --upgrade pip " -wait -NoNewWindow
New-Item -ItemType Directory -Path "$VARCD\python\tools\Scripts" -ErrorAction SilentlyContinue |Out-Null
# DO NOT INDENT THIS PART
$PipBatch = @'
python -m pip %*
'@
$PipBatch | Out-File -Encoding Ascii -FilePath "$VARCD\python\tools\Scripts\pip.bat" -ErrorAction SilentlyContinue |Out-Null
# DO NOT INDENT THIS PART
}
else {
Write-Message -Message "$VARCD\python already exists" -Type "WARNING"
}
Write-Message -Message "CheckPython Complete" -Type "INFO"
}
############# InstallAPKS
function InstallAPKS {
Write-Message -Message "Downloading Base APKS" -Type "INFO"
New-Item -Path "$VARCD\APKS" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
Write-Message -Message "Downloading SAI Split Package Installer" -Type "INFO"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/Aefyr/SAI/releases/latest").assets | Where-Object name -like *.apk ).browser_download_url
downloadFile "$downloadUri" "$VARCD\APKS\SAI.apk"
Write-Message -Message "Downloading Amaze File Manager" -Type "INFO"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/TeamAmaze/AmazeFileManager/releases/latest").assets | Where-Object name -like *.apk ).browser_download_url
downloadFile "$downloadUri" "$VARCD\APKS\AmazeFileManager.apk"
Write-Message -Message "Downloading Duckduckgo" -Type "INFO"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/duckduckgo/Android/releases/latest").assets | Where-Object name -like *.apk ).browser_download_url
downloadFile "$downloadUri" "$VARCD\APKS\duckduckgo.apk"
Write-Message -Message "Downloading Gameguardian" -Type "INFO"
downloadFile "https://gameguardian.net/forum/files/file/2-gameguardian/?do=download&r=50314&confirm=1&t=1" "$VARCD\APKS\gameguardian.apk"
Write-Message -Message "Downloading Lucky Patcher" -Type "INFO"
downloadFile "https://chelpus.com/luckypatcher/LuckyPatcherInstaller.apk" "$VARCD\APKS\LP_Downloader.apk"
Write-Message -Message "Downloading YASNAC" -Type "INFO"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/RikkaW/YASNAC/releases/latest").assets | Where-Object name -like *.apk ).browser_download_url
downloadFile "$downloadUri" "$VARCD\APKS\yasnac.apk"
Write-Message -Message "Downloading App Manager - Android package manager" -Type "INFO"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/MuntashirAkon/AppManager/releases/latest").assets | Where-Object name -like *.apk ).browser_download_url
downloadFile "$downloadUri" "$VARCD\APKS\AppManager.apk"
Write-Message -Message "Downloading AndroGoat.apk" -Type "INFO"
downloadFile "https://github.com/satishpatnayak/MyTest/raw/master/AndroGoat.apk" "$VARCD\APKS\AndroGoat.apk"
$varadb=CheckADB
$env:ANDROID_SERIAL=$varadb
Write-Message -Message "Installing Base APKS" -Type "INFO"
(Get-ChildItem -Path "$VARCD\APKS").FullName |ForEach-Object {
Write-Message -Message "Installing $_" -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " install $_ " -NoNewWindow -Wait
}
Write-Message -Message "Complete Installing Base APKS" -Type "INFO"
}
############# CertPush
function CertPush {
AlwaysTrustUserCerts
$varadb=CheckADB
$env:ANDROID_SERIAL=$varadb
Write-Message -Message "Converting $VARCD\BURP.der to $VARCD\BURP.pem" -Type "INFO"
Remove-Item -Path "$VARCD\BURP.pem" -Force -ErrorAction SilentlyContinue |Out-Null
Start-Process -FilePath "$env:SYSTEMROOT\System32\certutil.exe" -ArgumentList " -encode `"$VARCD\BURP.der`" `"$VARCD\BURP.pem`" " -NoNewWindow -Wait
Write-Message -Message "Copying PEM to Androind format just in case its not standard burp suite cert Subject Hash" -Type "INFO"
# Rename a PEM in Android format (openssl -subject_hash_old ) with just certutil and powershell
$CertSubjectHash = (certutil "$VARCD\BURP.der")
$CertSubjectHash = $CertSubjectHash |Select-String -Pattern 'Subject:.*' -AllMatches -Context 1, 8
$CertSubjectHash = ($CertSubjectHash.Context.PostContext[7]).SubString(24,2)+($CertSubjectHash.Context.PostContext[7]).SubString(22,2)+($CertSubjectHash.Context.PostContext[7]).SubString(20,2)+($CertSubjectHash.Context.PostContext[7]).SubString(18,2)+"."+0
Copy-Item -Path "$VARCD\BURP.pem" -Destination "$VARCD\$CertSubjectHash" -Force
Write-Message -Message "Pushing $VARCD\$CertSubjectHash to /sdcard " -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " push `"$VARCD\$CertSubjectHash`" /sdcard" -NoNewWindow -Wait
Write-Message -Message "Pushing $VARCD\BURP.der to /data/local/tmp/cert-der.crt " -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " push `"$VARCD\BURP.der`" /data/local/tmp/cert-der.crt" -NoNewWindow -Wait
Write-Message -Message "Pushing Copying /scard/$CertSubjectHash /data/misc/user/0/cacerts-added " -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c mkdir /data/misc/user/0/cacerts-added`" " -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c cp /sdcard/$CertSubjectHash /data/misc/user/0/cacerts-added`" " -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c chown root:root /data/misc/user/0/cacerts-added/$CertSubjectHash" -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c chmod 644 /data/misc/user/0/cacerts-added/$CertSubjectHash" -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c ls -laht /data/misc/user/0/cacerts-added/$CertSubjectHash" -NoNewWindow -Wait
Write-Message -Message "Starting CertPush" -Type "INFO"
Write-Message -Message "Magisk should ask you to reboot!" -Type "WARNING"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"am start -n com.topjohnwu.magisk/com.topjohnwu.magisk.ui.MainActivity" -NoNewWindow -Wait
}
############# Startiptables
Function Startiptables {
$ETH0=((Get-NetIPConfiguration | Where-Object { $_.IPv4DefaultGateway }).IPv4Address.IPAddress)
Write-Message -Message "You can also try setting WiFi settings and set proxy to 10.0.2.2:8080 but will not work for all apps" -Type "WARNING"
Write-Message -Message "Setting port 80 and 443 to $ETH0" -Type "INFO"
Write-Message -Message "iptables -t nat -F" -Type "WARNING"
Write-Message -Message "iptables -t nat -A OUTPUT -p tcp --dport 443 -j DNAT --to-destination $($ETH0):8080" -Type "WARNING"
Write-Message -Message "iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination $($ETH0):8080" -Type "WARNING"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c iptables -t nat -F`" " -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c iptables -t nat -A OUTPUT -p tcp --dport 443 -j DNAT --to-destination $($ETH0):8080`" " -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination $($ETH0):8080`" " -NoNewWindow -Wait
}
############# AlwaysTrustUserCerts
Function AlwaysTrustUserCerts {
Write-Message -Message "Checking for $VARCD\trustusercerts " -Type "INFO"
if (-not(Test-Path -Path "$VARCD\trustusercerts" )) {
try {
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/NVISOsecurity/MagiskTrustUserCerts/releases/latest").assets | Where-Object name -like *.zip ).browser_download_url
Write-Message -Message "Downloading Magisk Module AlwaysTrustUserCerts.zip" -Type "INFO"
Invoke-WebRequest -Uri $downloadUri -Out "$VARCD\AlwaysTrustUserCerts.zip"
Write-Message -Message "Extracting AlwaysTrustUserCerts.zip" -Type "INFO"
Expand-Archive -Path "$VARCD\AlwaysTrustUserCerts.zip" -DestinationPath "$VARCD\trustusercerts" -Force
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\AlwaysTrustUserCerts.zip already exists" -Type "INFO"
}
$varadb=CheckADB
$env:ANDROID_SERIAL=$varadb
Write-Message -Message "Pushing $VARCD\AlwaysTrustUserCerts.zip" -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " push `"$VARCD\trustusercerts`" /sdcard" -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c cp -R /sdcard/trustusercerts /data/adb/modules`" " -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c find /data/adb/modules`" " -NoNewWindow -Wait
}
Function StartFrida {
CheckPython
CheckFrida
if (-not(Test-Path -Path "$VARCD\frida-server" )) {
try {
# Auto-download Frida Server for connected Android device
# Step 1: Get device ABI
$abiRaw = & "$VARCD\platform-tools\adb.exe" shell getprop ro.product.cpu.abi
$abi = "$abiRaw".Trim()
Write-Host "[*] Device ABI: $abi"
# Step 2: Map ABI to Frida architecture string
$archMap = @{
"arm64-v8a" = "arm64"
"armeabi-v7a"= "arm"
"armeabi" = "arm"
"x86_64" = "x86_64"
"x86" = "x86"
}
if (-not $archMap.ContainsKey($abi)) {
Write-Error "Unsupported ABI: $abi"
return # <-- CHANGED FROM 'exit 1'
}
$arch = $archMap[$abi]
Write-Host "[*] Frida arch: $arch"
# Step 3: Fetch latest release info from GitHub API
Write-Host "[*] Fetching latest Frida release info..."
$releaseInfo = Invoke-RestMethod -Uri "https://api.github.com/repos/frida/frida/releases/latest" -Headers @{ "User-Agent" = "PowerShell" }
$version = $releaseInfo.tag_name
Write-Host "[*] Latest version: $version"
# Step 4: Find matching asset (frida-server for Android)
$assetName = "frida-server-$version-android-$arch.xz"
$asset = $releaseInfo.assets | Where-Object { $_.name -eq $assetName }
if (-not $asset) {
Write-Error "Could not find asset: $assetName"
Write-Host "Available assets:"
$releaseInfo.assets | ForEach-Object { Write-Host " $($_.name)" }
return # <-- CHANGED FROM 'exit 1'
}
# Step 5: Download
$downloadUrl = $asset.browser_download_url
$outputPath = Join-Path $PWD $assetName
Write-Host "[*] Downloading $assetName ..."
#Invoke-WebRequest -Uri $downloadUrl -OutFile $outputPath
downloadFile "$downloadUrl" "$VARCD\frida-server-android_LATEST.xz"
Write-Host "[+] Saved to: $outputPath"
Write-Message -Message "Extracting $downloadUri" -Type "INFO"
# don't mess with spaces for these lines for python ...
$PythonXZ = @'
import xz
import shutil
with xz.open('frida-server-android_LATEST.xz') as f:
with open('frida-server', 'wb') as fout:
shutil.copyfileobj(f, fout)
'@
# don't mess with spaces for these lines for python ...
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD" -ArgumentList " `"$VARCD\frida-server-extract.py`" " -NoNewWindow
$PythonXZ | Out-File -FilePath frida-server-extract.py
# change endoding from Windows-125R2 to UTF-8
Set-Content -Path "$VARCD\frida-server-extract.py" -Value $PythonXZ -Encoding UTF8 -PassThru -Force
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "Issues extracting $VARCD\frida-server" -Type "WARNING"
}
$varadb=CheckADB
$env:ANDROID_SERIAL=$varadb
Write-Message -Message "Pushing $VARCD\frida-server" -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c killall frida-server;sleep 1`" " -NoNewWindow -Wait -ErrorAction SilentlyContinue |Out-Null
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " push `"$VARCD\frida-server`" /sdcard" -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c cp -R /sdcard/frida-server /data/local/tmp`" " -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c chmod 777 /data/local/tmp/frida-server`" " -NoNewWindow -Wait
Write-Message -Message "Starting /data/local/tmp/frida-server" -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c /data/local/tmp/frida-server --version`" " -NoNewWindow
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell `"su -c /data/local/tmp/frida-server & `" " -NoNewWindow
}
############# StartADB
function StartADB {
$varadb=CheckADB
$env:ANDROID_SERIAL=$varadb
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " logcat *:W "
}
############# AVDDownload
Function AVDDownload {
if (-not(Test-Path -Path "$VARCD\emulator\emulator.exe" )) {
ADBCheckBin
CheckJava
CheckPython
Write-Message -Message "Creating licenses Files" -Type "INFO"
$licenseContentBase64 = "UEsDBBQAAAAAAKNK11IAAAAAAAAAAAAAAAAJAAAAbGljZW5zZXMvUEsDBAoAAAAAAJ1K11K7n0IrKgAAACoAAAAhAAAAbGljZW5zZXMvYW5kcm9pZC1nb29nbGV0di1saWNlbnNlDQo2MDEwODViOTRjZDc3ZjBiNTRmZjg2NDA2OTU3MDk5ZWJlNzljNGQ2UEsDBAoAAAAAAKBK11LzQumJKgAAACoAAAAkAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstYXJtLWRidC1saWNlbnNlDQo4NTlmMzE3Njk2ZjY3ZWYzZDdmMzBhNTBhNTU2MGU3ODM0YjQzOTAzUEsDBAoAAAAAAKFK11IKSOJFKgAAACoAAAAcAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstbGljZW5zZQ0KMjQzMzNmOGE2M2I2ODI1ZWE5YzU1MTRmODNjMjgyOWIwMDRkMWZlZVBLAwQKAAAAAACiStdSec1a4SoAAAAqAAAAJAAAAGxpY2Vuc2VzL2FuZHJvaWQtc2RrLXByZXZpZXctbGljZW5zZQ0KODQ4MzFiOTQwOTY0NmE5MThlMzA1NzNiYWI0YzljOTEzNDZkOGFiZFBLAwQKAAAAAACiStdSk6vQKCoAAAAqAAAAGwAAAGxpY2Vuc2VzL2dvb2dsZS1nZGstbGljZW5zZQ0KMzNiNmEyYjY0NjA3ZjExYjc1OWYzMjBlZjlkZmY0YWU1YzQ3ZDk3YVBLAwQKAAAAAACiStdSrE3jESoAAAAqAAAAJAAAAGxpY2Vuc2VzL2ludGVsLWFuZHJvaWQtZXh0cmEtbGljZW5zZQ0KZDk3NWY3NTE2OThhNzdiNjYyZjEyNTRkZGJlZWQzOTAxZTk3NmY1YVBLAwQKAAAAAACjStdSkb1vWioAAAAqAAAAJgAAAGxpY2Vuc2VzL21pcHMtYW5kcm9pZC1zeXNpbWFnZS1saWNlbnNlDQplOWFjYWI1YjVmYmI1NjBhNzJjZmFlY2NlODk0Njg5NmZmNmFhYjlkUEsBAj8AFAAAAAAAo0rXUgAAAAAAAAAAAAAAAAkAJAAAAAAAAAAQAAAAAAAAAGxpY2Vuc2VzLwoAIAAAAAAAAQAYACIHOBcRaNcBIgc4FxFo1wHBTVQTEWjXAVBLAQI/AAoAAAAAAJ1K11K7n0IrKgAAACoAAAAhACQAAAAAAAAAIAAAACcAAABsaWNlbnNlcy9hbmRyb2lkLWdvb2dsZXR2LWxpY2Vuc2UKACAAAAAAAAEAGACUEFUTEWjXAZQQVRMRaNcB6XRUExFo1wFQSwECPwAKAAAAAACgStdS80LpiSoAAAAqAAAAJAAkAAAAAAAAACAAAACQAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstYXJtLWRidC1saWNlbnNlCgAgAAAAAAABABgAsEM0FBFo1wGwQzQUEWjXAXb1MxQRaNcBUEsBAj8ACgAAAAAAoUrXUgpI4kUqAAAAKgAAABwAJAAAAAAAAAAgAAAA/AAAAGxpY2Vuc2VzL2FuZHJvaWQtc2RrLWxpY2Vuc2UKACAAAAAAAAEAGAAsMGUVEWjXASwwZRURaNcB5whlFRFo1wFQSwECPwAKAAAAAACiStdSec1a4SoAAAAqAAAAJAAkAAAAAAAAACAAAABgAQAAbGljZW5zZXMvYW5kcm9pZC1zZGstcHJldmlldy1saWNlbnNlCgAgAAAAAAABABgA7s3WFRFo1wHuzdYVEWjXAfGm1hURaNcBUEsBAj8ACgAAAAAAokrXUpOr0CgqAAAAKgAAABsAJAAAAAAAAAAgAAAAzAEAAGxpY2Vuc2VzL2dvb2dsZS1nZGstbGljZW5zZQoAIAAAAAAAAQAYAGRDRxYRaNcBZENHFhFo1wFfHEcWEWjXAVBLAQI/AAoAAAAAAKJK11KsTeMRKgAAACoAAAAkACQAAAAAAAAAIAAAAC8CAABsaWNlbnNlcy9pbnRlbC1hbmRyb2lkLWV4dHJhLWxpY2Vuc2UKACAAAAAAAAEAGADGsq0WEWjXAcayrRYRaNcBxrKtFhFo1wFQSwECPwAKAAAAAACjStdSkb1vWioAAAAqAAAAJgAkAAAAAAAAACAAAACbAgAAbGljZW5zZXMvbWlwcy1hbmRyb2lkLXN5c2ltYWdlLWxpY2Vuc2UKACAAAAAAAAEAGAA4LjgXEWjXATguOBcRaNcBIgc4FxFo1wFQSwUGAAAAAAgACACDAwAACQMAAAAA"
$licenseContent = [System.Convert]::FromBase64String($licenseContentBase64)
Set-Content -Path "$VARCD\android-sdk-licenses.zip" -Value $licenseContent -Encoding Byte
Expand-Archive "$VARCD\android-sdk-licenses.zip" -DestinationPath "$VARCD\" -Force
Write-Message -Message "Running sdkmanager/Installing" -Type "INFO"
# now we are using latest cmdline-tools ...!?
Start-Process -FilePath "$VARCD\cmdline-tools\latest\bin\sdkmanager.bat" -ArgumentList "platform-tools" -Verbose -Wait -NoNewWindow
#Start-Process -FilePath "$VARCD\cmdline-tools\latest\bin\sdkmanager.bat" -ArgumentList "extras;intel;Hardware_Accelerated_Execution_Manager" -Verbose -Wait -NoNewWindow
Start-Process -FilePath "$VARCD\cmdline-tools\latest\bin\sdkmanager.bat" -ArgumentList "platforms;android-31" -Verbose -Wait -NoNewWindow
Start-Process -FilePath "$VARCD\cmdline-tools\latest\bin\sdkmanager.bat" -ArgumentList "emulator" -Verbose -Wait -NoNewWindow
Start-Process -FilePath "$VARCD\cmdline-tools\latest\bin\sdkmanager.bat" -ArgumentList "system-images;android-31;google_apis_playstore;x86_64" -Verbose -Wait -NoNewWindow
Write-Message -Message "AVD Install Complete Creating AVD Device" -Type "INFO"
Start-Process -FilePath "$VARCD\cmdline-tools\latest\bin\avdmanager.bat" -ArgumentList "create avd -n pixel_2 -k `"system-images;android-31;google_apis_playstore;x86_64`" -d `"pixel_2`" --force" -Wait -Verbose -NoNewWindow
Start-Sleep -Seconds 2
}
else {
Write-Message -Message "AVDDownload: $VARCD\emulator\emulator.exe already exists remove everything but this script to perform full reinstall/setup" -Type "WARNING"
Write-Message -Message "Current Working Directory $VARCD" -Type "WARNING"
Start-Sleep -Seconds 1
}
}
############# AVDStart
Function AVDStart {
CheckProcess "Burp Suite" StartBurp
Stop-process -name emulator -Force -ErrorAction SilentlyContinue |Out-Null
Stop-process -name adb -Force -ErrorAction SilentlyContinue |Out-Null
Stop-process -name qemu-system-x86_64 -Force -ErrorAction SilentlyContinue |Out-Null
if (-not(Test-Path -Path "$VARCD\emulator" )) {
AVDDownload
if (-not(Test-Path -Path "$VARCD\emulator" )) {
Write-Message -Message "AVDDownload failed - $VARCD\emulator not found after download" -Type "ERROR"
return
}
Write-Message -Message "AVD downloaded successfully, starting emulator" -Type "INFO"
Start-Sleep -Seconds 2
Write-Message -Message "Do not run emulator with -http-proxy 127.0.0.1:8080 it is not stable" -Type "INFO"
# DO NOT USE THIS IT IS BUGGY ... Start-Process -FilePath "$VARCD\emulator\emulator.exe" -ArgumentList " -avd pixel_2 -writable-system -http-proxy 127.0.0.1:8080" -NoNewWindow
Start-Process -FilePath "$VARCD\emulator\emulator.exe" -ArgumentList " -avd pixel_2 -writable-system " -NoNewWindow
Start-Sleep -Seconds 10
Write-Message -Message "Enbleing keyboard in config.ini" -Type "INFO"
(Get-Content "$VARCD\avd\pixel_2.avd\config.ini") `
-replace 'hw.keyboard = no', 'hw.keyboard = yes' `
-replace 'hw.camera.back.*', 'hw.camera.back = webcam0' `
-replace 'hw.camera.front.*', 'hw.camera.front = none' ` |
Out-File -Encoding Ascii "$VARCD\avd\pixel_2.avd\config.ini"
}
else {
Write-Message -Message "Emulator found at $VARCD\emulator - starting AVD" -Type "INFO"
Start-Sleep -Seconds 2
Start-Process -FilePath "$VARCD\emulator\emulator.exe" -ArgumentList " -avd pixel_2 -writable-system " -NoNewWindow
}
}
############# AVDPoweroff
Function AVDPoweroff {
$varadb=CheckADB
$env:ANDROID_SERIAL=$varadb
$wshell = New-Object -ComObject Wscript.Shell
$pause = $wshell.Popup("Are you sure you want to shutdown?", 0, "Wait!", 48+1)
if ($pause -eq '1') {
Write-Message -Message "Powering Off AVD" -Type "INFO"
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell -t `"reboot -p`"" -Wait -NoNewWindow
KillADB
}
Elseif ($pause = '2') {
Write-Message -Message "Not rebooting..." -Type "INFO"
return
}
}
Function CMDPrompt {
ADBCheckBin
CheckJava
CheckGit
CheckPython
CheckNode
# Check if PowerShell Core (pwsh) is installed
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
$ShellPath = "pwsh"
} else {
$ShellPath = "cmd"
}
# Start the determined shell
Start-Process -FilePath $ShellPath -WorkingDirectory "$VARCD"
if ((Get-Command adb -ErrorAction SilentlyContinue)) {
$varadb = CheckADB
$env:ANDROID_SERIAL = $varadb
Start-Process -FilePath "$VARCD\platform-tools\adb.exe" -ArgumentList " shell " -ErrorAction SilentlyContinue | Out-Null
}
}
############# RootAVD
Function RootAVD {
# I had to start the image before I enabled keyboard ....
Start-Sleep -Seconds 2
if (-not(Test-Path -Path "$VARCD\rootAVD-master" )) {
try {
Write-Message -Message "Downloading rootAVD" -Type "INFO"
# Just in cases : downloadFile "https://github.com/newbit1/rootAVD/archive/refs/heads/master.zip" "$VARCD\rootAVD-master.zip"
downloadFile "https://gitlab.com/newbit/rootAVD/-/archive/master/rootAVD-master.zip" "$VARCD\rootAVD-master.zip"
Write-Message -Message "Extracting rootAVD (Turn On AVD 1st" -Type "INFO"
Expand-Archive -Path "$VARCD\rootAVD-master.zip" -DestinationPath "$VARCD" -Force
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\rootAVD-master already exists" -Type "WARNING"
}
$varadb=CheckADB
$env:ANDROID_SERIAL=$varadb
cd "$VARCD\rootAVD-master"
Write-Message -Message "Running installing magisk via rootAVD to ramdisk.img" -Type "INFO"
Start-Process -FilePath "$VARCD\rootAVD-master\rootAVD.bat" -ArgumentList "system-images\android-31\google_apis_playstore\x86_64\ramdisk.img FAKEBOOTIMG " -WorkingDirectory "$VARCD\rootAVD-master\" -NoNewWindow
Write-Message -Message "rootAVD Finished if the emulator did not close/poweroff try again" -Type "INFO"
Write-Message -Message "#######################################################################################" -Type "WARNING"
Write-Message -Message "# YOU MUST CLICK MAGISK AND INSTALL VIA PATCH IN THE DOWNLOADS FOLDER ON THE EMULATOR #" -Type "WARNING"
Write-Message -Message "#######################################################################################" -Type "WARNING"
}
############# AVDWipeData
Function AVDWipeData {
Write-Message -Message "Starting AVD emulator" -Type "INFO"
$wshell = New-Object -ComObject Wscript.Shell
$pause = $wshell.Popup("Are you sure you want to wipe all data ?!?", 0, "Wait!", 48+1)
if ($pause -eq '1') {
Write-Message -Message "Wiping data you will need to rerun Magisk and push cert" -Type "INFO"
Start-Process -FilePath "$VARCD\emulator\emulator.exe" -ArgumentList " -avd pixel_2 -writable-system -wipe-data" -NoNewWindow
}
Elseif ($pause = '2') {
Write-Message -Message "Not wiping data..." -Type "INFO"
return
}
}
############# CHECK BURP
Function CheckBurp {
$burpPath = "HKCU:\SOFTWARE\JavaSoft\Prefs\burp"
if (Test-Path $burpPath) {
Write-Message -Message "Burp path HKCU:\SOFTWARE\JavaSoft\Prefs\burp already exist not clobbering it" -Type "INFO"
}
else {
Write-Message -Message "Setting up initial burp configs" -Type "INFO"
New-Item -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Force
Set-ItemProperty -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Name "free.suite.alertsdisabledforjre-1817240865" -Value "true" -Type String
Set-ItemProperty -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Name "eulacommunity" -Value "4" -Type String
Set-ItemProperty -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Name "free.suite.feedback/Reporting/Enabled" -Value "false" -Type String
Set-ItemProperty -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Name "free.suite.suppressupdatedialog" -Value "false" -Type String
New-Item -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp\community -Force
New-Item -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp\community\detached-frames -Force
}
Write-Message -Message "Creating folders for custom CloudFlare bypass and ZAP support" -Type "INFO"
New-Item -Path "$env:USERPROFILE\AppData\Roaming\BurpSuite\ConfigLibrary\" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
CheckJava
BurpConfigPush
BurpConfigProxy
if (-not(Test-Path -Path "$VARCD\burpsuite_community.jar" )) {
try {
Write-Message -Message "Downloading Burpsuite Community" -Type "INFO"
downloadFile "https://portswigger.net/burp/releases/download?product=community&type=Jar" "$VARCD\burpsuite_community.jar"
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\Burpsuite already exists" -Type "WARNING"
}
}
############# CheckBurpPro
Function CheckBurpPro {
$burpPath = "HKCU:\SOFTWARE\JavaSoft\Prefs\burp"
if (Test-Path $burpPath) {
Write-Message -Message "Burp path HKCU:\SOFTWARE\JavaSoft\Prefs\burp already exist not clobbering it" -Type "INFO"
}
else {
Write-Message -Message "Setting up initial burp configs" -Type "INFO"
New-Item -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Force
Set-ItemProperty -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Name "free.suite.alertsdisabledforjre-1817240865" -Value "true" -Type String
Set-ItemProperty -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Name "eulacommunity" -Value "4" -Type String
Set-ItemProperty -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Name "free.suite.feedback/Reporting/Enabled" -Value "false" -Type String
Set-ItemProperty -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp -Name "free.suite.suppressupdatedialog" -Value "false" -Type String
New-Item -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp\community -Force
New-Item -Path HKCU:\SOFTWARE\JavaSoft\Prefs\burp\community\detached-frames -Force
}
Write-Message -Message "Creating folders for custom CloudFlare bypass and ZAP support" -Type "INFO"
New-Item -Path "$env:USERPROFILE\AppData\Roaming\BurpSuite\ConfigLibrary\" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
CheckJava
BurpConfigPush
BurpConfigProxy
if (-not(Test-Path -Path "$VARCD\burpsuite_pro.jar" )) {
try {
Write-Message -Message "Downloading Burpsuite Pro" -Type "INFO"
# don't need this I don't think $downloadUri = (Invoke-RestMethod -Method GET -Uri "https://portswigger.net/burp/releases/community/latest") -split '
.*','' } | select -first 1
downloadFile "https://portswigger.net/burp/releases/startdownload?product=pro&type=jar" "$VARCD\burpsuite_pro.jar"
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\Burpsuite Pro already exists" -Type "WARNING"
}
SecListsCheck
}
############# StartBurp
Function StartBurp {
CheckBurp
Write-Message -Message "Setting $env:USERPROFILE back to $USERPROFILE_BACKUP to fix open dialog for Burp Suite" -Type "INFO"
$env:USERPROFILE="$USERPROFILE_BACKUP"
Start-Process -FilePath "$VARCD\jdk\bin\javaw.exe" -WorkingDirectory "$VARCD\jdk\" -ArgumentList " -Xms4000m -Xmx4000m -jar `"$VARCD\burpsuite_community.jar`" --disable-auto-update --use-defaults && "
Write-Message -Message "Waiting for Burp Suite to download cert" -Type "INFO"
Retry{PullCert "Error PullCert"} # -maxAttempts 10
}
############# StartBurpSocks
Function StartBurpSocks {
CheckBurp
Write-Message -Message "Setting $env:USERPROFILE back to $USERPROFILE_BACKUP to fix open dialog for Burp Suite" -Type "INFO"
$env:USERPROFILE="$USERPROFILE_BACKUP"
Start-Process -FilePath "$VARCD\jdk\bin\javaw.exe" -WorkingDirectory "$VARCD\jdk\" -ArgumentList " -Xms4000m -Xmx4000m -jar `"$VARCD\burpsuite_community.jar`" --use-defaults --disable-auto-update --user-config-file=`"$VARCD\AppData\Roaming\BurpSuite\BurpConfigProxy.json` && "
Write-Message -Message "Waiting for Burp Suite to download cert" -Type "INFO"
Retry{PullCert "Error PullCert"} # -maxAttempts 10
}
############# StartBurpPro
Function StartBurpPro {
CheckBurp
Write-Message -Message "Setting $env:USERPROFILE back to $USERPROFILE_BACKUP to fix open dialog for Burp Suite" -Type "INFO"
$env:USERPROFILE="$USERPROFILE_BACKUP"
$BurpProLatest = Get-ChildItem -Force -Recurse -File -Path "$VARCD" -Depth 0 -Filter *pro*.jar -ErrorAction SilentlyContinue | Sort-Object LastwriteTime -Descending | select -first 1
Start-Process -FilePath "$VARCD\jdk\bin\javaw.exe" -WorkingDirectory "$VARCD\jdk\" -ArgumentList " -Xms4000m -Xmx4000m -jar `"$VARCD\$BurpProLatest`" --use-defaults && "
# wait for burp to setup env paths for config
Start-Sleep -Seconds 2
Write-Message -Message "Waiting for Burp Suite to download cert" -Type "INFO"
Retry{PullCert "Error PullCert"} # -maxAttempts 10
}
############# StartBurpProSocks
Function StartBurpProSocks {
CheckBurp
Write-Message -Message "Setting $env:USERPROFILE back to $USERPROFILE_BACKUP to fix open dialog for Burp Suite" -Type "INFO"
$env:USERPROFILE="$USERPROFILE_BACKUP"
$BurpProLatest = Get-ChildItem -Force -Recurse -File -Path "$VARCD" -Depth 0 -Filter *pro*.jar -ErrorAction SilentlyContinue | Sort-Object LastwriteTime -Descending | select -first 1
Start-Process -FilePath "$VARCD\jdk\bin\javaw.exe" -WorkingDirectory "$VARCD\jdk\" -ArgumentList " -Xms4000m -Xmx4000m -jar `"$VARCD\$BurpProLatest`" --user-config-file=`"$VARCD\AppData\Roaming\BurpSuite\BurpConfigProxy.json`" && "
# wait for burp to setup env paths for config
Write-Message -Message "Waiting for Burp Suite to download cert" -Type "INFO"
Retry{PullCert "Error PullCert"} # -maxAttempts 10
}
############# BurpWithZap
Function BurpWithZap {
CheckBurp
StartBurpSocks
StartZAP
}
############# BurpProWithZap
Function BurpProWithZap {
CheckBurp
StartBurpProSocks
StartZAP
}
############# BurpConfigPush
Function BurpConfigPush {
Write-Message -Message "Pushing Burp Crawler scan config for bypassing CloudFlare" -Type "INFO"
# BurpConfigChrome.json
$BurpConfigChrome = @'
{
"crawler":{
"crawl_limits":{
"maximum_crawl_time":0,
"maximum_request_count":0,
"maximum_unique_locations":0
},
"crawl_optimization":{
"allow_all_clickables":false,
"await_navigation_timeout":10,
"breadth_first_until_depth":5,
"crawl_strategy":"fastest",
"crawl_strategy_customized":false,
"crawl_using_provided_logins_only":false,
"discovered_destinations_group_size":2147483647,
"error_destination_multiplier":1,
"form_destination_optimization_threshold":1,
"form_submission_optimization_threshold":1,
"idle_time_for_mutations":0,
"incy_wincy":true,
"link_fingerprinting_threshold":1,
"logging_directory":"",
"logging_enabled":false,
"loopback_link_fingerprinting_threshold":1,
"maximum_form_field_permutations":4,
"maximum_form_permutations":5,
"maximum_link_depth":0,
"maximum_state_changing_sequences":0,
"maximum_state_changing_sequences_length":3,
"maximum_state_changing_sequences_per_destination":0,
"maximum_unmatched_anchor_tolerance":3,
"maximum_unmatched_form_tolerance":0,
"maximum_unmatched_frame_tolerance":0,
"maximum_unmatched_iframe_tolerance":3,
"maximum_unmatched_image_area_tolerance":0,
"maximum_unmatched_redirect_tolerance":0,
"recent_destinations_buffer_size":1,
"total_unmatched_feature_tolerance":3
},
"crawl_project_option_overrides":{
"connect_timeout":3,
"normal_timeout":3
},
"customization":{
"allow_out_of_scope_resources":true,
"application_uses_fragments_for_routing":"unsure",
"browser_based_navigation_mode":"only_if_hardware_supports",
"customize_user_agent":true,
"maximum_items_from_sitemap":1000,
"maximum_speculative_links":1000,
"parse_api_definitions":true,
"request_robots_txt":false,
"request_sitemap":true,
"request_speculative":true,
"submit_forms":true,
"timeout_for_in_progress_resource_requests":10,
"user_agent":"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
},
"error_handling":{
"number_of_follow_up_passes":0,
"pause_task_requests_timed_out_count":0,
"pause_task_requests_timed_out_percentage":0
},
"login_functions":{
"attempt_to_self_register_a_user":true,
"trigger_login_failures":true
}
}
}
'@
$BurpConfigChrome |set-Content "$env:USERPROFILE\AppData\Roaming\BurpSuite\ConfigLibrary\_JAMBOREE_Crawl_Level_01.json"
}
############# BurpConfigProxy
Function BurpConfigProxy {
Write-Message -Message "Pushing Burp Suite user config for Upstream Proxy for ZAP support" -Type "INFO"
# BurpConfigProxy.json
$BurpConfigProxy = @'
{
"user_options":{
"connections":{
"platform_authentication":{
"credentials":[],
"do_platform_authentication":true,
"prompt_on_authentication_failure":false
},
"socks_proxy":{
"dns_over_socks":false,
"host":"",
"password":"",
"port":0,
"use_proxy":false,
"username":""
},
"upstream_proxy":{
"servers":[
{
"destination_host":"*",
"enabled":true,
"proxy_host":"localhost",
"proxy_port":8081
}
]
}
},
"client_certificates":{
"certificates":[]
},
"negotiation":{
"disable_sni_extension":false,
"enable_blocked_algorithms":true
}
}
}
'@
$BurpConfigProxy |set-Content "$env:USERPROFILE\AppData\Roaming\BurpSuite\BurpConfigProxy.json"
}
############# PullCert
Function PullCert {
Invoke-WebRequest -Uri "http://burp/cert" -Proxy 'http://localhost:8080' -Out "$VARCD\BURP.der" -Verbose
Start-Process -FilePath "$env:SYSTEMROOT\System32\certutil.exe" -ArgumentList " -user -addstore `"Root`" `"$VARCD\BURP.der`" " -NoNewWindow -Wait
}
############# ZAPCheck
Function ZAPCheck {
CheckJava
if (-not(Test-Path -Path "$VARCD\ZAP" )) {
try {
Write-Message -Message "Downloading ZAP" -Type "INFO"
$xmlResponseIWR = Invoke-WebRequest -Method GET -Uri 'https://raw.githubusercontent.com/zaproxy/zap-admin/master/ZapVersions.xml' -OutFile ZapVersions.xml
[xml]$xmlAttr = Get-Content -Path ZapVersions.xml
Write-Message -Message ([xml]$xmlAttr).ZAP.core.daily.url -Type "INFO"
downloadFile ([xml]$xmlAttr).ZAP.core.daily.url "$VARCD\ZAP.zip"
Write-Message -Message "Extracting ZAP" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\ZAP.zip", "$VARCD")
Get-ChildItem "$VARCD\ZAP_D*" | Rename-Item -NewName { $_.Name -replace '_.*','' }
###
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\ZAP already exists" -Type "WARNING"
}
}
############# StartZAP
Function StartZAP {
ZAPCheck
Write-Message -Message "Starting ZAP" -Type "INFO"
# https://www.zaproxy.org/faq/how-do-you-find-out-what-key-to-use-to-set-a-config-value-on-the-command-line/
$ZAPJarPath = (Get-ChildItem "$VARCD\ZAP\*.jar")
Start-Process -FilePath "$VARCD\jdk\bin\javaw.exe" -WorkingDirectory "$VARCD\jdk\" -ArgumentList " -Xms4000m -Xmx4000m -jar `"$ZAPJarPath`" -config network.localServers.mainProxy.address=localhost -config network.localServers.mainProxy.port=8081 "
#Start-Process -FilePath "$VARCD\jdk\bin\javaw.exe" -WorkingDirectory "$VARCD\jdk\" -ArgumentList " -Xms4000m -Xmx4000m -jar `"$ZAPJarPath`" -config network.localServers.mainProxy.address=localhost -config network.localServers.mainProxy.port=8081 -config network.connection.httpProxy.host=localhost -config network.connection.httpProxy.port=8080 -config network.connection.httpProxy.enabled=true"
Write-Message -Message "Waiting 20 seconds to download smaller dirbuster file raft-small-directories-lowercase.txt" -Type "INFO"
Start-Sleep -Seconds 20
Invoke-WebRequest -Uri "https://github.com/fuzzdb-project/fuzzdb/raw/refs/heads/master/discovery/predictable-filepaths/filename-dirname-bruteforce/raft-small-directories-lowercase.txt" -OutFile "$env:USERPROFILE\ZAP_D\fuzzers\dirbuster\raft-small-directories-lowercase.txt"
}
############# Retry
function Retry()
{
param(
[Parameter(Mandatory=$true)][Action]$action,
[Parameter(Mandatory=$false)][int]$maxAttempts = 10
)
$attempts=1
$ErrorActionPreferenceToRestore = $ErrorActionPreference
$ErrorActionPreference = "Stop"
do
{
try
{
$action.Invoke();
break;
}
catch [Exception]
{
Write-Message -Message $_.Exception.Message -Type "INFO"
}
# exponential backoff delay
$attempts++
if ($attempts -le $maxAttempts) {
$retryDelaySeconds = [math]::Pow(2, $attempts)
$retryDelaySeconds = $retryDelaySeconds - 1 # Exponential Backoff Max == (2^n)-1
Write-Message -Message ("Action failed. Waiting " + $retryDelaySeconds + " seconds before attempt " + $attempts + " of " + $maxAttempts + ".") -Type "INFO"
Start-Sleep $retryDelaySeconds
}
else {
$ErrorActionPreference = $ErrorActionPreferenceToRestore
Write-Error $_.Exception.Message
}
} while ($attempts -le $maxAttempts)
$ErrorActionPreference = $ErrorActionPreferenceToRestore
}
############# SecListsCheck
Function SecListsCheck {
if (-not(Test-Path -Path "$VARCD\SecLists-master" )) {
try {
Write-Message -Message "Downloading SecLists.zip PLEASE WAIT..." -Type "INFO"
downloadFile "https://github.com/danielmiessler/SecLists/archive/refs/heads/master.zip" "$VARCD\SecLists.zip"
Write-Message -Message "Extracting SecLists.zip" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\SecLists.zip", "$VARCD")
#Get-ChildItem "$VARCD\ZAP_D*" | Rename-Item -NewName { $_.Name -replace '_.*','' }
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\SecLists-master already exists" -Type "WARNING"
}
}
############# SharpHoundRun
Function SharpHoundRun {
Write-Message -Message 'Example Runas Usage: runas /user:"nr.ad.COMPANY.com\USERNAME" /netonly cmd' -Type "INFO"
if (-not(Test-Path -Path "$VARCD\SharpHound.exe" )) {
try {
Write-Message -Message "Sharphound Missing Downloading" -Type "INFO"
downloadFile "https://github.com/BloodHoundAD/BloodHound/raw/master/Collectors/DebugBuilds/SharpHound.exe" "$VARCD\SharpHound.exe"
}
catch {
throw $_.Exception.Message
}
}
Write-Message -Message "Starting SharpHound" -Type "INFO"
Start-Process -FilePath "$VARCD\SharpHound.exe" -WorkingDirectory "$VARCD\" -ArgumentList " -s --CollectionMethods All --prettyprint true "
}
############# Neo4jRun
Function Neo4jRun {
CheckJavaNeo4j
# Neo4j
if (-not(Test-Path -Path "$VARCD\Neo4j" )) {
try {
Write-Message -Message "Downloading Neo4j" -Type "INFO"
downloadFile "https://dist.neo4j.org/neo4j-community-4.4.19-windows.zip" "$VARCD\Neo4j.zip"
Write-Message -Message "Extracting Neo4j" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\Neo4j.zip", "$VARCD")
Get-ChildItem "$VARCD\neo4j-community*" | Rename-Item -NewName { $_.Name -replace '-.*','' }
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\Neo4j.zip already exists" -Type "WARNING"
}
Write-Message -Message "Starting Neo4j" -Type "INFO"
Start-Process -FilePath "$VARCD\jdk_neo4j\bin\java.exe" -WorkingDirectory "$VARCD\neo4j\lib" -ArgumentList " -cp `"$VARCD\neo4j/lib/*`" -Dbasedir=`"$VARCD\neo4j`" org.neo4j.server.startup.Neo4jCommand `"console`" "
Write-Message -Message "Wait for Neo4j You must change password at http://localhost:7474 Login/Pw is neo4j:neo4j" -Type "WARNING"
}
############# BloodhoundRun
Function BloodhoundRun {
CheckJava
# pull custom searches
Stop-process -name BloodHound -Force -ErrorAction SilentlyContinue |Out-Null
if (-not(Test-Path -Path "$VARCD\BloodHound-win32-x64" )) {
try {
Write-Message -Message "Downloading BloodHound" -Type "INFO"
#downloadFile "https://github.com/BloodHoundAD/BloodHound/releases/download/4.2.0/BloodHound-win32-x64.zip" "$VARCD\BloodHound-win32-x64.zip"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/BloodHoundAD/BloodHound/releases/latest").assets | Where-Object name -like BloodHound-win32-x64*.zip ).browser_download_url
downloadFile $downloadUri "$VARCD\BloodHound-win32-x64.zip"
Write-Message -Message "Extracting BloodHound" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\BloodHound-win32-x64.zip", "$VARCD")
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\BloodHound-win32-x64 already exists" -Type "WARNING"
}
Write-Message -Message "Starting BloodHound" -Type "INFO"
Write-Message -Message "Use the creds you changed from neo4j" -Type "WARNING"
Start-Process -FilePath "$VARCD\BloodHound-win32-x64\BloodHound.exe" -WorkingDirectory "$VARCD\"
}
############# CHECK CheckGit
Function CheckGit {
Write-Message -Message "Checking Git" -Type "INFO"
if (-not(Test-Path -Path "$VARCD\PortableGit" )) {
try {
Write-Message -Message "Downloading Git" -Type "INFO"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/git-for-windows/git/releases/latest").assets | Where-Object name -like *PortableGit*64*.exe ).browser_download_url | select -first 1
downloadFile "$downloadUri" "$VARCD\git7zsfx.exe"
# https://superuser.com/questions/1104567/how-can-i-find-out-the-command-line-options-for-git-bash-exe
# file:///C:/Users/Administrator/SDUI/git/mingw64/share/doc/git-doc/git-bash.html#GIT-WRAPPER
Start-Process -FilePath "$VARCD\git7zsfx.exe" -WorkingDirectory "$VARCD\" -ArgumentList " -o`"$VARCD\PortableGit`" -y " -wait -NoNewWindow
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\Git already exists" -Type "WARNING"
}
}
############# CHECK pycharm
Function CheckPyCharm {
Check7zip
CheckGit
CheckPython
if (-not(Test-Path -Path "$VARCD\pycharm-community" )) {
try {
Write-Message -Message "Downloading latest PyCharm Community" -Type "INFO"
$downloadUri = (Invoke-RestMethod -Method GET -Uri "https://data.services.jetbrains.com/products?code=PCP%2CPCC&release.type=release").releases.downloads.windows.link -match 'pycharm-community'| select -first 1
downloadFile "$downloadUri" "$VARCD\pycharm-community.exe"
Write-Message -Message "Extracting PyCharm" -Type "INFO"
Start-Process -FilePath "$VARCD\7zip\7z.exe" -ArgumentList "x `"$VARCD\pycharm-community.exe`" -o`"$VARCD\pycharm-community`"" -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\pycharm-community\bin\pycharm64.exe" -WorkingDirectory "$VARCD\pycharm-community" -NoNewWindow
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\pycharm-community already exists starting PyCharm" -Type "WARNING"
Start-Process -FilePath "$VARCD\pycharm-community\bin\pycharm64.exe" -WorkingDirectory "$VARCD\pycharm-community" -NoNewWindow
}
}
############# CHECKvscode
Function CheckVSCode {
Check7zip
CheckGit
CheckPython
CheckNode
if (-not(Test-Path -Path "$VARCD\vscode" )) {
try {
Write-Message -Message "Downloading latest VSCode" -Type "INFO"
downloadFile "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-archive" "$VARCD\vscode.zip"
Write-Message -Message "Extracting VSCode" -Type "INFO"
Start-Process -FilePath "$VARCD\7zip\7z.exe" -ArgumentList "x `"$VARCD\vscode.zip`" -o`"$VARCD\vscode`"" -NoNewWindow -Wait
Start-Process -FilePath "$VARCD\vscode\Code.exe" -WorkingDirectory "$VARCD\vscode"
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\vscode\Code.exe already exists starting" -Type "WARNING"
Start-Process -FilePath "$VARCD\vscode\Code.exe" -WorkingDirectory "$VARCD\vscode"
}
}
############# CHECK 7zip
Function Check7zip {
if (-not(Test-Path -Path "$VARCD\7zip" )) {
try {
Write-Message -Message "Downloading latest 7zip" -Type "INFO"
$downloadUri = (Invoke-RestMethod -Method GET -Uri "https://www.7-zip.org/download.html") -split '\n' -match '.*exe.*' | ForEach-Object {$_ -ireplace '.* href="','' -ireplace '".*',''}| select -first 1
downloadFile "$downloadUri" "$VARCD\7zip.exe"
$Env:__COMPAT_LAYER='RunAsInvoker'
Start-Process -FilePath "$VARCD\7zip.exe" -ArgumentList "/S /D=$VARCD\7zip" -NoNewWindow -Wait
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\7zip already exists " -Type "WARNING"
}
}
############# CheckProcess
function CheckProcess($windowTitle, $ProcessName) {
if (Get-Process | Where-Object { $_.MainWindowTitle -like "*$windowTitle*" }) {
Write-Message -Message "Window with title '$windowTitle' is running." -Type "INFO"
} else {
Write-Message -Message "Starting $ProcessName" -Type "INFO"
$ProcessName
}
}
############# CheckArduino
Function CheckArduino {
CheckGit
CheckPython
Write-Message -Message "Checking for Arduino" -Type "INFO"
if (-not(Test-Path -Path "$VARCD\Arduino" )) {
try {
#Arduino stuff
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/arduino/arduino-ide/releases/latest").assets | Where-Object name -like *Windows_64bit.zip ).browser_download_url
Write-Message -Message "Downloading Arduino.zip" -Type "INFO"
downloadFile "$downloadUri" "$VARCD\Arduino.zip"
Write-Message -Message "Extracting Arduino.zip" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\Arduino.zip", "$VARCD\Arduino")
# Digistump drivers
Write-Message -Message "Download/Installing Digistump Drivers ( ##### ADMIN REQUIRED ##### ) " -Type "WARNING"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/digistump/DigistumpArduino/releases/latest").assets | Where-Object name -like *Digistump.Drivers.zip ).browser_download_url
Write-Message -Message "Downloading Digistump.Drivers.zip" -Type "INFO"
downloadFile "$downloadUri" "$VARCD\Digistump.Drivers.zip"
Write-Message -Message "Extracting Digistump.Drivers.zip" -Type "INFO"
Expand-Archive -Path "$VARCD\Digistump.Drivers.zip" -DestinationPath "$VARCD\" -Force
Write-Message -Message "Installing Drivers" -Type "INFO"
try {
Start-Process -FilePath "$VARCD\Digistump Drivers\Install Drivers.exe" -WorkingDirectory "$VARCD" -ErrorAction SilentlyContinue
} catch {
Write-Message -Message "Not running as admin or driver faild install" -Type "WARNING"
}
# add Digistump board to Arduino
Write-Message -Message "Adding Digistump board to Arduino IDE" -Type "INFO"
Start-Process -FilePath "$VARCD\Arduino\resources\app\lib\backend\resources\arduino-cli.exe" -WorkingDirectory "$VARCD\Arduino\resources\app\lib\backend\resources\" -ArgumentList " config init " -wait -NoNewWindow
Start-Process -FilePath "$VARCD\Arduino\resources\app\lib\backend\resources\arduino-cli.exe" -WorkingDirectory "$VARCD\Arduino\resources\app\lib\backend\resources\" -ArgumentList " config init " -wait -NoNewWindow
Start-Process -FilePath "$VARCD\Arduino\resources\app\lib\backend\resources\arduino-cli.exe" -WorkingDirectory "$VARCD\Arduino\resources\app\lib\backend\resources\" -ArgumentList " core update-index " -wait -NoNewWindow
Start-Process -FilePath "$VARCD\Arduino\resources\app\lib\backend\resources\arduino-cli.exe" -WorkingDirectory "$VARCD\Arduino\resources\app\lib\backend\resources\" -ArgumentList " core update-index --additional-urls `"https://raw.githubusercontent.com/digistump/arduino-boards-index/master/package_digistump_index.json`" " -wait -NoNewWindow
Start-Process -FilePath "$VARCD\Arduino\resources\app\lib\backend\resources\arduino-cli.exe" -WorkingDirectory "$VARCD\Arduino\resources\app\lib\backend\resources\" -ArgumentList " core install digistump:avr --additional-urls `"https://raw.githubusercontent.com/digistump/arduino-boards-index/master/package_digistump_index.json`" " -wait -NoNewWindow
# add digiduck for duck to ino
Write-Message -Message "Downloading digiduck" -Type "INFO"
Start-Process -FilePath "$VARCD\PortableGit\cmd\git.exe" -WorkingDirectory "$VARCD" -ArgumentList " clone `"https://github.com/molatho/digiduck.git`" " -wait -NoNewWindow
# get old payloads
$downloadUri = "https://github.com/hak5/usbrubberducky-payloads/archive/1d3e9be7ba3f80cdb008885fac49be2ba926649d.zip"
Write-Message -Message "Downloading Old example payloads " -Type "INFO"
downloadFile "$downloadUri" "$VARCD\1d3e9be7ba3f80cdb008885fac49be2ba926649d.zip"
Write-Message -Message "Extracting Old example payloads" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\1d3e9be7ba3f80cdb008885fac49be2ba926649d.zip", "$VARCD\_Old_Ducky_payloads")
Write-Message -Message "Starting Arduino IDE" -Type "INFO"
Start-Process -FilePath "$VARCD\Arduino\Arduino IDE.exe" -WorkingDirectory "$VARCD" -ArgumentList " `"$VARCD\digiduck\example.ino`" "
}
catch {
throw $_.Exception.Message
}
}
else {
Write-Message -Message "$VARCD\Arduino.zip already exists" -Type "INFO"
Write-Message -Message "Starting Arduino IDE" -Type "INFO"
Start-Process -FilePath "$VARCD\Arduino\Arduino IDE.exe" -WorkingDirectory "$VARCD" -ArgumentList " `"$VARCD\digiduck\example.ino`" "
}
}
############# PushDuckyLoad
Function PushDuckyLoad {
CheckGit
CheckPython
Write-Message -Message "Opening digiduck\example.duck" -Type "INFO"
Start-Process "notepad" -WorkingDirectory "$VARCD" -ArgumentList "`"$VARCD\digiduck\example.duck`" " -wait -NoNewWindow
Write-Message -Message "Encoding digiduck.py ..\duck2spark\example.duck -ofile ..\duck2spark\example.ino " -Type "INFO"
Remove-Item -Path "$VARCD\digiduck\example.ino" -Force -ErrorAction SilentlyContinue |Out-Null
Start-Process -FilePath "python" -WorkingDirectory "$VARCD\digiduck\" -ArgumentList " `"$VARCD\digiduck\digiduck.py`" `"$VARCD\digiduck\example.duck`" -ofile `"$VARCD\digiduck\example.ino`" " -NoNewWindow -Wait -RedirectStandardOutput RedirectStandardOutput.txt -RedirectStandardError RedirectStandardError.txt
}
function Get-ScriptPathFromCallStack {
# Get the current call stack
$callStack = Get-PSCallStack
# Iterate through the call stack entries
foreach ($stackFrame in $callStack) {
# Check if the InvocationInfo.MyCommand.CommandType is ExternalScript, which indicates a script file
if ($stackFrame.InvocationInfo.MyCommand.CommandType -eq 'ExternalScript') {
# Return the script path
return $stackFrame.InvocationInfo.MyCommand.Definition
}
}
# If no script file was found in the call stack, return $null or an appropriate message
return $null
}
############# UpdateJAMBO
Function UpdateJAMBO {
$JAMBOPATH = Get-ScriptPathFromCallStack
Write-Message -Message "Downloading latest JAMBOREE to $JAMBOPATH" -Type "INFO"
Invoke-WebRequest -Method GET -Uri 'https://github.com/freeload101/Java-Android-Magisk-Burp-Objection-Root-Emulator-Easy/raw/main/JAMBOREE.ps1' -OutFile "$JAMBOPATH"
Write-Message -Message "Restarting" -Type "INFO"
Start-Sleep -Seconds 1
Set-Variable -Name ErrorActionPreference -Value SilentlyContinue
Start-Process -FilePath "powershell" -WorkingDirectory "$VARCD\" -ArgumentList " -File `"$JAMBOPATH`" " -ErrorAction SilentlyContinue
#exit 0
}
############# CheckPostgres
Function CheckPostgres {
if (-not(Test-Path -Path "$VARCD\PG" )) {
New-Item -Path "$VARCD\PG" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
$downloadUri = (Invoke-WebRequest -Uri "https://www.enterprisedb.com/downloads/postgres-postgresql-downloads" -UseBasicParsing).Content -split '>' -match '.*href.*sbp.enterprisedb.*' | ForEach-Object {$_ -ireplace ".*href=",'' -ireplace "`"",'' } | Select-Object -Index 1
Write-Message -Message "Downloading postgres installer for windows $downloadUri" -Type "INFO"
# idk I hate anti bots so much ...
downloadFile "$downloadUri" "$VARCD\postgresql.exe"
Write-Message -Message "setting __COMPAT_LAYER=RUNASINVOKER " -Type "INFO"
$env:__COMPAT_LAYER = "RUNASINVOKER"
Write-Message -Message "Extracting This takes a long time .. like 400 megs ..." -Type "INFO"
Start-Process -FilePath "$VARCD\postgresql.exe" -WorkingDirectory "$VARCD\PG" -ArgumentList " --extract-only 1 --mode unattended --prefix `"$VARCD\PG`" " -wait -NoNewWindow
Write-Message -Message "Wiping folder `"$VARCD\share\locale`" " -Type "INFO"
Remove-Item -Path "$VARCD\PG\share\locale" -Force -ErrorAction SilentlyContinue -Confirm:$false -Recurse |Out-Null
Write-Message -Message "Init database... " -Type "INFO"
Start-Process -FilePath "$VARCD\PG\bin\initdb.exe" -WorkingDirectory "$VARCD\PG" -ArgumentList " -U `"$env:PGUSER`" -A trust -E utf8 --locale=C " -NoNewWindow -Wait
Write-Message -Message "Starting pg_ctl.exe " -Type "INFO"
Start-Process -FilePath "$VARCD\PG\bin\pg_ctl.exe" -WorkingDirectory "$VARCD\PG" -ArgumentList " -D `"$env:PGDATA`" -l `"$env:PGLOG`" -w start "
Start-Sleep -Seconds 10
Write-Message -Message "Starting psql.exe " -Type "INFO"
Start-Process -FilePath "$VARCD\PG\bin\psql.exe" -WorkingDirectory "$VARCD\PG" -ArgumentList " --port=`"$env:PGPORT`" --dbname=`"$env:PGDATABASE`" --username=`"$env:PGUSER`" "
}
else {
Write-Message -Message "Starting pg_ctl.exe " -Type "INFO"
Start-Process -FilePath "$VARCD\PG\bin\pg_ctl.exe" -WorkingDirectory "$VARCD\PG" -ArgumentList " -D `"$env:PGDATA`" -l `"$env:PGLOG`" -w start "
Start-Sleep -Seconds 10
Write-Message -Message "Starting psql.exe " -Type "INFO"
Start-Process -FilePath "$VARCD\PG\bin\psql.exe" -WorkingDirectory "$VARCD\PG" -ArgumentList " --port=`"$env:PGPORT`" --dbname=`"$env:PGDATABASE`" --username=`"$env:PGUSER`" "
}
}
############# Ytdlp
Function Ytdlp {
CheckGit
if (-not(Test-Path -Path "$VARCD\ytdlp" )) {
New-Item -Path "$VARCD\ytdlp" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
Write-Message -Message "Downloading Latest yt-dlp" -Type "INFO"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest").assets | Where-Object name -like yt-dlp.exe ).browser_download_url
downloadFile "$downloadUri" "$VARCD\ytdlp\yt-dlp.exe"
Copy-Item "$VARCD\ytdlp\yt-dlp.exe" "$USERPROFILE_BACKUP\AppData\Local\Microsoft\WindowsApps\yt-dlp.exe" -ErrorAction SilentlyContinue
Write-Message -Message "Downloading Latest ffmpeg-master-latest-win64-gpl-shared.zip" -Type "INFO"
downloadFile "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip" "$VARCD\ytdlp\ffmpeg-master-latest-win64-gpl-shared.zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\ytdlp\ffmpeg-master-latest-win64-gpl-shared.zip", "$VARCD\ytdlp")
$env:Path = "$env:Path;$VARCD\C:\ROBERT\ytdlp\ffmpeg-master-latest-win64-gpl-shared\bin"
Remove-Item -Path "$VARCD\ytdlp\ffmpeg-master-latest-win64-gpl-shared.zip" -Force -ErrorAction SilentlyContinue |Out-Null
}
Write-Message -Message "Opening $VARCD\ytdlp\LIST.txt" -Type "INFO"
New-Item -Path "$VARCD\ytdlp\LIST.txt" -ItemType "file" -ErrorAction SilentlyContinue -Force
start-sleep -Seconds 1
Start-Process "notepad" -WorkingDirectory "$VARCD" -ArgumentList " `"$VARCD\ytdlp\LIST.txt`" " -wait -NoNewWindow
Get-Content "$VARCD\ytdlp\LIST.txt" | ForEach-Object {
Write-Message -Message "Downloading $_" -Type "INFO"
$GetDate = Get-Date -Format yyyyMMddTHHmmss
Write-Message -Message " --ffmpeg-location `"$VARCD\ytdlp\ffmpeg-master-latest-win64-gpl-shared\bin`" -o `"$GetDate %(upload_date)s - %(title)s.%(ext)s`" `"$_`" " -Type "INFO"
Start-Process "$VARCD\ytdlp\yt-dlp.exe" -WorkingDirectory "$VARCD\ytdlp" -ArgumentList " --ffmpeg-location `"$VARCD\ytdlp\ffmpeg-master-latest-win64-gpl-shared\bin`" -o `"$GetDate %(upload_date)s - %(title)s.%(ext)s`" `"$_`" " -wait -NoNewWindow
# old multi stream downloading script don't use because multi threaded downloads do not always work ...
# wget -q -U "rmccurdy.com" -q -P aria2 -e robots=off -nd -r "https://github.com/aria2/aria2/releases/latest" --max-redirect 1 -l 1 -A "latest,aria*win*64*.zip" -R '*.gz,release*.*' --regex-type pcre --accept-regex "aria2-.*-win-64bit-build1.zip"
# wget -q -U "rmccurdy.com" -q -P ffmpeg -e robots=off -nd -r "https://github.com/BtbN/FFmpeg-Builds/releases/latest" --max-redirect 1 -l 1 -R '*shared*,*lgpl*,autobuild-*.*' --regex-type pcre --accept-regex "latest.*" --regex-type pcre --accept-regex "autobuild.*" --regex-type pcre --accept-regex "ffmpeg-n.*-win64-gpl-[0-9].*.zip"
# start "aria2c !UUID!" cmd /c yt-dlp.exe -w --no-continue --merge-output-format mkv --ffmpeg-location .\ -o ".\downloads\%%(uploader)s - %%(title)s - %%(id)s_!UUID!.%%(ext)s" -i --external-downloader aria2c --external-downloader-args " -x 16 -s 16 -k 1M" "%%A" ^& pause
}
Invoke-Item "$VARCD\ytdlp"
}
############# WSLShrink
Function WSLShrink {
CheckAdmin
$distroNameArray = @()
Get-ChildItem "HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss" |
ForEach-Object {
$distroName = (Get-ItemProperty $_.PSPath).DistributionName
$basePath = (Get-ItemProperty $_.PSPath).BasePath
$distroNameArray += $distroName + "," + $basePath
}
$distroSelect = ($distroNameArray | Out-GridView -Title "Select WSL image to Shrink" -OutputMode Single)
$Global:distroSelectPath = $distroSelect -replace '.*,','' -replace '\\\\\?\\',''
Write-Message -Message "Global:distroSelectPath: $Global:distroSelectPath" -Type "INFO"
Write-Message -Message "Shutting down wsl" -Type "INFO"
Start-Process -FilePath "wsl" -ArgumentList " --shutdown " -wait -NoNewWindow
Start-Sleep -Seconds 10
Write-Message -Message "Optimize-VHD $Global:distroSelectPath *.vhd* " -Type "INFO"
Get-ChildItem -Path "$distroSelectPath" -Filter *.vhdx -Recurse | Select-Object FullName | % {Mount-VHD $_.FullName -ReadOnly; Optimize-VHD $_.FullName -Mode full; Dismount-VHD $_.FullName}
Write-Message -Message "COMPLETE: Optimize-VHD $Global:distroSelectPath *.vhd* " -Type "INFO"
}
############# CheckImage
function CheckImage{
WSLEnableUpdate
$env:WSL_UTF8 = 1
$wslImage = "Ubuntu-22.04"
Start-Process -FilePath "$env:WSLBIN" -ArgumentList " --list" -NoNewWindow -RedirectStandardOutput "RedirectStandardOutput.txt" -Wait
Start-Sleep -Seconds 1
$wslInfo = Get-Content -Path "RedirectStandardOutput.txt"
# check for existing $wslImage
if (($wslInfo) -match (".*$wslImage.*")) {
if ( $Global:NOGUI -ne '1' ) {
$wshell = New-Object -ComObject Wscript.Shell
$pause = $wshell.Popup("Do you want to use $wslImage as your base clean image for JAMBOREE?", 0, "Wait!", 4)
if ($pause -eq '6') {
return
}
Elseif ($pause = '7') {
Write-Message -Message "You will need to create a base image $wslImage for JAMBOREE!" -Type "ERROR"
Start-Sleep 10
[Environment]::Exit(1)
}
}
} ELSE {
# create base image
Write-Message "No $wslImage image found. Installing base $wslImage WSL image" -Type "WARNING"
Start-Process -FilePath "$env:WSLBIN" -ArgumentList " --install -d $wslImage " -wait
}
}
############# WipeForwardRules
Function WipeForwardRules {
CheckAdmin
Write-Message -Message "About to clear the following interface portproxy rules..." -Type "ERROR"
Start-Process -FilePath "netsh" -ArgumentList " interface portproxy show all " -wait -NoNewWindow
Start-Sleep 10
$output = netsh interface portproxy show all | ForEach-Object {
$_ -replace '^\s+','' -replace '\s+$',''
} | Where-Object {$_ -match '\S'} | ConvertFrom-String -PropertyNames @('ListenAddress','ListenPort','ConnectAddress','ConnectPort') -Delimiter '\s+'
$output| ForEach-Object {
netsh interface portproxy delete v4tov4 listenport=$($_.ListenPort) listenaddress=$($_.ListenAddress)
}
Write-Message -Message "Cleared interface portproxy rules..." -Type "INFO"
}
############# CheckVer
Function CheckVer {
Write-Message -Message "Checking for updates.." -Type "INFO"
# Download the PS1 file content from GitHub
$scriptContent = Invoke-WebRequest -Uri "https://github.com/freeload101/Java-Android-Magisk-Burp-Objection-Root-Emulator-Easy/raw/refs/heads/main/JAMBOREE.ps1" -UseBasicParsing -TimeoutSec 3 | Select-Object -ExpandProperty Content
if ($scriptContent -match '\$Global:VerNum\s+\=\s+''(.*)''') {
$VerNumLatest = $matches[1]
# Compare versions
if ($VerNumLatest -ne $Global:VerNum) {
Write-Message -Message "Version mismatch! Current version: $Global:VerNum, Latest version: $VerNumLatest" -Type "WARNING"
} else {
Write-Message -Message "Running Latest $Global:VerNum !" -Type "INFO"
}
} else {
Write-Message -Message "Could not find `$VerNum in the downloaded script" -Type "ERROR"
}
}
############# ADBDumpDisplayName
function ADBDumpDisplayName{
param(
[string]$OutputPath = "apps.csv",
[int]$MaxThreads = 30
)
ADBCheckBin
# Configuration
$aapt2Url = "https://github.com/JonForShort/android-tools/raw/master/build/android-11.0.0_r33/aapt2/armeabi-v7a/bin/aapt2"
$devicePath = "/data/local/tmp/aapt2"
$localPath = "$env:TEMP\aapt2"
# Check if aapt2 exists on device
Write-Message -Message "Checking for aapt2 on device..." -Type "INFO"
$aapt2Exists = adb shell "test -f $devicePath && echo 'exists' || echo 'missing'"
if ($aapt2Exists -match "missing") {
Write-Message -Message "aapt2 not found. Downloading and deploying..." -Type "INFO"
try {
Invoke-WebRequest -Uri $aapt2Url -OutFile $localPath -UseBasicParsing
Write-Message -Message "Downloaded aapt2" -Type "INFO"
} catch {
Write-Message -Message "Error downloading aapt2: $_" -Type "ERROR"
return
}
adb push $localPath $devicePath | Out-Null
adb shell "chmod 777 $devicePath" | Out-Null
Write-Message -Message "aapt2 deployed successfully" -Type "INFO"
Remove-Item $localPath -ErrorAction SilentlyContinue
} else {
Write-Message -Message "aapt2 already exists on device" -Type "INFO"
}
# Get package list
Write-Message -Message "Getting package list..." -Type "INFO"
$packages = adb shell pm list packages -3 | ForEach-Object { ($_ -replace 'package:', '').Trim() } | Where-Object { $_ }
Write-Message -Message "Extracting display names for $($packages.Count) apps using $MaxThreads threads..." -Type "INFO"
# Create runspace pool
$runspacePool = [runspacefactory]::CreateRunspacePool(1, $MaxThreads)
$runspacePool.Open()
# Script block for each thread
$scriptBlock = {
param($package, $devicePath)
try {
$apkPath = (adb shell pm path $package) -replace 'package:', '' | Select-Object -First 1
$apkPath = $apkPath.Trim()
if ($apkPath) {
$badging = adb shell "$devicePath dump badging '$apkPath' 2>/dev/null" | Select-String "application-label:"
if ($badging -match "application-label:'([^']+)'") {
$label = $matches[1]
} else {
$label = $package
}
} else {
$label = $package
}
[PSCustomObject]@{
PackageName = $package
DisplayName = $label
}
} catch {
[PSCustomObject]@{
PackageName = $package
DisplayName = $package
}
}
}
# Create jobs
$jobs = @()
foreach ($package in $packages) {
$powershell = [powershell]::Create().AddScript($scriptBlock).AddArgument($package).AddArgument($devicePath)
$powershell.RunspacePool = $runspacePool
$jobs += [PSCustomObject]@{
Pipe = $powershell
Result = $powershell.BeginInvoke()
}
}
# Collect results
$apps = @()
$completed = 0
foreach ($job in $jobs) {
$apps += $job.Pipe.EndInvoke($job.Result)
$job.Pipe.Dispose()
$completed++
Write-Progress -Activity "Processing apps" -Status "$completed of $($packages.Count)" -PercentComplete (($completed / $packages.Count) * 100)
}
Write-Progress -Activity "Processing apps" -Completed
# Cleanup
$runspacePool.Close()
$runspacePool.Dispose()
# Export to CSV
$apps | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding UTF8
Write-Message -Message "Exported $($apps.Count) apps to $OutputPath" -Type "INFO"
Invoke-Item "$OutputPath"
}
############# ADBCheckBin
function ADBCheckBin{
if (-not(Test-Path -Path "$VARCD\cmdline-tools" )) {
Write-Message -Message "Downloading Android Command Line Tools" -Type "INFO"
downloadFile "https://dl.google.com/android/repository/commandlinetools-win-9477386_latest.zip" "$VARCD\commandlinetools-win.zip"
Write-Message -Message "Extracting AVD" -Type "INFO"
Expand-Archive -Path "$VARCD\commandlinetools-win.zip" -DestinationPath "$VARCD" -Force
Write-Message -Message "Setting path to latest that AVD wants ..." -Type "INFO"
Rename-Item -Path "$VARCD\cmdline-tools" -NewName "$VARCD\latest"
New-Item -Path "$VARCD\cmdline-tools" -ItemType Directory
Move-Item "$VARCD\latest" "$VARCD\cmdline-tools\"
Write-Message -Message "Creating licenses Files" -Type "INFO"
$licenseContentBase64 = "UEsDBBQAAAAAAKNK11IAAAAAAAAAAAAAAAAJAAAAbGljZW5zZXMvUEsDBAoAAAAAAJ1K11K7n0IrKgAAACoAAAAhAAAAbGljZW5zZXMvYW5kcm9pZC1nb29nbGV0di1saWNlbnNlDQo2MDEwODViOTRjZDc3ZjBiNTRmZjg2NDA2OTU3MDk5ZWJlNzljNGQ2UEsDBAoAAAAAAKBK11LzQumJKgAAACoAAAAkAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstYXJtLWRidC1saWNlbnNlDQo4NTlmMzE3Njk2ZjY3ZWYzZDdmMzBhNTBhNTU2MGU3ODM0YjQzOTAzUEsDBAoAAAAAAKFK11IKSOJFKgAAACoAAAAcAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstbGljZW5zZQ0KMjQzMzNmOGE2M2I2ODI1ZWE5YzU1MTRmODNjMjgyOWIwMDRkMWZlZVBLAwQKAAAAAACiStdSec1a4SoAAAAqAAAAJAAAAGxpY2Vuc2VzL2FuZHJvaWQtc2RrLXByZXZpZXctbGljZW5zZQ0KODQ4MzFiOTQwOTY0NmE5MThlMzA1NzNiYWI0YzljOTEzNDZkOGFiZFBLAwQKAAAAAACiStdSk6vQKCoAAAAqAAAAGwAAAGxpY2Vuc2VzL2dvb2dsZS1nZGstbGljZW5zZQ0KMzNiNmEyYjY0NjA3ZjExYjc1OWYzMjBlZjlkZmY0YWU1YzQ3ZDk3YVBLAwQKAAAAAACiStdSrE3jESoAAAAqAAAAJAAAAGxpY2Vuc2VzL2ludGVsLWFuZHJvaWQtZXh0cmEtbGljZW5zZQ0KZDk3NWY3NTE2OThhNzdiNjYyZjEyNTRkZGJlZWQzOTAxZTk3NmY1YVBLAwQKAAAAAACjStdSkb1vWioAAAAqAAAAJgAAAGxpY2Vuc2VzL21pcHMtYW5kcm9pZC1zeXNpbWFnZS1saWNlbnNlDQplOWFjYWI1YjVmYmI1NjBhNzJjZmFlY2NlODk0Njg5NmZmNmFhYjlkUEsBAj8AFAAAAAAAo0rXUgAAAAAAAAAAAAAAAAkAJAAAAAAAAAAQAAAAAAAAAGxpY2Vuc2VzLwoAIAAAAAAAAQAYACIHOBcRaNcBIgc4FxFo1wHBTVQTEWjXAVBLAQI/AAoAAAAAAJ1K11K7n0IrKgAAACoAAAAhACQAAAAAAAAAIAAAACcAAABsaWNlbnNlcy9hbmRyb2lkLWdvb2dsZXR2LWxpY2Vuc2UKACAAAAAAAAEAGACUEFUTEWjXAZQQVRMRaNcB6XRUExFo1wFQSwECPwAKAAAAAACgStdS80LpiSoAAAAqAAAAJAAkAAAAAAAAACAAAACQAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstYXJtLWRidC1saWNlbnNlCgAgAAAAAAABABgAsEM0FBFo1wGwQzQUEWjXAXb1MxQRaNcBUEsBAj8ACgAAAAAAoUrXUgpI4kUqAAAAKgAAABwAJAAAAAAAAAAgAAAA/AAAAGxpY2Vuc2VzL2FuZHJvaWQtc2RrLWxpY2Vuc2UKACAAAAAAAAEAGAAsMGUVEWjXASwwZRURaNcB5whlFRFo1wFQSwECPwAKAAAAAACiStdSec1a4SoAAAAqAAAAJAAkAAAAAAAAACAAAABgAQAAbGljZW5zZXMvYW5kcm9pZC1zZGstcHJldmlldy1saWNlbnNlCgAgAAAAAAABABgA7s3WFRFo1wHuzdYVEWjXAfGm1hURaNcBUEsBAj8ACgAAAAAAokrXUpOr0CgqAAAAKgAAABsAJAAAAAAAAAAgAAAAzAEAAGxpY2Vuc2VzL2dvb2dsZS1nZGstbGljZW5zZQoAIAAAAAAAAQAYAGRDRxYRaNcBZENHFhFo1wFfHEcWEWjXAVBLAQI/AAoAAAAAAKJK11KsTeMRKgAAACoAAAAkACQAAAAAAAAAIAAAAC8CAABsaWNlbnNlcy9pbnRlbC1hbmRyb2lkLWV4dHJhLWxpY2Vuc2UKACAAAAAAAAEAGADGsq0WEWjXAcayrRYRaNcBxrKtFhFo1wFQSwECPwAKAAAAAACjStdSkb1vWioAAAAqAAAAJgAkAAAAAAAAACAAAACbAgAAbGljZW5zZXMvbWlwcy1hbmRyb2lkLXN5c2ltYWdlLWxpY2Vuc2UKACAAAAAAAAEAGAA4LjgXEWjXATguOBcRaNcBIgc4FxFo1wFQSwUGAAAAAAgACACDAwAACQMAAAAA"
$licenseContent = [System.Convert]::FromBase64String($licenseContentBase64)
Set-Content -Path "$VARCD\android-sdk-licenses.zip" -Value $licenseContent -Encoding Byte
Expand-Archive "$VARCD\android-sdk-licenses.zip" -DestinationPath "$VARCD\" -Force
Start-Sleep -Seconds 5
Start-Process -FilePath "$VARCD\cmdline-tools\latest\bin\sdkmanager.bat" -ArgumentList "platform-tools" -Verbose -Wait -NoNewWindow
}
}
############# EXECheckOllama
function EXECheckOllama{
if (-not(Test-Path -Path "$VARCD\Ollama" )) {
try {
Write-Message "Downloading Ollama" -Type "INFO"
New-Item -Path "$VARCD\Ollama\" -ItemType Directory -ErrorAction SilentlyContinue |Out-Null
downloadFile "https://ollama.com/download/OllamaSetup.exe" "$VARCD\Ollama\OllamaSetup.exe"
Write-Message "Installing Ollama to $VARCD\Ollama" -Type "INFO"
Start-Process -FilePath "$VARCD\Ollama\OllamaSetup.exe" -WorkingDirectory "$VARCD\Ollama\" -ArgumentList " /SILENT /NORESTART /DIR=`"$VARCD\Ollama`" " -NoNewWindow
Write-Message "Waiting for Ollama to start" -Type "INFO"
while(!(Get-Process "ollama app" -ErrorAction SilentlyContinue)){Start-Sleep -Seconds 5};Write-Message "Waiting for Ollama to start" -Type "INFO"
Write-Message "Installing base models" -Type "INFO"
Start-Process -FilePath "$VARCD\Ollama\Ollama.exe" -WorkingDirectory "$VARCD\Ollama\" -ArgumentList " pull nomic-embed-text " -wait -NoNewWindow
Start-Process -FilePath "$VARCD\Ollama\Ollama.exe" -WorkingDirectory "$VARCD\Ollama\" -ArgumentList " pull hf.co/Sweaterdog/Andy-3.6:Q4_K_M " -wait -NoNewWindow
Remove-Item -Path "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Ollama.lnk" -Force -ErrorAction SilentlyContinue |Out-Null
Write-Message "Setting .ollama OLLAMA_MODELS System.Environment to $VARCD\Ollama\ and listen on 0.0.0.0" -Type "INFO"
[System.Environment]::SetEnvironmentVariable("OLLAMA_MODELS", "$VARCD\Ollama\.ollama", [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable("OLLAMA_HOST", "0.0.0.0", [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable("OLLAMA_KEEP_ALIVE", "-1", [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable("OLLAMA_FLASH_ATTENTION", "1", [System.EnvironmentVariableTarget]::Machine)
}
catch {
throw $_.Exception.Message
}
}
else {
Stop-process -name ollama -Force -ErrorAction SilentlyContinue |Out-Null
Stop-process -name "ollama app" -Force -ErrorAction SilentlyContinue |Out-Null
Write-Message "Downloading Latetst binary from github" -Type "INFO"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri "https://api.github.com/repos/ollama/ollama/releases/latest").assets | Where-Object name -like ollama-windows-amd64.zip ).browser_download_url
downloadFile $downloadUri "$VARCD\ollama-windows-amd64.zip"
Write-Message -Message "Extracting ollama-windows-amd64.zip" -Type "INFO"
Add-Type -AssemblyName System.IO.Compression.FileSystem
Add-Type -AssemblyName System.IO.Compression
[System.IO.Compression.ZipFile]::ExtractToDirectory("$VARCD\ollama-windows-amd64.zip", "$VARCD\Ollama\")
Write-Message "Starting Ollama ...." -Type "INFO"
Stop-process -name ollama -Force -ErrorAction SilentlyContinue |Out-Null
Stop-process -name "ollama app" -Force -ErrorAction SilentlyContinue |Out-Null
Start-Sleep -Seconds 1
Start-Process -FilePath "$VARCD\Ollama\ollama app.exe" -WorkingDirectory "$VARCD\Ollama\"
while(!(Get-Process "ollama app" -ErrorAction SilentlyContinue)){Start-Sleep -Seconds 5};Write-Message "Waiting for Ollama to start" -Type "INFO"
Start-Sleep -Seconds 2
Remove-Item -Path "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Ollama.lnk" -Force -ErrorAction SilentlyContinue |Out-Null
}
}
Function CheckLMStudio {
[string]$InstallerUrl = "https://installers.lmstudio.ai/win32/x64/0.4.6-1/LM-Studio-0.4.6-1-x64.exe"
[string]$InstallerDir = "$VARCD\Installer"
[string]$LMStudioDir = "$VARCD\LMStudio"
[string]$LMSDataDir = "$VARCD\.lmstudio"
[string]$LMExe = "$LMStudioDir\LM Studio.exe"
[string]$LMSSourceExe = "$LMStudioDir\resources\app\.webpack\lms.exe"
[string]$LMSBinPath = "$VARCD\.lmstudio\bin\lms.exe"
[string]$RealUserProfile = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::UserProfile)
[string]$RealAppData = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::ApplicationData)
[string]$RealLocalData = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::LocalApplicationData)
[int]$ApiPort = 1234
foreach ($d in @($InstallerDir,$LMStudioDir,$LMSDataDir,"$LMSDataDir\.internal","$VARCD\Logs","$VARCD\.cache\lm-studio\models","$VARCD\.config","$VARCD\.local\share")) { New-Item -ItemType Directory -Force -Path $d | Out-Null }
Set-Content -Path "$VARCD\.lmstudio-home-pointer" -Value $LMSDataDir -NoNewline
Set-Content -Path "$RealUserProfile\.lmstudio-home-pointer" -Value $LMSDataDir -NoNewline
Write-Message -Type "INFO" -Message "home-pointer -> $LMSDataDir (portable: $VARCD | real: $RealUserProfile)"
[string]$InstallerPath = "$InstallerDir\$([System.IO.Path]::GetFileName($InstallerUrl))"
if (-not (Test-Path $InstallerPath)) {
Write-Message -Type "INFO" -Message "Downloading LM Studio installer..."
downloadFile $InstallerUrl $InstallerPath
Write-Message -Type "INFO" -Message "Download complete."
} else {
Write-Message -Type "WARNING" -Message "Installer already downloaded: $InstallerPath"
}
if (-not (Test-Path $LMExe)) {
Write-Message -Type "INFO" -Message "Extracting LM Studio to $LMStudioDir ..."
Start-Process -FilePath $InstallerPath -ArgumentList "/S","/D=`"$LMStudioDir`"" -Wait
if (-not (Test-Path $LMExe)) { Write-Message -Type "ERROR" -Message "Extraction failed - LM Studio.exe not found at $LMExe"; return }
Write-Message -Type "INFO" -Message "Extraction complete."
} else {
Write-Message -Type "WARNING" -Message "LM Studio already extracted: $LMExe"
}
if (-not (Test-Path $LMSBinPath)) {
Write-Message -Type "INFO" -Message "lms.exe not found at $LMSBinPath"
Write-Message -Type "INFO" -Message "Launching LM Studio bootstrap to trigger DelayedInit lms extraction..."
$bootstrapProc = Start-Process -FilePath $LMExe -PassThru
Write-Message -Type "INFO" -Message "Bootstrap PID: $($bootstrapProc.Id) - waiting for lms.exe..."
Write-Message -Type "INFO" -Message " Portable bin : $LMSBinPath"
Write-Message -Type "INFO" -Message " Webpack src : $LMSSourceExe"
[int]$maxWait = 120; [int]$waited = 0; [bool]$lmsReady = $false
while ($waited -lt $maxWait) {
Start-Sleep -Seconds 1; $waited++
[bool]$binExists = Test-Path $LMSBinPath
[bool]$sourceExists = Test-Path $LMSSourceExe
[bool]$procAlive = -not $bootstrapProc.HasExited
Write-Message -Type "INFO" -Message "[$waited/$maxWait] portableBin=$binExists webpackSrc=$sourceExists procAlive=$procAlive"
if ($binExists) { Write-Message -Type "INFO" -Message "lms.exe confirmed at portable bin path after $waited sec"; $lmsReady = $true; break }
if (-not $procAlive) {
Write-Message -Type "WARNING" -Message "Bootstrap exited at $waited sec - checking paths..."
if (Test-Path $LMSBinPath) { $lmsReady = $true; break }
if (Test-Path $LMSSourceExe) {
Write-Message -Type "WARNING" -Message "Portable bin missing - copying from webpack src..."
New-Item -ItemType Directory -Force -Path (Split-Path $LMSBinPath) | Out-Null
Copy-Item -Path $LMSSourceExe -Destination $LMSBinPath -Force
if (Test-Path $LMSBinPath) { $lmsReady = $true; Write-Message -Type "INFO" -Message "Manual copy succeeded." }
}
break
}
}
if (-not $lmsReady -and (Test-Path $LMSSourceExe)) {
Write-Message -Type "WARNING" -Message "Timeout - attempting manual copy from webpack src..."
New-Item -ItemType Directory -Force -Path (Split-Path $LMSBinPath) | Out-Null
Copy-Item -Path $LMSSourceExe -Destination $LMSBinPath -Force
if (Test-Path $LMSBinPath) { $lmsReady = $true; Write-Message -Type "INFO" -Message "Manual copy succeeded: $LMSBinPath" }
}
if (-not $lmsReady) {
Write-Message -Type "ERROR" -Message "lms.exe not found after bootstrap. Dumping .lmstudio tree:"
Get-ChildItem -Path $LMSDataDir -Recurse -ErrorAction SilentlyContinue | ForEach-Object { Write-Message -Type "ERROR" -Message " $($_.FullName)" }
Write-Message -Type "ERROR" -Message "Portable bin : $LMSBinPath (exists=$(Test-Path $LMSBinPath))"
Write-Message -Type "ERROR" -Message "Webpack src : $LMSSourceExe (exists=$(Test-Path $LMSSourceExe))"
return
}
Write-Message -Type "INFO" -Message "LM Studio UI left running (PID $($bootstrapProc.Id))."
} else {
Write-Message -Type "INFO" -Message "lms.exe already exists: $LMSBinPath"
Write-Message -Type "INFO" -Message "Launching LM Studio UI..."
$LMSProc = Start-Process -FilePath $LMExe -ArgumentList "--minimized" -PassThru
Write-Message -Type "INFO" -Message "LM Studio PID: $($LMSProc.Id)"
Start-Sleep -Seconds 3
}
[string]$SettingsPath = "$LMSDataDir\settings.json"
[int]$maxWait = 30; [int]$waited = 0; [bool]$settingsReady = $false
while ($waited -lt $maxWait) {
Start-Sleep -Seconds 2; $waited += 2
if (Test-Path $SettingsPath) { Write-Message -Type "INFO" -Message "settings.json found at $waited sec"; Start-Sleep -Seconds 1; $settingsReady = $true; break }
Write-Message -Type "INFO" -Message "Waiting for settings.json ... $waited / $maxWait sec"
}
if (-not $settingsReady) { Write-Message -Type "WARNING" -Message "settings.json not found within $maxWait sec - patching anyway." }
try { $cfg = if (Test-Path $SettingsPath) { Get-Content $SettingsPath -Raw -ErrorAction Stop | ConvertFrom-Json } else { [PSCustomObject]@{} } } catch { $cfg = [PSCustomObject]@{} }
$cfg | Add-Member -MemberType NoteProperty -Name "autoStartServer" -Value $true -Force
$cfg | Add-Member -MemberType NoteProperty -Name "serverPort" -Value $ApiPort -Force
$cfg | Add-Member -MemberType NoteProperty -Name "serverCorsEnabled" -Value $true -Force
$cfg | Add-Member -MemberType NoteProperty -Name "developerMode" -Value $true -Force
$cfg | Add-Member -MemberType NoteProperty -Name "justInTimeModelLoading" -Value $true -Force
$cfg | Add-Member -MemberType NoteProperty -Name "verboseLogging" -Value $false -Force
$cfg | ConvertTo-Json -Depth 10 | Set-Content -Path $SettingsPath -Force
Write-Message -Type "INFO" -Message "Settings patched: $SettingsPath"
Write-Message -Type "INFO" -Message "Running: lms daemon up..."
Start-Process -FilePath $LMSBinPath -ArgumentList "daemon","up" -NoNewWindow -Wait
Write-Message -Type "INFO" -Message "daemon up complete."
Write-Message -Type "INFO" -Message "Running: lms server start --bind 0.0.0.0 --cors --port $ApiPort ..."
$SrvProc = Start-Process -FilePath $LMSBinPath -ArgumentList "server","start","--bind","0.0.0.0","--cors","--port","$ApiPort" -NoNewWindow -PassThru
Write-Message -Type "INFO" -Message "lms server PID: $($SrvProc.Id)"
[int]$elapsed = 0; [bool]$portOpen = $false
while ($elapsed -lt 30) {
Start-Sleep -Seconds 2; $elapsed += 2
try { $tc = New-Object System.Net.Sockets.TcpClient; $tc.Connect("127.0.0.1",$ApiPort); if ($tc.Connected) { $tc.Close(); $portOpen = $true; break } } catch {}
Write-Message -Type "INFO" -Message "Waiting for port $ApiPort ... $elapsed / 30 sec"
}
if ($portOpen) { Write-Message -Type "INFO" -Message "LM Studio API UP: http://0.0.0.0:${ApiPort}/v1" } else { Write-Message -Type "WARNING" -Message "Port $ApiPort not open after 30 sec - may still be loading." }
Write-Message -Type "INFO" -Message "CheckLMStudio complete."
}
############# Get-PythonNuGet
function Get-PythonNuGet {
[CmdletBinding()]
param(
[Parameter()]
[string]$DownloadPath
)
$ErrorActionPreference = 'Stop'
if ([string]::IsNullOrEmpty($DownloadPath)) {
$DownloadPath = Join-Path -Path $env:USERPROFILE -ChildPath 'Downloads\python'
}
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
try {
$response = Invoke-RestMethod -Uri 'https://api.nuget.org/v3-flatcontainer/python/index.json' -ErrorAction Stop
[string[]]$allVersions = $response.versions
} catch {
$currentError = $_
[System.Windows.Forms.MessageBox]::Show("Failed to fetch versions:`n$($currentError.Exception.Message)", 'Error', 'OK', 'Error') | Out-Null
return
}
[string[]]$stableVersions = $allVersions | Where-Object { $_ -notmatch '-' }
[string[]]$stableVersions = $stableVersions | Sort-Object -Descending -Property {
$parts = $_ -split '\.'
[int]$parts[0] * 1000000 + [int]$parts[1] * 10000 + [int]$parts[2] * 100 + $(if ($parts.Count -gt 3) { [int]$parts[3] } else { 0 })
}
$form = New-Object System.Windows.Forms.Form
$form.Text = 'Select Python Version'
$form.Size = New-Object System.Drawing.Size(450, 450)
$form.StartPosition = 'CenterScreen'
$form.FormBorderStyle = 'FixedDialog'
$form.MaximizeBox = $false
$label = New-Object System.Windows.Forms.Label
$label.Text = "Select a Python version to download:`nAll versions include pip. (3.7.2+ use: python -m pip)"
$label.Location = New-Object System.Drawing.Point(12, 12)
$label.Size = New-Object System.Drawing.Size(410, 36)
$form.Controls.Add($label)
$listBox = New-Object System.Windows.Forms.ListBox
$listBox.Location = New-Object System.Drawing.Point(12, 52)
$listBox.Size = New-Object System.Drawing.Size(410, 300)
$listBox.Font = New-Object System.Drawing.Font('Consolas', 10)
foreach ($ver in $stableVersions) { [void]$listBox.Items.Add($ver) }
$listBox.SelectedIndex = 0
$form.Controls.Add($listBox)
$btnOK = New-Object System.Windows.Forms.Button
$btnOK.Text = 'Download and Extract'
$btnOK.Location = New-Object System.Drawing.Point(12, 365)
$btnOK.Size = New-Object System.Drawing.Size(200, 30)
$btnOK.DialogResult = 'OK'
$form.Controls.Add($btnOK)
$btnCancel = New-Object System.Windows.Forms.Button
$btnCancel.Text = 'Cancel'
$btnCancel.Location = New-Object System.Drawing.Point(222, 365)
$btnCancel.Size = New-Object System.Drawing.Size(200, 30)
$btnCancel.DialogResult = 'Cancel'
$form.Controls.Add($btnCancel)
$form.AcceptButton = $btnOK
$form.CancelButton = $btnCancel
$listBox.Add_DoubleClick({ $form.DialogResult = 'OK'; $form.Close() })
if ($form.ShowDialog() -ne 'OK') { $form.Dispose(); return }
[string]$selectedVersion = $listBox.SelectedItem.ToString()
$form.Dispose()
[string]$nupkgFile = Join-Path -Path $env:TEMP -ChildPath "python.${selectedVersion}.nupkg"
if (-not (Test-Path -Path $DownloadPath)) {
New-Item -ItemType Directory -Path $DownloadPath -Force | Out-Null
}
Write-Message -Message "Downloading Python ${selectedVersion}..." -Type "INFO"
$webClient = $null
try {
$webClient = New-Object System.Net.WebClient
$webClient.DownloadFile("https://www.nuget.org/api/v2/package/python/${selectedVersion}", $nupkgFile)
} catch {
$currentError = $_
[System.Windows.Forms.MessageBox]::Show("Download failed:`n$($currentError.Exception.Message)", 'Error', 'OK', 'Error') | Out-Null
return
} finally {
if ($webClient) { $webClient.Dispose() }
}
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($nupkgFile, $DownloadPath)
} catch {
$currentError = $_
[System.Windows.Forms.MessageBox]::Show("Extraction failed:`n$($currentError.Exception.Message)", 'Error', 'OK', 'Error') | Out-Null
return
}
Remove-Item -Path $nupkgFile -Force -ErrorAction SilentlyContinue
[string]$pythonExe = Join-Path -Path $DownloadPath -ChildPath 'tools\python.exe'
[string]$pipExe = Join-Path -Path $DownloadPath -ChildPath 'tools\Scripts\pip3.exe'
if (Test-Path -Path $pipExe) {
[string]$pipInfo = "Pip: ${pipExe}"
} else {
[string]$pipInfo = "Pip: ${pythonExe} -m pip"
}
[System.Windows.Forms.MessageBox]::Show(
"Python ${selectedVersion} ready!`n`nPython: ${pythonExe}`n${pipInfo}`n`nPATH: $(Join-Path -Path $DownloadPath -ChildPath 'tools');$(Join-Path -Path $DownloadPath -ChildPath 'tools\Scripts')",
'Success', 'OK', 'Information'
) | Out-Null
Write-Message -Message "Done. Python ${selectedVersion} at: ${DownloadPath}" -Type "INFO"
New-Item -ItemType Directory -Path "$VARCD\python\tools\Scripts" -ErrorAction SilentlyContinue |Out-Null
# DO NOT INDENT THIS PART
$PipBatch = @'
python -m pip %*
'@
$PipBatch | Out-File -Encoding Ascii -FilePath "$VARCD\python\tools\Scripts\pip.bat" -ErrorAction SilentlyContinue |Out-Null
# DO NOT INDENT THIS PART
Write-Message -Message "Updating pip" -Type "INFO"
Start-Process -FilePath "$VARCD\python\tools\python.exe" -WorkingDirectory "$VARCD\python\tools" -ArgumentList " -m pip install --upgrade pip " -wait -NoNewWindow
}
######################################################################################################################### FUNCTIONS END
CheckVer
Test-PathLength
############# StartBurp
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "BurpSuite Community"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({StartBurp})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# AVDStart
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Start AVD" #AVDStart
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({AVDStart})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# RootAVD
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "RootAVD/Install Magisk"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({RootAVD})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############## CertPush
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Upload BURP.pem as System Cert"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({CertPush})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############## Startiptables
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Force Traffic to BURP"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({Startiptables})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# CheckRMS
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "RMS: Runtime Mobile Security"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({StartRMS})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# StartFrida
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Start Frida-Server"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({StartFrida})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# StartFrida/SSLDepinning
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Frida/AntiRoot/SSLDepinning"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({StartJAMBOREE_SSL_N_ANTIROOT})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# StartObjection
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "StartObjection"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({StartObjection})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# CMDPrompt
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Shell"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({CMDPrompt})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# StartBurpPro
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Burp Suite Pro"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({StartBurpPro})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# BurpWithZap
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Burp Suite Community/ZAP"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({BurpWithZap})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# BurpProWithZap
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Burp Suite Pro/ZAP"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({BurpProWithZap})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# StartZAP
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "ZAP"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({StartZAP})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# StartADB
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "ADB Logcat"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({StartADB})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# AVDPoweroff
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Shutdown AVD"
$Button.Location = New-Object System.Drawing.Point(($hShift),($vShift+0))
$Button.Add_Click({AVDPoweroff})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# AVDWipeData
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "AVD -wipe-data (Fix unauthorized adb)"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({AVDWipeData})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# InstallAPKS
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Install Base APKs"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({InstallAPKS})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# ADBDumpDisplayName
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Dump App Names"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({ADBDumpDisplayName})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############ KillADB
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Kill adb.exe"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({KillADB})
$main_form.Controls.Add($Button)
$vShift = 0
$hShift = $hShift + 250
############# SharpHoundRun
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "SharpHound"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({SharpHoundRun})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# Neo4jRun
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Neo4j"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({Neo4jRun})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# Bloodhound
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Bloodhound"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({BloodhoundRun})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# CheckLMStudio
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "LM Studio"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({CheckLMStudio})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# CheckPyCharm
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "PyCharm"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({CheckPyCharm})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# Get-PythonNuGet
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "DL Old Python"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({Get-PythonNuGet -DownloadPath "$VARCD\python"})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# CheckVSCode
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "VS Code"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({CheckVSCode})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# EXECheckOllama
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Ollama Windows EXE"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({EXECheckOllama})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# WSLShrink
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "WSL Shrink"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({WSLShrink})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# StartSillyTavern
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "SillyTavern"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({StartSillyTavern})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# CheckPostgres
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "PostgreSQL"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({CheckPostgres})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# CheckArduino
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Arduino IDE"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({CheckArduino})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# PushDuckyLoad
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Duck2Spark"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({PushDuckyLoad})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# Ytdlp
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Ytdlp"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({Ytdlp})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# CheckVolatility3
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Volatility 3"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({CheckVolatility3})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# WipeForwardRules
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Clear netsh portproxy rules"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({WipeForwardRules})
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# WipeForwardRules
$Button = New-Object System.Windows.Forms.Button
$Button.AutoSize = $true
$Button.Text = "Clear Log"
$Button.Location = New-Object System.Drawing.Point(($hShift+0),($vShift+0))
$Button.Add_Click({ $Global:OutputBox.Clear() })
$main_form.Controls.Add($Button)
$vShift = $vShift + 30
############# SHOW FORM
$main_form.ShowDialog()